Software Developer Guide: “IZZZIO Blockchain Platform Version 1.2.0”

This is a translation of the Russian original. If the versions differ, the Russian version prevails.

Contents

    1. Introduction

    This document contains information for technical specialists and is a guide to developing projects based on the IZZZIO blockchain platform version 1.2.0.

    The IZZZIO blockchain platform version 1.2.0 (hereinafter, the IZZZIO blockchain platform, the IZZZIO Platform, the System, the Software) is a software suite designed for storing, transmitting and processing any data, as well as for automating business processes by applying distributed ledger technology.

    The IZZZIO blockchain platform is a universal blockchain platform for any task. The platform is built on the idea of creating a blockchain ecosystem that is as close as possible to the needs of business and that makes it easier to integrate and use blockchain technology in companies’ business processes.

    The platform’s source code is open and available under the Apache-2.0 license. Using parts of the platform code, or all of it, in any project requires publishing the source code of such projects by any available means.

    The core of the IZZZIO blockchain platform is a system of smart contracts that run in a special execution environment, EcmaContracts, which uses the V8 JavaScript engine to create a virtualized environment for executing contract code. This makes it possible to fully isolate arbitrary contract code both from the system and from other contracts, and to control the availability of resources (RAM, CPU time, call limits) for each virtual machine instance.

    EcmaContracts implements the principle of managing the state of contract instances, under which only information about smart contract method calls and their arguments is saved to the blockchain. The results of smart contract execution are stored locally on the user’s node and are loaded on the next contract call. All nodes in the network simultaneously replay every transaction of the chain, from the very first block to the last existing one, which results in full synchronization of contract states on each node.

    The IZZZIO blockchain platform is a one-dimensional blockchain built on the principle of 1 transaction – 1 block. By default, the network has no special block generators; a block is generated on the node that needs to add the block to the network. This behaviour can also be configured.

    Technical summary of the IZZZIO blockchain platform:

    ParameterValue
    Block confirmation methodBuilt in: In-house development based on a hybrid PoW + PoA method – Limited Confidence Proof of Activity with time-bound confirmation
    DLCPoA – Dynamic Limited Confidence Proof of Activity
    Proof-of-Authority – a confirmation algorithm that uses a pre-issued list of keys
    Any other method can be connected through the plugin system
    Software platformNode.js > 8
    HashingFiltered SHA256 / GOST R 34.11-2012 / any type provided by a plugin
    Digital signaturesECDSA-SHA-256 / GOST R 34.10-2012 / any type provided by a plugin
    Cryptographic providerBuilt-in / VipNet CSP 4.2 / provided by a plugin
    Main block chain structureJSON blocks with arbitrary content
    DatabaseLevelDB, Sqlite3, Memory
    Smart contractsECMAScript 6 (JS ES6), Turing-complete, with extended functionality, WASM, support for other languages via plugins
    P2P network interfaceWebSocket Based
    APIREST / PHP Class / REPL

    2. Configuration of the IZZZIO blockchain platform version 1.2.0

    The platform offers users a large number of configurable options.

    Nodes are configured by creating a config.json file in the directory from which the IZZZIO node is launched, or by explicitly specifying the path to the configuration file with the --config launch parameter. The configuration file is in JSON format.

    Possible configuration file parameters in the System:

    ParameterDescription
    p2pPort: 6013,P2P port
    httpServer: 'localhost',Bind address for the RPC/API and the interface
    rpcPassword: '',Password for connecting to the RPC/API and the interface (HTTP Basic Auth)
    initialPeers: []Array listing the initial nodes
    allowMultipleConnectionsFromIp: true,Allow multiple P2P connections from one address. Recommended values: False if the network has many loops, True if a proxy is used for connecting
    maxPeers: 80,Maximum number of P2P connections
    upnp: {
      enabled: true,
      token: 'iz3node'
    }
    Configuration of automatic node discovery via DNS request
    Enable automatic discovery of nodes in the network
    Token by which the node will look for other nodes
    networkPassword: '',Network access “password”. Used to create private networks
    blockAcceptCount: 20,Number of blocks confirming a transaction (LC)
    hearbeatInterval: 10000,The node’s internal timer. Affects the speed of connection retries, saving states to disk, etc.
    peerExchangeInterval: 5000,Frequency of peer list exchange
    maxBlockSend: 600,Maximum number of blocks sent. Must be greater than blockQualityCheck (LC)
    blockQualityCheck: 100,Number of “extra” blocks requested to check the validity of the chain (LC)
    limitedConfidenceBlockZone: 288,“Confidence” zone (LC). The chain before this zone cannot be changed. Must be greater than blockQualityCheck
    generateEmptyBlockDelay: 300 * 1000,Frequency of creating empty blocks when the network is idle. false to disable
    blockHashFilter: {
      blockEndls: []
    }
    Filter of valid blocks for LCPoA
    4 characters at the end of a block. The hash matching the Genesis Block must be included here
    genesisTiemstamp: 1492004951 * 1000,Timestamp of block 0 of the network, in milliseconds
    lcpoaVariantTime: 1,Number of milliseconds required to generate one block hash (LCPoA)
    validators: []Additional consensus plugins. IMPORTANT: Blocks are passed to consensus plugins in the same order in which they are listed in this parameter.
    emptyBlockInterval: 10000,Interval for checking whether an empty block needs to be issued
    maxTransactionAtempts: 5,How many attempts to add a block are made before deciding to cancel adding the block to the network
    checkExternalConnectionData: false,Check external data for consistency (with the configuration of other nodes)
    enableMessaging: false,Allow the use of the message bus (required for some consensuses)
    recieverAddress: '123',Intra-network address of the network node. Used in the message bus and in the StarWave protocol
    messagingMaxTTL: 3,Maximum limit of message hops
    maximumInputSize: 2 * 1024 * 1024,Maximum volume of processed data from external nodes. Recommended to be no more than 15 MB
    allowMultipleSocketsOnBus: false,Allow connection of sockets with different addresses to one node address
    walletFile: './wallet.json',Wallet file address
    workDir: '.',Working directory
    blocksDB: 'blocks',How to store the block DB: false to store in RAM, mem://blocks.json to store in RAM and write to permanent storage on unload. A string to store on disk
    blocksSavingInterval: 300000,Block saving interval. false to disable autosave, or a number of milliseconds
    appEntry: false,Entry point to the DApp “application”. False if not required
    startMessage: false,Message displayed when the node starts
    ecmaContract: {
    enabled: true,
    allowDebugMessages: false,
    contractInstanceCacheLifetime: 10000,
    }
    EcmaContracts smart contract configuration
    The contract processing system is enabled
    Allows smart contracts to output messages (used for debugging)
    Lifetime of a contract virtual machine instance
    masterContract: 5The main contract in the system. Must support resource management methods
    hashFunction: 'SHA256',Function used to compute the hash. Registered by plugins
    signFunction: '',Function for computing digital signatures and generating passwords (empty by default), options: 'GOST' 'GOST256' 'NEWRSA'
    keyLength: 2048,Key length (passed to some plugins)
    plugins: []Array listing the plugins to load (except consensus plugins)

    3. Smart contract language

    The IZZZIO smart contract execution system allows contracts to be written in JavaScript ES6. Smart contracts are Turing-complete and offer a wide range of capabilities. Most standard methods and classes are available during development.

    • The Math.random() method has been replaced. Support for state saving has been added.
    • The methods of the Date class have been replaced to support state saving.

    When writing contracts, several principles must be followed to ensure secure and correct code execution:

    1. Code must be written in a synchronous style. Asynchrony is not supported.

    2. The names of all private methods and properties must begin with the “_” character to prevent unauthorized access to them

    3. Do not use the standard class constructor. To initialize the class, use the init method, and deploy to handle the first launch of the contract

    4. To save data between launches, use the persistent objects KeyValue (see clause 4.1.1.1), TypedKeyValue (see clause 4.1.1.2), BlockchainArray (see clause 4.1.1.4), BlockchainMap (see clause 4.1.1.6).

    Recommendations for writing secure smart contracts:

    These recommendations help avoid most errors in designing and writing a contract. A launched contract cannot subsequently be modified or updated!

    1. To implement a token, use the TokenRegister data type (see clause 4.1.1.6) or inherit the contract from TokenContract (see clause 4.1.3.2.)

    2. To work with numbers where calculation accuracy matters, use the BigNumber class (see clause 4.2.1).

    3. Every contract must inherit from the Contract class (see clause 4.1.3.1), which implements the basic protection and data processing systems for contracts

    4. Check the types of all input data, and always cast data to the required type

    5. Check the contract execution environment using assert (see clause 4.1.5.1) and other exception methods

    6. Important data, such as the contract owner’s address, should be defined in advance in a constant before the contract class

    7. Remember that data written to the blockchain is public and accessible to everyone.

    Optimization tips:

    1. Minimize reading and writing of data in the persistent objects KeyValue (see clause 4.1.1.1), TypedKeyValue (see clause 4.1.1.2), BlockchainArray (see clause 4.1.1.4), BlockchainMap (see clause 4.1.1.6)

    2. Minimize or avoid loops that iterate over an undefined or very large number of parameters

    3.1. The simplest token

    The IZZZIO blockchain uses its own standard for describing token contracts, similar to the ERC20 standard of the Ethereum blockchain, but with some differences. The IZ3 Token (IZ3T) standard requires the contract to have certain methods and properties. Most of these methods are already implemented in the built-in TokenContract class (see clause 4.1.3.2.), from which it is recommended to inherit any token contract.

    An example of the simplest token that complies with the IZ3T standard and the security recommendations:

    //Defining the emission size
    const EMISSION = 10000;
    //Defining the contract owner's address
    const CONTRACT_OWNER = 'SOME_ADDR';
    class TestToken extends TokenContract{
        //Token initialization. Note that init is used as the constructor
        init() {
            super.init(EMISSION);
        }
        //Contract data property
        get contract() {
            return {
                name: 'Token name',
                ticker: 'TokenTicker',
                owner: CONTRACT_OWNER,
                emission: EMISSION,
                type: 'token',
            };
        }
    }
    //Handing the contract class over to the virtual machine
    global.registerContract(TestToken);

    The contract inherits the standard’s basic methods from the TokenContract class. When the contract is launched, the tokens will be emitted to the CONTRACT_OWNER address. The quantity and movement of tokens are recorded inside the TokenRegister declared in TokenContract

    3.2. Launching a contract

    3.2.1. Launching with a DApp

    One way to launch a contract on the network is to launch it through a DApp (see clause 6) of the IZZZIO platform SDK.

    DApp application code for launching a contract:

    const CONTRACT_CODE = ''; //Variable containing the contract code
    const RESOURCES = 1; //Number of tokens allocated for resource rent
    //IZZZIO DApp SDK module
    const DApp = require(global.PATH.mainDir + '/app/DApp');
    class App extends DApp {
        init() {
            that = this;
            that.contracts.ecmaContract.deployContract(CONTRACT_CODE, RESOURCES, function (deployedContract) {
                console.log('Contract deployed at address', deployedContract.address);
            });
        };
    }

    To launch the DApp, add the appEntry parameter to config.json and specify the path to the application entry point. For example, “appEntry”: “./BigNet/startNetwork.js”, from the BigNet/configStart.json file in the repository.

    After the DApp is launched, the contract will be launched on the network and its address will be displayed on the screen.

    3.2.2. Launching with the API

    To launch a contract using the API, the following method is used

    contracts/ecma/deployContract

    POST

    • resourceRent – Number. Number of tokens allocated for resource rent
    • source – String. Source JavaScript code of the smart contract

    See also: Block (clause 7.4).

    3.3. Interacting with a contract

    3.3.1. Interaction from a DApp

    For interaction within the IZZZIO network, it is recommended to use the ecmaContracts methods from the DApp SDK.

    For example, to get the total number of existing tokens of a token contract, you can use the method:

    let supply = await that.contracts.ecmaPromise.callMethodRollback(CONTRACT_ADDRESS, 'totalSupply', [], {});

    Calling this method runs the totalSupply method of the contract. After execution completes, the contract state is rolled back to the state before the launch, and the value returned by the totalSupply method is returned, i.e. the total number of existing tokens.

    For interacting with some standard contract formats, there are built-in wrapper classes that make it easier to call methods and get properties. For example, for IZ3 Token the wrapper class is DApp-TokenContractConnector (see clause 6.4.2). It can be used as follows:

    let token = new TokenContractConnector(that.ecmaContract, CONTRACT_ADDRESS);
    //Equivalent of the example above
    let supply = await token.totalSupply();
    //Executing a transaction for 10 tokens
    await token.transfer(SOME_ADDRESS,'10');

    You can read more about DApp-TokenContractConnector in the corresponding section.

    3.3.2. Launching with the API

    To interact with a contract using the API, the following methods are used:

    • GET contracts/ecma/getContractInfo/:contractAddress:
    • GET contracts/ecma/getContractProperty/:contractAddress:/:property:
    • POST contracts/ecma/callMethod/:contractAddress:/:method:
    • POST contracts/ecma/deployMethod/:contractAddress:/:method:

    Example of a totalSupply request to a contract:

    POST

    contracts/ecma/callMethod/1/totalSupply

    • argsEncoded = ‘{}’ – String. Serialized value with the list of call arguments

    When this call is made, the following will be performed:

    1. Launch of the smart contract

    2. Call of the totalSupply method

    3. Stop of the contract

    4. Rollback of the changes made during execution

    5. Sending of the result in response to the API method request

    For a detailed description of the API, see the API section (clause 4.3).

    4. EcmaContracts

    EcmaContracts implements the environment for managing and executing smart contracts. EcmaContracts controls the state, running virtual machine instances and resource consumption, and provides contract execution environments with the methods and objects they need to work. Interaction with these objects makes powerful and functional decentralized systems possible.

    Available objects

    • Storage objects
    • Events
    • Contract objects
    • Connectors
    • System classes

    Other available objects

    • BigNumber
    • Date
    • Math

    API

    4.1. Available objects

    4.1.1. Storage objects

    Objects that carry over and save state between smart contract method calls. They are needed to save any information (the state of user accounts, balances and so on)

    4.1.1.1. KeyValue

    The only truly persistent object inside the virtual machine. Other persistent objects depend on the KeyValue object and are essentially wrappers built on it. KeyValue is an object that implements a key-value store. The maximum number of records is unlimited. The maximum length of a key and of a record is 512 KB.

    new KeyValue (storage name)

    Arguments:

    • storage name (string) – Name of the storage for loading and writing data

    get (key)

    Arguments:

    • key (string) – Key by which the value will be searched for in the storage

    Result:
    The value. If not found, false

    put (key, value)

    Arguments:

    • key (string) – Key under which the record will be written to the storage
    • value (string) – String to write to the storage

    Example of initialization and use of the methods:

    class Test extends Contract {
        init(){
            super.init();
            //Creating/loading the storage
            this._db = new KeyValue('name');
        }
        putKeyValue(){
            this._db.put('key','value');
        }
        getKeyValue(){
            console.log(this._db.get('key')); //Outputs "value"
        }
    }

    4.1.1.2. TypedKeyValue

    An analogue of KeyValue (clause 4.1.1.1) that preserves the types of values, provided they can be serialized.

    new TypedKeyValue (storage name)

    Arguments:

    • storage name (string) – Name of the storage for loading and writing data

    get (key)

    Arguments:

    • key (string) – Key by which the value will be searched for in the storage

    Result:
    The value. If not found, false

    put (key, value)

    Arguments:

    • key (string) – Key under which the record will be written to the storage
    • value (*) – String to write to the storage

    Example of initialization and use of the methods:

    class Test extends Contract {
        init(){
            super.init();
            //Creating/loading the storage
            this._db = new KeyValue('name');
        }
        putKeyValue(){
            this._db.put('number',1337);
            this._db.put('string',"Hello");
        }
        getKeyValue(){
            console.log(typeof this._db.get('number')); //Outputs "number"
            console.log(typeof this._db.get('string')); //Outputs "string"
        }
    }

    4.1.1.3. BlockchainArraySafe

    An array-like structure based on KeyValue (clause 4.1.1.1). It does not contain methods that may lead to RAM overflow (join(), slice(), splice() and others).

    new BlockchainArraySafe (storage name)

    Arguments:

    • storage name (string) – Name of the storage for loading and writing data
    class Test extends Contract {
        init(){
            super.init();
            //Creating/loading the storage
            this._db = new BlockchainArraySafe('name');
        }
        doSomething(){
            this._db[0]=1;
        }
        doSomethingNext(){
            this._db[0]++;
        }
        test(){
            this.doSomething();
            this.doSomethingNext();
            console.log(this._db[0]); //Outputs "2"
        }
    }

    4.1.1.4. BlockchainArray

    This object is an extension of BlockchainArraySafe (clause 4.1.1.3). It contains polyfills of methods that may lead to overflow of available memory. It is recommended for use only with small data arrays.

    new BlockchainArray (storage name)

    Arguments:

    • storage name (string) – Name of the storage for loading and writing data
    class Test extends Contract {
        init(){
            super.init();
            //Creating/loading the storage
            this._db = new BlockchainArraySafe('name');
        }
        doSomething(){
            this._db.push('Hello');
        }
        doSomethingNext(){
            this._db.push('world!');
        }
        test(){
            this.doSomething();
            this.doSomethingNext();
            console.log(this._db.join(' ')); //Outputs "Hello world!"
        }
    }

    4.1.2.0. BlockchainMap

    An object-like structure. Not serializable. Preserves the types of objects, provided they can be serialized.

    new BlockchainMap (storage name)

    Arguments:

    • storage name (string) – Name of the storage for loading and writing data
    class Test extends Contract {
        init(){
            super.init();
            //Creating/loading the storage
            this._db = new BlockchainMap('name');
            this._db['hello'] = 'Hello';
            this._db['world'] = 'world!';
            console.log(this._db['hello']+' '+this._db['world']); //Outputs "Hello world!"
        }
    }

    4.1.1.6. TokenRegister

    A class that implements secure token registry logic. It is the basis for TokenContract (clause 4.1.3.2) and most tokens in the system. It contains the main methods for managing wallet balances, transfers, support for minting and burning tokens, and accounting for the existing supply. Works with numbers of up to 256 digits.

    new TokenRegister (storage name)

    Arguments:

    • storage name (string) – Name of the storage for loading and writing data

    balanceOf (address)

    Arguments:

    • address (string) – Address whose balance is to be checked

    Returns BigNumber:
    Wallet balance

    totalSupply ()

    Returns BigNumber:
    Total volume of existing tokens

    setBalance (address, balance)

    Arguments:

    • address – Address for which the balance is set
    • balance – Balance to be set

    withdraw (address, amount)

    Arguments:

    • address – Address from which tokens are debited
    • amount – Amount debited

    minus (address, amount)

    Arguments:

    • address – Address from which tokens are debited
    • amount – Amount debited

    deposit (address, amount)

    Arguments:

    • address – Address to which tokens are credited
    • amount – Amount credited

    plus (address, amount)

    Arguments:

    • address – Address to which tokens are credited
    • amount – Amount credited

    transfer (sender address, recipient address, amount)

    Arguments:

    • sender (address) – Address from which tokens are debited
    • recipient (address) – Address to which tokens are credited
    • amount – Transfer amount

    burn (address, amount)

    Arguments:

    • address – Address whose tokens are burned
    • amount – Amount burned

    mint (address, amount)

    Arguments:

    • address – Address for which tokens are issued
    • amount – Amount issued
    class Test extends Contract {
        init(){
            super.init();
            this._wallets = new TokensRegister('TKN');
            this._wallets.mint('ME',1000);
            console.log(this._wallets.balanceOf('ME').toFixed()); //1000
            this._wallets.transfer('ME','FRIEND',100);
            console.log(this._wallets.balanceOf('ME').toFixed()); //900
            console.log(this._wallets.balanceOf('FRIEND').toFixed()); //100
        }
    }

    4.1.2. Events

    Generated events are used to build the contract’s event index. For example, the event database makes it possible to quickly find out the token balance of a given wallet at the moment a given block appeared.

    4.1.2.1. Events

    Events is a global object that makes it possible to create (emit) a smart contract event. The emit method emits an event. Attention: We do not recommend using the Events object directly. Use the Event object to create an event instance and emit it.

    emit (event, arguments)

    Arguments:

    • event (string) – Event name
    • arguments (array) – Up to 10 event arguments

    4.1.2.2. Event

    A wrapper class that provides safe and convenient use of the Events object (clause 4.1.2.1). Event checks the types of incoming parameters and correctly converts data to the proper format.

    new Event (event, array of argument types)

    Arguments:

    • event (string) – Event name
    • array of argument types (array) – Up to 10 event argument types (“number”,“string”,“array”,“object”)

    emit (arguments)

    Arguments:

    • arguments (array) – Up to 10 event arguments matching the previously specified types
    class Test extends Contract {
        init(){
            super.init();
            this._helloEvent = new Event('Hello',['string']);
            this._helloEvent.emit('Hello world!');
        }
    }

    Event can accept no more than 10 parameters as input arguments.

    4.1.3. Contract objects

    4.1.3.1. Contract

    An object that all platform contracts are recommended to inherit from. The Contract object implements:

    1. Basic access control functionality.

    2. Detection of the launch (deploy) state.

    3. Receipt and confirmation of payment.

    4. Interaction with the inter-contract settlement system

    5. External application interface

    The internal init method initializes the contract’s internal functionality, including detection of the launch (deploy) state.

    super.init()

    Called once in the life of a smart contract; makes it possible to detect the moment of launch (deploy)

    deploy()

    Makes it possible to get payment information (see Pay Object, clause 7.2):

    payProcess()

    Returns object: Object with payment information

    Check that the caller is the contract owner:

    assertOwnership([msg])

    Arguments:

    • msg (string) – Message in case the check fails

    Check that the caller is the master contract:

    assertMaster([msg])

    Arguments:

    • msg (string) – Message in case the check fails

    Check that the method was called externally (i.e. not from another contract):

    assertExternal([msg])

    Arguments:

    • msg (string) – Message in case the check fails

    Check that the method was called with payment information passed:

    assertPayment([msg])

    Arguments:

    • msg (string) – Message in case the check fails

    Adding an info method for the external application:

    _registerAppInfoMethod(method name, argument types)

    Arguments:

    • method name (string) – Name of the method
    • argument types (array) – Types of values accepted by the method

    Adding an executive method for the external application:

    _registerAppDeployMethod(method name, argument types)

    Arguments:

    • method name (string) – Name of the method
    • argument types (array) – Types of values accepted by the method

    Adding the application source code:

    _registerApp(source code[, type = "web"])

    Arguments:

    • source code (string) – Source code of the external application or information for finding it
    • type (array) – Type of the external application

    Getting the external application data:

    getAppData()

    Returns string: Serialized object of the external application

    Registering a callback for inter-contract purchases:

    _registerC2CResultCallback(seller contract address, callback function)

    Arguments:

    • seller contract (address) – Address of the seller contract with which the order was placed
    • callback (function) – Function that will be called when the order arrives function(result object, order number, seller address)

    4.1.3.2. TokenContract

    An object that all token contracts are recommended to inherit from. It implements the contract interface of the IZ3 Token standard (see clause 7.1).

    The _wallets property is an instance of the TokenRegister object (clause 4.1.1.6).

    The _TransferEvent property is an instance of the Event object (clause 4.1.2.2).

    The _MintEvent property is an instance of the Event object.

    The _BurnEvent property is an instance of the Event object.

    super.init(initialEmission[ , mintable = false])

    Arguments:

    • initialEmission – Initial token emission
    • mintable (boolean) – Whether minting is allowed in the future

    _getSender()

    Result: Address of the call sender

    balanceOf(address)

    Arguments:

    • address (string) – Address of the token holder

    Returns string:
    Token balance

    totalSupply()

    Returns string:
    Total number of tokens issued

    transfer(to, amount)

    Arguments:

    • to (string) – Token recipient
    • amount (string) – Number of tokens

    burn(amount)

    Arguments:

    • amount (string) – Number of tokens to burn

    mint(amount)

    Arguments:

    • amount (string) – Number of tokens to issue

    getActionFee(action, args)

    Arguments:

    • action (string) – Action
    • args (array) – Arguments

    Returns string:
    Cost of the action

    getTransferFee(amount)

    Arguments:

    • amount (string) – Transfer amount

    Returns string:
    Cost of the transfer

    4.1.4. Connectors

    EcmaContracts connectors are wrapper classes that provide a simplified interface for interacting with external contracts of certain types.

    4.1.4.1. ContractConnector

    Base class for connectors. Makes it possible to register methods and their aliases.

    4.1.4.2. TokenContractConnector

    A connector class that implements interaction with a token contract from another contract

    new TokenContractConnector(address)

    Arguments:

    • address (string) – Address of the contract being connected to

    balanceOf(address)

    Arguments:

    • address (string) – Address of the token holder

    Returns string:
    Token balance

    totalSupply()

    Returns string: Total number of tokens issued

    transfer(to, amount)

    Arguments:

    • to (string) – Token recipient
    • amount (string) – Number of tokens

    burn(amount)

    Arguments:

    • amount (string) – Number of tokens to burn

    mint(amount)

    Arguments:

    • amount (string) – Number of tokens to issue
    class Test extends Contract {
        init(){
            super.init();
            let tokenContract = new TokenContractConnector(1);
            console.log(tokenContract.balanceOf('INVALID_ADDR')); //Outputs 0
        }
    }

    4.1.4.3. SellerContractConnector

    SellerContractConnector is a connector class that implements interaction with a seller contract. Seller contracts are contracts that sell data or a service within the network.

    getPrice(args)

    Arguments:

    • args (array) – Order arguments

    Result:
    Order price

    buy(args)

    Arguments:

    • args (array) – Order arguments

    Result:
    Order id

    getResult(orderId)

    Arguments:

    • orderId (string) – Order id

    Result:
    Object containing the order

    4.1.4.4. Require

    Require is not one of the standard connectors, but it implements similar functionality. Require makes it possible to create an instance of an external contract class with arbitrary methods and properties. The presence of methods and properties in the external class is checked at code execution time.

    new Require(externalContract)

    Arguments:

    • externalContract (string) – Address of the contract being connected
    class Test extends Contract {
        init(){
            super.init();
            let tokenContract = new Require(1);
            console.log(tokenContract.balanceOf('INVALID_ADDR')); //Outputs 0
            console.log(tokenContract.invalidMethod('INVALID_ADDR')); //Throws an exception
        }
    }

    Alternative syntax with a factory method:

    require(externalContract)

    Arguments:

    • externalContract (string) – Address of the contract being connected

    4.1.5. System classes

    4.1.5.1. assert

    Provides functionality for checking conditions. Failure to meet these conditions results in an exception being thrown and the contract call ending with an error. The contract state is rolled back to the state before the call.

    The following methods are provided for checking conditions:

    1. Simple truth check

    assert(condition[ , message])

    Arguments:

    • condition – condition, true
    • message (string) – message

    2. Check that the value is not of type undefined

    defined(condition[ , message])

    Arguments:

    • condition – simple condition using conditional operators
    • message (string) – message if the condition is false

    3. Checks that the condition a > b holds

    gt(a, b[, message])

    Arguments:

    • a – numeric parameter
    • b – numeric parameter
    • message (string) – message if the condition is false

    4. Checks that the condition a < b holds

    lt(a, b[ , message])

    Arguments:

    • a – numeric parameter
    • b – numeric parameter
    • message (string) – message if the condition is false

    5. Checks that the condition is true. Alias of assert.assert

    true(condition[ , message])

    Arguments:

    • condition – condition
    • message (string) – message if the condition is false

    6. Check that the condition is false (similar to “It is not true that…”)

    false(condition[ , message])

    Arguments:

    • condition – condition; condition
    • message (string) – message if the condition is false
    class Test extends Contract {
        init(){
            super.init();
            assert.gt(100,200,'100 не может быть больше 200');
        }
    }

    4.1.5.2. contracts

    Provides functionality for managing the current contract or interacting with external contracts.

    The following methods are available:

    Calling a method of another contract with the changed state saved.

    callMethodDeploy(contractAddress, method[ , arguments])

    Arguments:

    • contractAddress (string) – address of the called contract.
    • method (string) – method of the called contract.
    • arguments (array) – arguments passed to the method, as an array.

    Throws an exception:

    • Error1 – “You can’t call method from himself” – call from inside.
    • Error2 – “External call failed” – error when calling the method.

    Result:

    • result of the method call.

    Calling a method of another contract, executed after the current call completes:

    callDelayedMethodDeploy(contractAddress, method[ , arguments])

    Arguments:

    • contractAddress (string) – address of the called contract.
    • method (string) – method of the called contract.
    • arguments (array) – arguments passed to the method, as an array.

    Throws an exception:

    • Error1 – “You can’t call method from himself” – call from inside.

    Requesting a property of another contract:

    getContractProperty(contractAddress, property)

    Arguments:

    • contractAddress (string) – address of the called contract.
    • property (string) – contract property

    Throws an exception:

    • Error1 – “You can’t call method from himself” – call from inside.

    Result:

    • Property value

    getMasterContractAddress()

    Result:

    • Address of the master contract defined in the configuration

    caller()

    Result:

    • address of the calling contract; false if the call is external

    callingIndex()

    Result:

    • number of the current contract call in the call chain, or 0 if the call is external

    isChild()

    Result::

    • true if the contract was called by another contract, otherwise false

    isDeploy()

    Result:

    • true if the contract is in the launch (deploy) state, otherwise false

    isDelayedCall()

    Result:

    • true if the call was made using callDelayedMethodDeploy

    getExtendedState()

    Result:

    • Extended state object

    4.1.5.3. crypto

    Methods for working with cryptography

    hash(data)

    Arguments:

    • data (string) – Data to hash

    Result:

    • String representation of the hash sum

    Verifying a digital signature with the configured function:

    verifySign(data, sign, publicKey)

    Arguments:

    • data (string) – Data to verify
    • sign (string) – Signature of the data
    • publicKey (string) – Public key

    Returns boolean:

    • true if verification is successful

    4.1.5.4. global

    Other global methods.

    Handing the contract class over to the virtual machine:

    registerContract(contract)

    Arguments:

    • data (string) – Data to verify
    • sign (string) – Signature of the data
    • publicKey (string) – Public key

    Returns boolean:

    • true if verification is successful

    Displaying data on the screen (provided output is enabled)

    console.log(data)

    Arguments:

    • data (string) – Data to verify

    getState()

    Returns object:

    • The current state object. Recommended for use instead of global.state

    4.2. Other available objects

    4.2.1. BigNumber

    An object that makes it possible to perform arithmetic operations on large numbers safely. Recommended for any calculations related to user balances and requiring precision.

    A description of BigNumber is available at: https://github.com/MikeMcl/bignumber.js/

    4.2.2. Date

    The built-in date object; however, the passage of time for the Date object is frozen and set according to the state passed in the call.

    4.2.3. Math

    A built-in object. It differs from the standard Math in its implementation of random: it uses an external seed set according to the state passed in the call.

    4.3. API

    To interact with a contract using the API, the following methods are used:

    • POST contracts/ecma/deployContract
    • GET contracts/ecma/getContractInfo/:contractAddress:
    • GET contracts/ecma/getContractProperty/:contractAddress:/:property:
    • POST contracts/ecma/callMethod/:contractAddress:/:method:
    • POST contracts/ecma/deployMethod/:contractAddress:/:method:
    • POST contracts/ecma/deploySignedMethod/:contractAddress:

    POST contracts/ecma/deployContract

    Launching a new contract on the network

    POST parameters:

    • resourceRent – Number (0 or more). Number of tokens allocated for resource rent
    • source – String. Source JavaScript code of the smart contract

    GET contracts/ecma/getContractInfo/:contractAddress

    Getting information about a contract

    GET parameters:

    • contractAddress – String. Contract address

    GET contracts/ecma/getContractProperty/:contractAddress:/:property

    Getting the value of a contract property

    GET parameters:

    • contractAddress – String. Contract address
    • property – String. Property name

    POST contracts/ecma/callMethod/:contractAddress:/:method:

    Calling a contract method, followed by rollback of the changes and return of the call result or an error

    GET parameters:

    • contractAddress – String. Contract address
    • method – String. Name of the called method

    POST parameters:

    • argsEncoded – String. JSON-serialized value with the list of call arguments

    POST contracts/ecma/deployMethod/:contractAddress:/:method:

    Calling a contract method, followed by writing the changes to the block chain. Returns the contents of the new block or an error.

    GET parameters:

    • contractAddress – String. Contract address
    • method – String. Name of the called method

    POST parameters:

    • argsEncoded – String. JSON-serialized value with the list of call arguments

    POST contracts/ecma/deploySignedMethod/:contractAddress:

    Calling a contract method, followed by writing the changes to the block chain. Unlike deployMethod, it accepts a signed EcmaContractCallBlock as input

    GET parameters:

    • contractAddress – String. Contract address

    POST parameters:

    • source – String. JSON-serialized object of the signed block

    6. DApp

    Decentralized applications in IZZZIO make it possible to create additional functionality for a node. Such applications have broad capabilities:

    1. Interaction with the block chain, preprocessing, reacting to chain changes

    2. Interaction with smart contracts, including launching new ones

    3. Interaction with other decentralized applications through built-in protocols. See StarWave (clause 6.7), StarWaveCrypto (clause 6.8)

    4. Integration of centralized applications with decentralized ones.

    To write decentralized applications in IZZZIO, the DApp class is used. The class provides all the methods needed to work with the network’s functionality and ensures compatibility of applications with different versions of IZZZIO blockchain nodes.

    6.1. The DApp class

    When creating a class that inherits from DApp, it is recommended not to declare a constructor and to use the built-in init method instead. To handle the termination state, the terminate(cb) method is used

    6.2. Global variables

    The following global variables are available for use in a DApp:

    1. global.PATH.mainDir – path to the root directory of the IZZZIO blockchain files

    2. global.PATH.configDir – path to the directory of the configuration file

    These variables are usually used to include core module files in a project.

    const DApp = require(global.PATH.mainDir + '/app/DApp'); //DApp will be searched for in the blockchain root directory

    const DApp = require(global.PATH.mainDir + '/app/DApp'); //DApp will be searched for in the blockchain root directory
    class TestDapp extends DApp {
        init(){
            console.log('DApp ready!');
        }
        terminate(cb){
            console.log('DApp terminated');
        }
    }

    6.3. Available objects

    6.3.1. logger

    Internal path: modules/logger

    logger standardizes the output of messages to the console.

    Property: disable – true disables message output; false enables output

    new Logger([prefix])

    Arguments:

    • prefix (string) – Prefix with which the message will be output

    getPrefix()

    Result:
    The currently set prefix

    log(type, data)

    Arguments:

    • type (string) – Type of the message to output
    • data (string) – Message

    info(type, data)

    Arguments:

    • data (string) – Informational message

    init(type, data)

    Arguments:

    • data (string) – Initialization message

    error(type, data)

    Arguments:

    • data (string) – Error message

    fatal(type, data)

    Arguments:

    • data (string) – Critical error message

    warning(type, data)

    Arguments:

    • data (string) – Warning
    const DApp = require(global.PATH.mainDir + '/app/DApp');
    const logger = new (require(global.PATH.mainDir + '/modules/logger'))("TestDApp");
    class TestDApp extends DApp {
        init(){
            logger.info('Test DApp ready!'); //Outputs "Fri, 01 Feb 2019 14:12:48 GMT Info: ECMAContract: Test DApp ready"
        }
    }

    6.3.2. assert

    Internal path: modules/testing/assert

    Provides functionality for checking conditions. Failure to meet these conditions results in an exception being thrown and the contract call ending with an error. The contract state is rolled back to the state before the call.

    The implementation is identical to the implementation for EcmaContract (clause 4).

    The following methods are provided for checking conditions:

    1. Simple truth check

    assert(condition[ , message])

    Arguments:

    • condition – condition, true
    • message (string) – message

    2. Check that the value is not of type undefined

    defined(condition[ , message])

    Arguments:

    • condition – simple condition using conditional operators
    • message (string) – message if the condition is false

    3. Checks that the condition a > b holds

    gt(a, b[ , message])

    Arguments:

    • a – numeric parameter
    • b – numeric parameter
    • message (string) – message if the condition is false

    4. Checks that the condition a < b holds

    lt(a, b[ , message])

    Arguments:

    • a – numeric parameter
    • b – numeric parameter
    • message (string) – message if the condition is false

    5. Checks that the condition is true. Alias of assert.assert

    true(condition[ , message])

    Arguments:

    • condition – condition
    • message (string) – message if the condition is false

    6. Check that the condition is false (similar to “It is not true that…”)

    false(condition[ , message])

    Arguments:

    • condition – condition; condition
    • message (string) – message if the condition is false
    class Test extends Contract {
        init(){
            super.init();
            assert.gt(100,200,'100 не может быть больше 200');
        }
    }

    6.3.3. instanceStorage

    Internal path: modules/instanceStorage

    Provides access to created object instances by key.

    instanceStorage.get(objName)

    Arguments:

    • name (string) – Name of the saved entity

    Result:
    The saved entity, or null if absent

    instanceStorage.put(objName, value)

    Arguments:

    • name (string) – Name of the entity being saved
    • value – Entity object

    By default, instanceStorage contains the following entities:

    1. Blockchain – the main instance of the network object

    2. config – instance of the configuration object

    3. wallet – the current wallet

    4. blocks – block data storage

    5. blockHandler – instance of the block handler object

    6. frontend – instance of the RPC interface and shell object

    7. transactor – instance of the transaction control object

    8. cryptography – instance of the cryptography object

    9. blockchainObject – alias of the Blockchain object

    10. accountManager – account manager

    Optional objects and values:

    1. ecmaContract – instance of the smart contracts object (if enabled)

    2. dapp – instance of the decentralized application object (if enabled)

    3. terminating – shutdown flag

    const DApp = require(global.PATH.mainDir + '/app/DApp');
    const storj = require(global.PATH.mainDir + '/modules/instanceStorage');
    class TestDApp extends DApp {
        init(){
            console.log(storj.get('config').p2pPort); //6015
        }
    }

    6.3.4. StarWaveCrypto

    Internal path: modules/starwaveCrypto

    StarWaveCrypto is a module that creates an encrypted channel for data exchange between network nodes. When a connection is created, keys are generated and exchanged between the nodes using the Diffie–Hellman (DH) protocol.

    To create an encrypted channel, a method that performs a “handshake” is used. In this way, the receiving side, using its incoming message handling method, will immediately create a new secure connection or use an existing one. Example of establishing a connection:

    const DApp = require(global.PATH.mainDir + '/app/DApp');
    const StarwaveCrypto = require(global.PATH.mainDir + '/modules/starwaveCrypto');
    class TestDApp extends DApp {
        init() {
            let that = this;
            starwave.registerMessageHandler('SW_TEST', function (message) {
                console.log('New message', message);
            });
            let crypto = new StarwaveCrypto(this.starwave, this.blockchain.secretKeys).makeConnection(RECEIVER_ADDRESS, function(who, secretKey){
                console.log('Connected!');
                let message = that.starwave.createMessage('Hello Node Two' + Math.random(), 'RECEIVER_ADDRESS', undefined, 'SW_TEST');
                crypto.sendMessage(m);
            });
        };
    }

    6.4. DAPP connectors

    DApp connectors are wrapper classes that provide a simplified interface for interacting with contracts of certain types.

    6.4.1. DApp-ContractConnector

    Internal path: modules/smartContracts/connectors/ContractConnector

    Base abstract class for connectors. Makes it possible to register methods and their aliases.

    6.4.2. DApp-TokenContractConnector

    Internal path: modules/smartContracts/connectors/TokenContractConnector

    DApp-TokenContractConnector is a connector class that implements interaction with a token contract for a DApp

    new TokenContractConnector(EcmaContractsInstance, contractAddress)

    Arguments:

    • EcmaContractsInstance – Instance of the EcmaContracts object
    • contractAddress (string) – Address of the contract being connected to

    async balanceOf(address)

    Arguments:

    • address (string) – Address of the token holder

    Returns string:
    Token balance

    async totalSupply()

    Returns string:

    • Total number of tokens issued

    async transfer(to, amount)

    Arguments:

    • to (string) – Token recipient
    • amount (string) – Number of tokens

    async burn(amount)

    Arguments:

    • amount (string) – Number of tokens to burn

    async mint(amount)

    Arguments:

    • amount (string) – Number of tokens to issue

    async contract()

    Returns string:

    • The contract property of the contract. Contract data

    Executing a method of another contract with payment:

    async pay(address, method, txAmount, args)

    Arguments:

    • address (string) – Address of the contract whose method is called
    • method (string) – Method
    • txAmount (string) – Transfer amount
    • args (array) – Call arguments

    Result:
    The newly created block

    const DApp = require(global.PATH.mainDir + '/app/DApp');
    const TokenContractConnector = require(global.PATH.mainDir + '/modules/smartContracts/connectors/TokenContractConnector');
    class TestDApp extends DApp {
        async init(){
            let mainToken = new TokenContractConnector(this.ecmaContract, this.getMasterContractAddress());
            console.log(await mainToken.balanceOf(this.getCurrentWallet().id)); //Outputs the balance of the current wallet
            //Calls the processPayment method of the SOME_CONTRACT_ADDRESS contract with the parameter 'Hello', passing the state of a payment of 1 token from the current wallet
            await mainToken.pay(SOME_CONTRACT_ADDRESS, "processPayment", '1', ['Hello']);
        }
    }

    6.5. DApp internal objects

    6.5.1. DApp.network

    Provides basic functionality for interacting with the network interface, as well as registration of RPC and interface handlers.

    1. Returns an array of current peers in the format ws://address:port

    getCurrentPeers()

    Result:
    List of connected peers

    2. Getting a socket by bus address (address of an external node)

    getSocketByBusAdress(address)

    Arguments:

    • address (string) – bus address

    Result:
    socket object, or false if the address was not found.

    3. Sending a message directly to a socket

    socketSend(ws, message)

    Arguments:

    • ws – socket.
    • message (string) – message.

    4. Registering a callback method for a GET request

    rpc.registerGetHandler(url, callback)

    Arguments:

    • url (string) – URL handler
    • callback (function) – Callback method

    5. Registering a callback method for a POST request

    rpc.registerPostHandler(url, callback)

    Arguments:

    • url (string) – URL handler
    • callback (function) – Callback method

    The rpc.registerGetHandler and rpc.registerPostHandler methods are based on the Express.js framework (for more about handlers, see the Express.js documentation: https://expressjs.com/ru/4x/api.html)

    6.5.2. DApp.messaging

    Deprecated functionality. Provides basic functionality for exchanging messages between network nodes.

    1. Registering a message handler

    registerMessageHandler(message, handler)

    Arguments:

    • message (string) – message identifier
    • handler (function) – message handler function

    2. Method for broadcasting messages over the network

    broadcastMessage(data, message, receiver)

    Arguments:

    • data – the object being transmitted
    • message (string) – message identifier
    • receiver (string) – message recipient

    3. Method for sending a message to the nearest recipient

    sendMessage(data, message, receiver)

    Arguments:

    • data – object containing the message itself.
    • message (string) – message identifier.
    • receiver (string) – message recipient.

    The DApp.messaging.starwave methods are described in the StarWave section (clause 6.7)

    6.5.3. DApp.blocks

    DApp.blocks provides access to the functionality for generating and adding blocks and to the event handler.

    Generates a block without adding it to the block chain:

    generateBlock(blockData, cb, cancelCondition)

    Arguments:

    • blockData (Block) – Signed Block
    • cb (function) – callback function function(newBlock)
    • cancelCondition – Function defining the condition for cancelling block generation

    Generating a block, adding it to the block chain and notifying nodes of the new block:

    generateAndAddBlock(blockData, cb, cancelCondition)

    Arguments:

    • blockData (Block) – Signed Block
    • cb (function) – callback function function(newBlock)
    • cancelCondition – Function defining the condition for cancelling block generation

    Adding a generated block:

    addBlock(newBlock, cb)

    Arguments:

    newBlock – Ready block

    cb – callback

    6.5.3.1. Block handler methods

    Returns the instance of the current block handler:

    handler.get()

    Result:
    block handler (catcher) object.

    Registering a block handler by type:

    handler.registerHandler(type, handler)

    Arguments:

    • type (string) – Block type
    • handler (function) – block handler function function(blockData, blockSource, callback)

    Calling callback in the block handler is mandatory. The absence of the callback will cause the block handler to hang.

    6.5.4. DApp.contracts

    DApp.contracts provides access to the EcmaContracts module.

    contracts.ecma provides direct access to the EcmaContracts object. See EcmaContracts

    contracts.ecmaPromise provides the main EcmaContracts methods for use in asynchronous mode (async-await)

    Launches a contract on the network:

    ecmaPromise.deployContract(source, resourceRent)

    Arguments:

    • source (string) – Contract source code
    • resourceRent (number) – Number of tokens allocated for renting the contract’s resources

    Result:
    object of the new block containing the contract

    Runs a contract method:

    ecmaPromise.deployMethod(address, method, args, state)

    Arguments:

    • address (string) – Contract address
    • method (string) – Contract method
    • args (array) – Array of call arguments
    • state (object) – Object of the passed state

    Result:
    object of the new block

    Runs a contract method with state rollback

    ecmaPromise.callMethodRollback(address, method, args, state)

    Arguments:

    • address (string) – Contract address
    • method (string) – Contract method
    • args (array) – Array of call arguments
    • state (object) – Object of the passed state

    Result:
    Result of executing the contract method

    6.6. DApp internal methods

    DApp.getConfig()

    Result:
    configuration object

    DApp.getBlockHandler()

    Result:
    block handler object

    DApp.getCurrentWallet()

    Result:
    current wallet object

    DApp.getMasterContractAddress()

    Result:
    master contract address

    6.7. StarWave

    StarWave is a high-speed data transfer protocol within the IZZZIO network. The protocol automatically builds the shortest route for delivering a message to the recipient. If the route is broken, it is rebuilt on the same principle.

    StarWave methods are available in a DApp as DApp.messaging.starwave

    messaging.starwave methods

    Registering a message handler:

    starwave.registerMessageHandler(message, handler)

    Arguments:

    • message (string) – message identifier
    • handler (function) – message handler function

    Method for sending a message to the nearest recipient

    starwave.sendMessage(data, message, receiver)

    Arguments:

    • data – object containing the message itself.
    • message (string) – message identifier.
    • receiver (string) – message recipient.

    Method for creating a message structure

    starwave.createMessage(data, receiver, sender = undefined, id, timestamp = undefined, TTL = undefined, relevancyTime = undefined, route = undefined, type = undefined, timestampOfStart)

    Arguments:

    • data – object containing the message itself.
    • receiver (string) – message recipient
    • sender (string) – message sender; undefined – system information about the sender is used
    • id (string) – Message identifier
    • timestamp (number) – Message timestamp; undefined – automatic
    • TTL (number) – Allowed number of message hops; undefined – automatic
    • relevancyTime (number) – message relevance time; undefined – automatic
    • timestamp – Message timestamp; undefined – automatic
    • route (array) – Message route; undefined – automatic
    • type (string) – Message type; undefined – automatic
    • timestampOfStart (number) – Timestamp of message sending; undefined – automatic

    Result:
    Message structure object

    6.8. StarWaveCrypto

    Internal path: modules/starwaveCrypto

    StarWaveCrypto is a module that creates an encrypted channel for data exchange between network nodes. When a connection is created, keys are generated and exchanged between the nodes using the Diffie–Hellman (DH) protocol.

    To create an encrypted channel, a method that performs a “handshake” is used. In this way, the receiving side, using its incoming message handling method, will immediately create a new secure connection or use an existing one. Example of establishing a connection:

    7. Standards

    7.1. IZ3 Token

    The token standard defines mandatory requirements:

    1. The contract property returning information about the token {name, ticker, owner, emission, type} and type="token"

    2. The init method([initial emission = 0 , minting allowed = false])

    3. The balanceOf method(address)

    4. The totalSupply() method returning the total amount of tokens issued

    5. The transfer method(recipient address, transfer amount)

    6. The burn method(burn amount)

    7. The mint method(minting amount)

    8. The getTransferFee method(amount) returning the cost of the transfer operation

    9. The getActionFee method(action, parameters) returning the cost of performing an operation

    10. Transfer events(sender address, recipient address, amount), triggered on any movement of funds

    11. Mint events(address, amount)

    12. Burn events(address, amount)

    The token standard is fully implemented by the built-in TokenContract class (clause 4.1.3.2).

    7.2. Pay Object

    The object returned by the payProcess method of the Contract class.

    {
        amount, //Payment amount, BigNumber
        rawAmount, //Payment amount, original form
        ticker, //Ticker of the payment currency
        balance, //New contract balance, BigNumber
        rawBalance, //New contract balance, original form
        caller, //Address of the payment token contract
        contractName, //Name of the payment token contract
    }

    To check the payment currency, it is recommended to check the caller’s address as follows:

    assert.true(Number(PayObject.caller) === Number(WANTED_TOKEN_ADDR));

    To accept payment only in the network’s main token, use:

    assert.true(Number(PayObject.caller) === Number(contracts.getMasterContractAddress()));

    7.3. state

    The object of the current launch state. One of the most important objects of the virtual environment.

    The recommended way to get the current state

    const state = global.getState();

    The content of the object may vary greatly depending on the current launch state of the contract, so it is recommended to check for the presence or absence of the required properties before working with them.

    Main properties:

    1. state.from – Address of the user who initiated the launch of the smart contract methods. Visible to all contracts in the call chain

    2. state.block – Optional property. Block object of the current call (see clause 7.4. Block)
    state.contractAddress – Address of the contract of the current call.

    3. state.extend – Optional property. Additional state object.

    4. state.randomSeed – Optional property. Current setting of the random number generator

    5. state.calledFrom – Optional property. Address of the contract that made the current call

    6. state.delayedMethod – Optional property. Delayed call flag

    7. state.callingIndex – Optional property. Number of the current call in the call chain

    7.4. Block

    Block object. Properties:

    1. index – current number

    2. previousHash – hash of the previous block

    3. timestamp – block timestamp

    4. startTimestamp – timestamp of the start of block generation

    5. data – data string

    6. hash – block hash

    7. sign – digital signature of the block

    ← Documents