Hawk’s Smart Contract Part 2

Hawk Network
3 min readAug 30, 2019

The following steps describe in detail the process of phase 2 "Contracts are transmitted through the Hawk Network and stored on the blockchain"

  1. The contract transmits across the entire blockchain network through p2p communication. Each node receives a copy. The verification node in the blockchain first saves the received contract into memory and waits for a new round of consensus to trigger and process the contract.
  2. When consensus arrives, the verification node will pack all the contracts saved in the most recent period together into a set, calculate the Hash value of the contract set, and finally assemble the Hash values of the contract set into a block structure, spreading to the entire network. Other verification nodes will receive the hash of the contained contract collection and compare it with their own saved contract set. Sending a self approved contract set to other verification nodes, through this multiple rounds of transmission and comparison, all verification nodes eventually agree on the latest set of contracts within a specified time. C. The latest contract set will be transmitted to the entire network in the structure of blocks. As shown in the following figure, each block contains the following information:
  3. The latest contract set will be transmitted to the entire network in the structure of blocks. As shown in the following figure, each block contains the following information.
  • Hash value of the current block
  • Hash value of the previous block
  • The timestamp when consensus was reached
  • Other descriptive information

The most important piece of information in the blockchain is a set of contracts that have reached consensus. The node that receives the contract set will verify each contract and its participants’ signature and the verified contract will be written on the blockchain.

The following steps describe the process of phase 3, “Built-in Blockchain Smart Contracts Auto-execute”

  1. The smart contract periodically traverses the state machines and checks their current status, transactions, and trigger conditions contained in each contract one by one. The conditionally satisfied transaction is then pushed into the queue to be verified and awaits consensus, transactions that do not satisfy the trigger condition will remain on the blockchain.
  2. The events in the most recent verification process will be transmitted to each verification node. Like common blockchain events or transactions, the verification node first performs signature verification to ensure the validity of the events. Verified events will enter the pending consensus set to wait for the majority of verification nodes to reach consensus. Once reached, the events will be successfully executed and notify the user.
  3. After the event is successfully executed, the state machine of the smart contract will determine its status. After all the events included in the contract are sequentially executed, the state machine marks the status of the contract as completed and removes it from the latest block. It will otherwise be marked as “in progress” and continue to be saved in the latest block for the next round of processing until it is marked as completed. The entire event and its status are processed and completed by the smart contract system built into the blockchain core. It is fully transparent and tamper-proof.

To achieve a more transparent ecosystem our platform will adopt a variety of methods to support the sharing economy service providers in developing DApps and smart contracts including

  • Blockchain virtual machines that support C++ and Solidity languages programming.
  • Convenient SQL commands within our smart contract storage system, due to our blockchain database storage features.

Important links:

Website — Hawk.cool

Twitter — Twitter.com/hawk_HKC

--

--