Colored coins
These transactions are available in the payment blockchain.

color.coin.new - Registration of a new colored coin

  • sender : String - EON-ID of the account.
  • decimal : long - the number of digits in the fractional part (from 0 to 10).
Possible errors:
  • "Account has been already associated with the colored coin" - colored coin has already been issued.
  • "The 'decimalPoint' field value is out of range" - accuracy is set incorrectly.
The command is signed by the account specified in sender.
1
{
2
...
3
"type": "color.coin.new",
4
"data": {
5
"sender": "EON-A7CJA-F3PUZ-DKVSK",
6
"decimal": 2
7
}
8
}
Copied!

color.payment.send - Sending the colored coin

  • sender : String - EON-ID of the sender.
  • target : String - EON-ID of the recipient.
  • amount : long - amount transferred.
  • color : String - coin type.
The command is signed by the account specified in sender.
Possible errors:
  • "Insufficient number of colored coins on the balance" - insufficient funds on the balance.
  • "The number has reached the limit" - too many colored coins on the balance.
  • "The 'amount' field value is out of range" - swap amount was set incorrectly.
Example:
1
{
2
...
3
"type": "color.payment.send",
4
"data": {
5
"sender": "EON-A7CJA-F3PUZ-DKVSK",
6
"target": "EON-A7CJA-F3PUZ-DKVSK",
7
"amount": 2000,
8
"color": "EON-C-A7CJA-F3PUZ-DKVSK"
9
}
10
}
Copied!

Atomic swap of colored coins

You can read more about how atomic swaps works here:

color.payment.swap.begin - BeginSwap - Begin swap

  • sender - sender.
  • target - recipient.
  • timestamp - expiration time.
  • alg - hashing algorithm. Supports SHA-512.
  • hash - hash in Base64.
  • id - exchange identifier. Calculated by hash (similar to Acc-ID calculation by public key), but with "SWAP-" prefix.
  • amount - amount transferred.
  • color - coin type.
The command is signed by the account specified in sender.
Possible errors:
  • "Hash algorithm not supported" - unsupported HASH algorithm is set.
  • "Incorrect swap id" - SWAP-ID is set incorrectly.
  • "Swap already exist" - swap with such a hash is already in use.
  • "Incorrect timestamp" - The exchange end time is not set correctly (the time has already expired)
  • "Unknown target account" - there is no recipient's account.
  • "Insufficient number of colored coins on the balance" - insufficient amount of funds on the balance.
  • "The 'amount' field value is out of range" - swap amount was set incorrectly.
Example:
1
{
2
...
3
"type": "color.payment.swap.begin",
4
"data": {
5
"alg": "sha-512",
6
"amount": 1000,
7
"color": "EON-C-A7CJA-F3PUZ-DKVSK",
8
"hash": "vSsar3708Jvp9Szi2NWZZ02Bqp1qRCFpbcTZPdBhnWgs5WtNZKnvCXdhztmeD2cmW192CF5bDufKRpayrW/isg==",
9
"id": "SWAP-PHQDB-ZCK74-VTKZS",
10
"sender": "EON-HRAEQ-8NZL7-C9LHJ",
11
"target": "EON-UBYUQ-GXFZ8-8XPTP",
12
"timestamp": 1593005737
13
}
14
}
Copied!

color.payment.swap.commit - CommitSwap - Completing the swap

  • id - swap identifier.
  • secret - secret phrase.
  • 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.
  • "The number has reached the limit" - too many colored coins on the balance.
Example:
1
{
2
...
3
"type": "color.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!

color.payment.swap.rollback - RollbackSwap - Swap rollback

  • id - swap identifier.
  • sender - secret phrase.
The command does not require a signature.
Possible errors:
  • "Unknown swap" - unknown swap.
  • "Swap is active" - swap is active
  • "The number has reached the limit" - too many colored coins on the balance.
Example:
1
{
2
...
3
"type": "color.payment.swap.rollback",
4
"data": {
5
"id": "SWAP-PHQDB-ZCK74-VTKZS",
6
"sender": "EON-HRAEQ-8NZL7-C9LHJ"
7
}
8
}
Copied!

color.payment.swap.cancel - CancelSwap - Swap cancellation by mutual concent

  • id - swap identifier.
  • sender - swap 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.
  • "The number has reached the limit" - too many colored coins on the balance.
Example:
1
{
2
...
3
"type": "color.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!

Colored coin management

color.coin.mode.auto.set - Transferring colored coin into auto-emission.

  • sender : String - EON-ID of the account.
The command is signed by the account specified in sender.
Possible errors:
  • "The colored coin has not been associated with the account" - colored coins not issued.
  • "EmitMode has already set" - auto-emission mode is already enabled.
Example:
1
{
2
...
3
"type": "color.coin.mode.auto.set",
4
"data": {
5
"sender": "EON-A7CJA-F3PUZ-DKVSK"
6
}
7
}
Copied!

color.coin.mode.fixed.set - Transferring colored coin into a fixed emission.

  • sender : String - EON-ID of the account.
  • value : long - total emission size.
The command is signed by the account specified in sender.
Possible errors:
  • "Invalid value" - emission is set incorrectly.
  • "The colored coin has not been associated with the account" - colored coins not issued.
  • "Value has already set" - desired emission is already set.
  • "An insufficient number of colored coins is on the balance" - not enough colored coins on the balance to reduce the emission by a given amount.
  • "The number has reached the limit" - too many colored coins on the balance.
Example:
1
{
2
...
3
"type": "color.coin.mode.fixed.set",
4
"data": {
5
"sender": "EON-A7CJA-F3PUZ-DKVSK",
6
"amount": 20000000
7
}
8
}
Copied!

color.coin.del - Deleting a colored coin

  • sender : String - EON-ID of the account.
The command is signed by the account specified in sender.
Possible errors:
  • "The colored coin has not been associated with the account" - colored coins not issued.
  • "The entire amount of funds must be on the balance" - not all issued colored coins returned to the original account.
Example:
1
{
2
...
3
"type": "color.coin.del",
4
"data": {
5
"sender": "EON-A7CJA-F3PUZ-DKVSK"
6
}
7
}
Copied!
Last modified 10mo ago