Contract deployment

Smart Contract IDE

1. register account

Access test-net online wallet Register a wallet account

2. Claim test-net Token

After registration is complete, claim test-net token(browser access, Please replace your_account_name with your test web wallet account name)

3. IDE download

Smart Contracts can be written, compiled, deployed, and debug by the Smart Contract IDE.

click download

4. Import account

Go to Online Wallet in Step 1 to find your own active permission private key.

Open the client again and import the account on the settings page.


The password will not be uploaded to the server, if you forget to remove the account and re-import

5. Select template project

6. Compile

7. Deploy

Need to unlock the wallet before deployment

8. Call

As with deployment, you also need to unlock your wallet first.


1. GXChain source code compilation

If you don't want to use smart contract IDE tools, or want to build a more stable and reliable compilation environment; you can compile GXChain program locally, compile, deploy, and call smart contracts through command line; GXChain source code compile, currently supports ubuntu system and mac system.

2. Create a contract using a template

Create a helloworld contract with the gxx tool

gxx -n helloworld

3. Compile the contract, generate wast and abi

Compile the contract and generate wast and wasm files

gxx -o helloworld/helloworld.wast helloworld/helloworld.cpp

Generate abi file

gxx -g helloworld/helloworld.abi helloworld/helloworld.cpp

4. Deployment contract

Need to start cli_wallet, connect local node or remote testnet node

./programs/cli_wallet/cli_wallet -swss:// --chain-id c2af30ef9340ff81fd61654295e98a1ff04b23189748f86727d0b26b40bb0ff4

Import wallet private key

# If it is a new wallet, you need to set an unlock password, here mylocalpassword

new >>> set_password mylocalpassword

# Unlock
locked >>> unlock mylocalpassword

# Import wallet private key
unlocked >>> import_key your_account_name your_private_key

# Deployment contract,0 and 0 are vm type and vm version respectively
unlocked >>> deploy_contract helloworld your_account_name 0 0 ./helloworld GXC true

5. Call contract

After the deployment contract is successful, you can call the contract using the call_contract interface.

unlocked >>> call_contract nathan helloworld null hi "{\"user\":\"zhuliting\"}" GXC true

6. Update contract

// 'hello120301' is contract name
unlocked >>> update_contract hello120301 zhao-123 /Users/zhaoxiangfei/code/contracts_work/example_contract_02/helloworld GXC true
Last Updated: 2/15/2019, 6:08:32 PM