Our website is using the Cookies technology. By continuing to use our site, you are accepting the Terms of Use

Close

Giant Contract Q1 2019 Update

29-03-2019

How do smart contracts work?

Every full node on the network executes the code of smart contracts from the storage. It leads to changes of the blockchain state, or the smart contracts code itself. Code execution is initiated by a transaction that addresses smart contracts. In case of smart contract deployment it executes the code from a transaction and writes the smart contract code and its latest state into storage. For example, the basic algorithm of smart contract deployment into Giant blockchain is the following:

  1. Creation of a “deploy” type transaction that includes code of intended smart contract and initiates creation of smart contract address (public key)
  2. Verification and sending to mempool
  3. Inclusion of the transaction to a block
  4. Block validation by full nodes
  5. The transaction initiates a “deploy” command and launches Giant Virtual Machine (GVM)
  6. The transaction code execution by GVM with parallel execution fee control
  7. Writing of the smart contract and its latest state into storage

Giant Contracts roadmap

To make this scenario happen the following modifications of the Giant Blockchain are required:

  • Creation of GVM:
    • Connection of V8 engine to the daemon, a Giant full node element
    • Integration of V8 engine and Command Line Interface (CLI)
      • Preparation - V8 engine launch as a response to commands “call” and “deploy”;
      • Execution of JS code from the data field of a transaction
      • Rollback of the smart contract state in a response to the network fork
      • Writing the changes into storage
  • The transactions system upgrade:
    • Transaction structure change with addition of new fields:
      • Type - transaction type
      • Data - smart contract code or methods call
      • Priority - parameter to increase priority of the code execution
    • Addition of 3 transaction types:
      • Deploy - smart contract creation
      • Call - addressing of a smart contract
      • Transfer - GIC transfer, basic type
    • Creation of a hashing mechanisms for “deploy” transaction that uses the transaction data and generates a unique public key
  • CLI extension to interact with smart contracts via “deploy”, ”call” commands
  • Creation of a mechanism for validation of transactions “deploy”, “call”
  • Defining cost of execution of code and certain commands
  • Documentation (technical requirements, methods to work with, JS version requirements)

Besides that, we had to complete more general tasks for GiantCore:

  • Development of a tool that builds wallets for different OS automatically
  • Update tests, add unit tests for smart contracts

There are also certain modifications that will increase the efficiency of the smart contracts ecosystem, including utilizing masternodes network.

What’s already been done?

  • The tests have been updated; unit tests have been partially added
  • The wallets build and update have been automated
  • V8 engine was added to the daemon
  • CLI has been extended to interact with smart contracts
  • The transaction system has been upgraded

Now the main focus is on a transactions validation mechanism and the V8 engine integration to CLI.