Published 15 February 2019

TransactionFlowResult TransactionFlow(1:Transaction transaction)


Not for monitor. Transmit transaction to network for approval


The address field is recoded: if the address string length is 64 characters, then recode it from 16 coded representation to a new string, otherwise - calculate the public key hash using blake2 algorithm.
We define the transaction object with the field values from the input transaction.

If the address of the smart contract is defined in transaction, then: Update the cashes of the smart contract: Get the hash of the last block.

We set the current hash variable equal to the last block hash. As long as the current hash variable is not equal to the hash value of the last block viewed by the smart contract: Load the block with the current hash into the pool. For all transactions, we extract a smart contract. We fill class structures from the smart contract. If the current transaction is deploying a smart contract, then we save the transaction identifier, the sender, the recipient in the cache, otherwise we save the address and the smart contract identifier.

Move the current hash variable to the previous block. Set the hash value of the last block scanned by the smart contract to the hash of the last block. We extract the smart contract with transaction from the cache of turned sender transactions. We extract the smart contract with transaction from the cache of executable sender transaction.

If we need to deploy a smart contract, then we extract from the smart contract its byte code, source code, recipient address, state hash, method and parameters; otherwise, we shut down the function with the FAILURE status.

If a smart contract is defined, then we add the serialized structure of the deployed smart contract to the structure of the processed transaction.

We send transaction for processing.

If the smart contract is not defined, then we finish the function with the status SUCCESS. Open the transport protocol for connections. We execute the byte code of the smart contract using the “executor” object.

In the structure of the processed transaction, we add a new smart contract with the status of the smart contract executed in the previous step, its method, parameters, address, and send the transaction for processing.

Finish the function with the status SUCCESS.



struct Transaction


   // Inner transaction ID for protection against replay attack

   1: TransactionInnerId id

   // Giver if no smart contract invokation is present, otherwise deployer.

   // Generally, public key against of which signature is validated

   2: Address source

   // Smart contract address if one's invokation is present, otherwise acceptor's address

   3: Address target

   // Transfer amount for payment transaction

   4: Amount amount

   // Wallet's view on it's balance

   5: Amount balance

   6: Currency currency

   // Signature is formed against node's custom binary serialization format,

   // see other docs for description

   7: binary signature

   8: optional SmartContractInvocation smartContract

   // Max fee acceptable for donor to be subtracted

   9: AmountCommission fee

   10: Time timeCreation

   // user fields

   11: optional binary userFields

   12: TransactionType type

   13: optional SmartTransInfo smartInfo




struct TransactionFlowResult


   1: general.APIResponse status

   2: optional general.Variant smart_contract_result //general.Variant

   3: i32 roundNum


Description of the returned structures and typedefs

Description of the returned structures and typedefs

struct APIResponse


// 0 for success, 1 for failure, 2 for not being implemented (currently unused)

   1: i8 code

// Explanation

   2: string message


union Variant {

1: i8 v_null;

2: bool v_boolean;

3: bool v_boolean_box;

4: i8 v_byte;

5: i8 v_byte_box;

6: i16 v_short;

7: i16 v_short_box;

8: i32 v_int;

9: i32 v_int_box;

10: i64 v_long;

11: i64 v_long_box;

12: double v_float;

13: double v_float_box;

14: double v_double;

15: double v_double_box;

16: string v_string;

17: list<Variant> v_list;

18: set<Variant> v_set;

19: map<Variant, Variant> v_map;

20: list<Variant> v_array;


Votes 0, average rating 0