Balance transfer commands

These commands are available in the core and payment network.

base.payment.send - Transfer

  • sender : String - EON-ID of the sending account.

  • target : String - EON-ID of the recipient account.

  • amount : long - amount transferred.

The command is signed by the account specified in sender.

Possible errors:

  • "Invalid value" - The transfer amount was set incorrectly.

  • "Exceeds balance value" - insufficient funds on the balance.

Example:

{
    ...
    "type": "base.payment.send",
    "data": {
        "sender": "EON-A7CJA-F3PUZ-DKVSK",
        "target": "EON-LA8RA-QADLL-EBPRW",
        "amount": 1000000
    }
}

Atomic swaps

You can read more about how atomic swaps works here:

base.payment.swap.begin - BeginSwap - Begin swap

  • sender - sender.

  • target - recipient.

  • timestamp - expiration time.

  • alg - hashing algorithm. Supports SHA-512.

  • hash - hash in Base64.

  • id - swap identifier. Calculated by hash (similar to Acc-ID calculation by public key), but with "SWAP-" prefix.

  • amount - amount transferred.

The command is signed by the account specified in sender.

Possible errors:

  • "Hash algorithm not supported" - an unsupported HASH algorithm is set.

  • "Incorrect swap id" - SWAP-ID is set incorrectly.

  • "Swap already exist" - swap with this hash is already in use.

  • "Incorrect timestamp" - swap end time is not set correctly (the time has already expired).

  • "Unknown target account" - recipient's account is absent.

  • "Invalid value" - swap ammount is set incorrectly.

  • "Exceeds balance value" - insufficient funds on the balance.

Example:

{
    ...
    "type": "base.payment.swap.begin",
    "data": {
        "alg": "sha-512",
        "amount": 1000,
        "hash": "vSsar3708Jvp9Szi2NWZZ02Bqp1qRCFpbcTZPdBhnWgs5WtNZKnvCXdhztmeD2cmW192CF5bDufKRpayrW/isg==",
        "id": "SWAP-PHQDB-ZCK74-VTKZS",
        "sender": "EON-HRAEQ-8NZL7-C9LHJ",
        "target": "EON-UBYUQ-GXFZ8-8XPTP",
        "timestamp": 1593005737
    }
}

base.payment.swap.commit - CommitSwap - Transaction completion

  • id - swap identifier.

  • sender - swap initiator.

  • target - recipient.

The command does not require a signature.

Possible errors:

  • "Unknown swap" - unknown swap.

  • "Swap is over" - swap is already over.

  • "Wrong secret" - wrong secret.

  • "Unsupported hash algorithm" - unsupported HASH algorithm.

Example:

{
    ...
    "type": "base.payment.swap.commit",
    "data": {
        "id": "SWAP-PHQDB-ZCK74-VTKZS",
        "secret": "secret",
        "sender": "EON-HRAEQ-8NZL7-C9LHJ",
        "target": "EON-J72W8-NB38U-P5RPU"
    }
}

base.payment.swap.rollback - RollbackSwap - Swap rollback

  • id - exchange identifier.

  • sender - exchange initiator.

The command does not require a signature.

Possible errors:

  • "Unknown swap" - unknown swap

  • "Swap is active" - swap is still active.

Example:

{
    ...
    "type": "base.payment.swap.rollback",
    "data": {
        "id": "SWAP-PHQDB-ZCK74-VTKZS",
        "sender": "EON-HRAEQ-8NZL7-C9LHJ"
    }
}
  • id - swap identifier.

  • sender - exchange initiator.

  • target - recipient.

The command is signed by the accounts specified in sender and target.

Possible errors:

  • "Unknown swap" - unknown swap.

  • "Incorrect target" - swap recipient is set incorrectly.

Example:

{
    ...
    "type": "base.payment.swap.cancel",
    "data": {
        "id": "SWAP-PHQDB-ZCK74-VTKZS",
        "sender": "EON-HRAEQ-8NZL7-C9LHJ",
        "target": "EON-J72W8-NB38U-P5RPU"
    }
}

Last updated