Basic functionality

Sending an operation to the Tezos blockchain can be divided into a few steps that we will go through in this guide. Using a Tezos library can simplify the process but understanding the underlaying logic is really helpful.

    Operations

    Creating a new operation as a JSON object

    Fee schedule

    Fee settings The required fees per operation is determined by the following formula: fees >= minimal_fees + minimal_nanotez_per_byte * size + minimal_nanotez_per_gas_unit * gas The minimal fee variables can be set by each baker, but will default to the following values: minimal_fees = 0.0001 minimal_nanotez_per_byte = 1000 minimal_nanotez_per_gas_unit = 100 (1 tez = 106 mutez = 109 nanotez) Suggested values for standard operations Assuming most bakers will use the default fee settings and the blocks not beeing full, some default values can be used for standard operations.

    Forge & Parse

    Operation shell Before the operations can be forged into its binary repressentation and signed, we must encapsulate the operations inside a shell that contains the operations and a branch. { "branch": $hash, "contents": $operations } The branch value should be the hash of the most recent block. If a branch is older than 50 blocks (minutes) the operations will be rejected by the nodes. This is mainly of interest to have in mind when dealing with offline/remote signing or a growing mempool.

    Sign & Inject

    Signing Before signing the operation bytes a watermark prefix must be appended. For regular operations used in a wallet this prefix will be 0x03. Operations associated to baking will have a different prefix. After the watermark have been added, the bytes will need to be hashed into a 32-byte generic hash. Then the hash can be signed with the private key from the signature scheme chosen. Example of operation bytes to sign with a watermark attached: