Smart Contract(Optional)

Define, deploy, and debug Smart Contract

The Smart Contract is a procedure code stored and executed on the blockchain. It is deployed on every node in the cluster when consensus is.

Each node runs the same procedure using the same parameters on the local data state when invoked, then persistent stores the result if consensus.

The contract is a sequence of executing steps, each including an action and its parameters.

You can access system variables or define custom variables in the contract.

When the system invokes a contract, it generates an execution plan from the definition, running step by step till committed.

The contract directly executes the defined text in steps without compilation. Users could track and debug the contract base on the execution step of the text.

All contracts run as transactions. Either all data changes are persistently stored if a successful commit, or nothing happens if it fails.

For more details, please refer to the relevant documentation.

The contract design, deployment, and debugging could operate in the GUI of the portal.

Design

Deploy a new contract or edit an existing one in the list.

On the design page, assign a name to the new contract.

images/quick_start/usage/contract/deploy-contract.en-us.png

The user could define the input parameters of the contract, which could validate before invoking.

Add an action and its parameters for every step

Submit to deploy the contract if all steps are set up

Debug

The system enables contract debugging that inspects execution without affecting chain data.

Click debug button of a contract in the list.

images/quick_start/usage/contract/debug.en-us.png

Set the input parameters and click to test. You will get the execution plan, process, and result in real-time.