Command and transaction structure

Structurally, a transaction is divided into 2 elements: command and transaction.

  • Command - a specific operation in the network. It is specified by the type of operation and a set of fields necessary for the operation. For example, registration, transfer, etc.

  • Transaction - a container for several commands sent to the network. The transaction specifies the commission and its payer.

Command structure

  • version* : int - format version.

  • id* : String - command identifier is calculated from the command hash (according to the principles of EDS) and from the time of command creation. Hashing algorithm is defined by the version.

  • type* : String - type of operation.

  • publisher* : String - sender to the network.

  • timestamp* : long - command's creation time.

  • deadline* : long - command lifetime.

  • data* : Map<String, Long|String|Map<...>> - command data.

  • note : String - comment.

  • confirmations*: Map<String, String> - signatures (account ID - EDS in the Base64).

  • reference : String - dependence on another command in the transaction.

* - required fields.

Example:

{
    "data": {
        "alg": "ed25519",
        "id": "EON-27Z6X-N77SJ-B8GEM",
        "key": "9zUema0KRJFkx2mC4HjEZZ0xCH0MMAdGH34rXfz2p4o="
    },
    "deadline": 300,
    "id": "CMD-GC3KG-HB3LK-2ETBN",
    "network": "core.dev.Ti2YGY",
    "publisher": "EON-HRAEQ-8NZL7-C9LHJ",
    "timestamp": 1592296782,
    "type": "core.auth.pk.new",
    "version": 1
}

Transaction structure

  • version* : int - format version.

  • id* : String - transaction identifier is calculated from the command hash (according to the principles of EDS) and from the time of command creation. Hashing algorithm is defined by the version.

  • commands* : List<Command> - commands in the transaction.

  • publisher* : AccId - payer.

  • fee* : long - commission.

  • confirmations*: Map<String, String> - signatures (account ID - EDS in the Base64).

  • timestamp* : long - command's creation time.

  • deadline* : long - command lifetime.

  • tags : Map<String, String> - tags.

  • block : String - identifier of the block in which the transaction was validated (used only when requesting a transaction from peer).

* - required fields.

Example:

{
    "commands": [
        {
            "data": {
                "alg": "ed25519",
                "id": "EON-27Z6X-N77SJ-B8GEM",
                "key": "9zUema0KRJFkx2mC4HjEZZ0xCH0MMAdGH34rXfz2p4o="
            },
            "deadline": 300,
            "id": "CMD-GC3KG-HB3LK-2ETBN",
            "network": "core.dev.Ti2YGY",
            "publisher": "EON-HRAEQ-8NZL7-C9LHJ",
            "timestamp": 1592296782,
            "type": "core.auth.pk.new",
            "version": 1
        }
    ],
    "confirmations": {
        "EON-HRAEQ-8NZL7-C9LHJ": "HyZIa5n3fKxlUY6lnJVjYhAICGnIPi2czQnW7T+h/CDJORR5gJPfmYaIP22/yHCHWhfCkWV4aLZkc2k6XcePAg=="
    },
    "deadline": 300,
    "fee": 1000,
    "id": "TX-GC3KG-HFN93-GHF6R",
    "publisher": "EON-HRAEQ-8NZL7-C9LHJ",
    "timestamp": 1592296782,
    "version": 1
}

Basic rules of transaction operation

  • The transaction is signed by the sender specified in the publisher field.

  • A transaction is executed atomically. An error in the processing of any command in a transaction will cause the entire transaction to fail. No command will be accepted.

  • All commands in a transaction are executed sequentially.

  • The publisher field is included in the command so that only the correct account can release the transaction to the network.

  • The command has a reference field that allows control over how the commands are related. If this field is defined, the specified command must be included in the current transaction and placed before the current command in the transaction command list.

Last updated