Developing Smart Contracts For GoChain


A lot of people ask “How do I deploy a smart contract to GoChain?” and the answer is: “the same way you deploy to Ethereum, just point to a different network”. But to make that clear and show how simple it is, here’s a quick guide for deploying contracts to GoChain.

Step 1: Compile your Contract

We’ll use the simple hello world contract from here (slightly upgraded for newer Solidity):

All this contract does is return “Hello World!” when you call the greet()function. It also has a self destruct in case you want to destroy the contract later and return any ETH that was mistakenly sent to it.

To compile it, go to Remix, paste the above into the editor then click “Start to compile”.


Then you should see the following right below that:


Click “Details”. In the WEB3DEPLOY section, copy the “data” field, that’s your compiled contract.

Step 2: Deploy your Contract

We’re going to deploy through MyEtherWallet since it’s easy to do and you don’t need to install any tools or anything.

First thing you need to do is add GoChain (start with the GoChain TestNet) to the Network list on MyEtherWallet as it explains in this Guide.

Once you’ve added GoChain to MEW, go to the Contracts section, then click Deploy Contract. Paste the “data” field you copied from Remix into the “Byte Code” textbox. Choose Private Key and enter your GoChain TestNet private key (if you need some testnet Go, ask in our testnet Telegram), then click Unlock.

Now click Sign Transaction. Now be ready to copy and paste the contract address, for some reason MEW only shows it for about 5 seconds and it’s hard to find if you don’t grab it! Now click Deploy Contract and snag the contact address quickly.

Yay, your contract is deployed!

Step 3: Using the Contract

Alright, so now you’ve deployed your contract, time to use it! In MEW, go to the contracts section again and Interact with Contract should be selected. Paste your contract address you got from step 2 into the first field.

Now back in Remix, copy the ABI details by clicking the clipboard beside where it says ABI like so:


Now go paste that into the ABI / JSON Interface field in MEW then click Access. Now select the greet function in the select box and you should see the Hello World! response from the contract you just deployed.


That’s it! You just deployed your first contract to GoChain and interacted with it.

Next Steps

The same concepts we followed here will apply to whatever tool you are using. For example, if you are using Truffle Framework, add GoChain’s RPC URL to your Truffle network configuration.

0 out of 0 found this helpful



Please sign in to leave a comment.