How to Deploy a Smart Contract in 5 Minutes

Travis Reeder
GoChain

--

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.

Prerequisites

You will need a few things before we get started:

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.sol in VS Code
  • Press F5 to compile
  • This will create a few files in a bin/ directory, open 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 TestNet
  • Click Open Wallet
  • Paste your private key for your testnet wallet that has the GO you got from our Telegram
  • Click Deploy Contract
  • Copy the contents of MyToken.bin into the Bytecode field
  • Click Send!

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.

Next Steps

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

--

--

Travis Reeder
GoChain

Founder, CTO at GoChain - Building and breaking things