Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Intro to smart contract programming in solidity Oct 2019

Intro to Smart Contract Development, Jan 2020


  1. Go through slides
  2. deploy ballot to test net
  3. go over solidity language
  4. deploy ico to test net
  5. build webapp with truffle
  6. (stretch) deploy bonding curve token


  1. open

Loading, Compiling, and not yet Deploying

Click the remix icon on the top of the icon panel to see the Landing Page.

In the Environments section, click the Solidity button.

In the icon panel, click file explorer icon.

Click ballot.sol & the file should appear in the main panel in a tab.

Click the solidity compiler icon solidity compiler icon.

Click the compile button compile ballot and watch it compile.

Deploying a contract

We've got a compiled contract.

Now we have to put that code on a simulation of a blockchain.

Click the Deploy and Run icon deploy & run icon. But before you click it, make sure that ballot.sol is the active tab.

Select the JavaScript VM from the Environment pulldown.

In the text box to the right of the Deploy button, put a number in this text box.

Click the Deploy button.

You have deployed the contract to the JSVM.

Install MetaMask.

Interacting with the functions in a deployed contract

Open up the contract by clicking the caret - so the caret points down.

There are 4 functions in this contract.

If this contract had imported other contracts then the functions of the imported contracts would be visible here too.

Blue buttoned functions are either pure or view functions.

Ballot.sol does not have a payable function. If it did the button's color would be red.

Deploying to a test net.

Click the MetaMask icon in your browser. Sign in and choose the rinkeby test network.

Get some test ETHER at by pasting your address. (If you don't have twitter try the ropsten network and

Go back to Remix. In the deploy plugin, in the Environment pulldown, choose Injected Web3.

Deploy your compiled ballot.sol.

You'll see the MetaMask popup asking you to pay for the transactions.

Your transaction will be broadcasted to the test blockchain and included in the next mined block. Study the generated etherscan link.

Go through slides

deploy ico to test net

  1. copy into remix
  2. Go to Line 3–15 and look at the comment section. Although this is a comment section, this will help you down the track. The name of the template ICO is ‘bitfwd’ CROWDSALE token contract
  3. Change Line 4 to the title of your crowdsale.
  4. You will just change Line 6 after you deploy the contract on the Blockchain.
  5. Change Line 7’s Symbol to your respective coin name (Keep it short)
  6. Change Line 8 to the name of your token
  7. Go to Line 102 and change “bitfwd” to “(YourCrowdsaleName). DON’T USE SPACE OR IT WON’T WORK.
  8. Do the same for Line 118
  9. Go to Line 119 and change the symbol name, the same as the ones you did in the comment section
  10. Do the same for Line 120
  11. Leave Decimals at 18.
  12. On line 122 you will have to define you first ICO parameter, when does the bonus end?
  13. And on line 123, you will define when does the Crowdsale ends.
  14. go to line 212. On that comment, write what is the amount of tokens you will be giving away for ETH.
  15. On line 218, define how much people will get within the BONUS.
  16. On line 220, define how much people will get without the BONUS (the same ratio that you put on line 212). The “msg.value” is the amount of ETH that someone sent. So taking my contract as example, for every 1 ETH, i would give 1000 FWD in return.
  17. Now Under Compile→Choose the Token you are creating →Details
  18. Navigate to the build and deploy tab → Press Deploy Contract
  19. Click on the transaction tx or access to check if the contract went through.
  20. Register this contract. To do that: In the Overview Tab → Click on the Contract Address
  21. Go to the Contract Code Tab → Click Verify and Publish
  22. Nearly there… The following steps are really important. So pay attention. Basically what we are doing here is trying to guarantee that the code fits what you saying you are deploying and registering this on the network. FOREVER.
  23. Be sure that the contract address field corresponds to the contract address that you have just deployed. Remember contract address is different to the MEW address you created so make sure not to get them confused
  24. The contract name has to match the one in the code, in my case is this: bitfwdToken. This was on Line 102 in your code
  25. To check which version of the complier, go back to the remix page where you got the BYTECODE from and look at the URL, the complier version will be there. In most cases it should be: v0.4.19+commit.c4cbbb05.js
  26. On Optimisation, choose No (We haven’t enable it before).
  27. On ENTER THE SOLIDITY CONTRACT CODE BELOW, copy the whole code from Remix, and paste in that area. NOT THE BYTECODE, but the code itself. Can also be copied from your text editor.
  28. *Remember to add on line 6 the contract address that has been generated!
  29. Now, leave the other fields in blank and click on Verify and Publish.

If you see a success page with green checkmarks you deployed your ico!



Truffle Setup

go through



  • (any windows specific steps?)

For all students

  1. install nodejs
  2. install an editor, I recommend
  3. install the truffle suite $ npm install -g truffle
  4. install ganache
  5. install the chrome browser
  6. install the metamask chrome extension
  7. get test tokens for the Ropsten network via the faucet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment