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:
1
{
2
...
3
"type": "base.payment.send",
4
"data": {
5
"sender": "EON-A7CJA-F3PUZ-DKVSK",
6
"target": "EON-LA8RA-QADLL-EBPRW",
7
"amount": 1000000
8
}
9
}
Copied!

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:
1
{
2
...
3
"type": "base.payment.swap.begin",
4
"data": {
5
"alg": "sha-512",
6
"amount": 1000,
7
"hash": "vSsar3708Jvp9Szi2NWZZ02Bqp1qRCFpbcTZPdBhnWgs5WtNZKnvCXdhztmeD2cmW192CF5bDufKRpayrW/isg==",
8
"id": "SWAP-PHQDB-ZCK74-VTKZS",
9
"sender": "EON-HRAEQ-8NZL7-C9LHJ",
10
"target": "EON-UBYUQ-GXFZ8-8XPTP",
11
"timestamp": 1593005737
12
}
13
}
Copied!

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:
1
{
2
...
3
"type": "base.payment.swap.commit",
4
"data": {
5
"id": "SWAP-PHQDB-ZCK74-VTKZS",
6
"secret": "secret",
7
"sender": "EON-HRAEQ-8NZL7-C9LHJ",
8
"target": "EON-J72W8-NB38U-P5RPU"
9
}
10
}
Copied!

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:
1
{
2
...
3
"type": "base.payment.swap.rollback",
4
"data": {
5
"id": "SWAP-PHQDB-ZCK74-VTKZS",
6
"sender": "EON-HRAEQ-8NZL7-C9LHJ"
7
}
8
}
Copied!
  • 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:
1
{
2
...
3
"type": "base.payment.swap.cancel",
4
"data": {
5
"id": "SWAP-PHQDB-ZCK74-VTKZS",
6
"sender": "EON-HRAEQ-8NZL7-C9LHJ",
7
"target": "EON-J72W8-NB38U-P5RPU"
8
}
9
}
Copied!
Last modified 10mo ago