How to Deploy a Smart Contract in 5 Minutes
UPDATE FEB 7, 2019: Want to do it in 3 minutes? Check out the new web3 tool that makes all of this WAY easier: https://github.com/gochain-io/web3
Creating and deploying Ethereum based smart contracts has never been a simple task. Typically requiring you to use some complicated framework, run a local node and/or develop in a barely usable online editor. Today I’ll show how easy it is to deploy a contract to GoChain.
You will need a few things before we get started:
- Install Visual Studio Code (you should already be using this if you’re a developer anyways)
- Install the VS Code Solidity extension
- Get some GO — Ask for some free testnet GO in our Testnet Telegram or buy some on KuCoin to deploy to mainnet
Compile your Contract
Let’s take the simple token code from the Ethereum website, it looks like this:
- Copy that code and paste it into a new file called
mytoken.solin VS Code
- Press F5 to compile
- This will create a few files in a
MyToken.bin. This contains your contract bytecode, which you’ll use below.
Now you have the bytecode for your contract, let’s deploy it!
Deploy your Contract
This is really easy using the GoChain Wallet:
- Go to https://wallet.gochain.io/
- In the top right, choose
- Paste your private key for your testnet wallet that has the GO you got from our Telegram
- Copy the contents of
After a few seconds your contract will be deployed and you’ll get a contract address, copy the address and save it somewhere. That address is what people will use to interact with your contract.
After you’ve deployed your contract, you’ll want to use it. There are many ways people can interact with your contracts, whether it’s sending GO directly to it, using the GoChain Wallet, using MyEtherWallet, or using a DApp that uses it. We won’t go into that in this post as we could write several other posts on that part and it depends on what your contract does.
We know it can be intimidating to know where to start when you first get into developing smart contracts, I hope this post helps you see how easy it can be.
More documentation at: https://github.com/gochain-io/docs