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.

{
    ...
    "type": "color.coin.new",
    "data": {
        "sender": "EON-A7CJA-F3PUZ-DKVSK",
        "decimal": 2
    }
}

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:

{
    ...
    "type": "color.payment.send",
    "data": {
        "sender": "EON-A7CJA-F3PUZ-DKVSK",
        "target": "EON-A7CJA-F3PUZ-DKVSK",
        "amount": 2000,
        "color": "EON-C-A7CJA-F3PUZ-DKVSK"
    }
}

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:

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

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:

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

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:

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

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:

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

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:

{
    ...
    "type": "color.coin.mode.auto.set",
    "data": {
        "sender": "EON-A7CJA-F3PUZ-DKVSK"
    }
}

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:

{
    ...
    "type": "color.coin.mode.fixed.set",
    "data": {
        "sender": "EON-A7CJA-F3PUZ-DKVSK",
        "amount": 20000000
    }
}

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:

{
    ...
    "type": "color.coin.del",
    "data": {
        "sender": "EON-A7CJA-F3PUZ-DKVSK"
    }
}

Last updated