Building Smart Contracts with Remix

This workshop was created in 2018 (if something is broken, please shoot me a message over Gitter)

Part I

What will we build?

Voting DApp based on 2 contracts

First install Metamask

chrome.google.com/webstore

Login to Metamask

Ropsten test network

Get test ethers

Metamask faucet

Open Remix

File explorer

Editor

Terminal

Right panel

Set environment

Run tab: Environment = Injected web3 (Ropsten)

Load files to Remix

remix.loadgist('add9...')

remix.loadgist('add9633c2b0101f6fda0aadcfe350f60')

See new folder

gist/...

Open file

gist/AwardToken.sol

Compile the contract

Compile tab: Start to compile button

See compiled contracts

AwardToken + all its imported dependencies

Deploy the contract

Run tab: Deploy button

Confirm the transaction

Submit button

Check if tx is mined

Terminal logs in Remix

Part II

Open deployed contract

Run tab

See autogenerated UI

Interactive UI for AwardToken.sol contract

Start a new Ballot

startRound transaction (payable!)

Confirm the transaction

Submit button

Check if tx is mined

Terminal logs in Remix

Expand tx log

Terminal logs in Remix

startRound function

Editor

Get ballot's address

Execute currBallot call

Copy ballot's address

currBallot output

Switch to Ballot

Run tab: dropdown

Access  Ballot contract

Paste address + click At Address

See autogenerated UI

Interactive UI for Ballot.sol contract

Part III

Expand addPoposal

Run tab/Deployed contract/Ballot

Copy your address

Run tab: Account

Type the proposal

Run tab/Deployed contracts/Ballot

Paste your address

Run tab/Deployed contract/Ballot

Execute addProposal

transact button

Confirm the transaction

Submit button

Check if tx succeeded

Terminal logs in Remix

Execute getProposals

getProposals call

See Proposals Addresses

Terminal logs in Remix

Vote for one Proposal

Paste Proposal Address you want to vote for

Execute vote transaction

vote button

Confirm the transaction

Submit button

Check if tx succeeded

Terminal logs in Remix

Copy Address

run tab: AwardToken

Let's connect it to frontend

Paste your AwardToken contract address

From Remix

How users will use it

Create new Proposal

Confirm it

Check in Remix

run tab: Ballot: getProposals

Want to host the frontend yourself

https://github.com/ninabreznik/voting-ethereum-contract

Need help?

@0mkara @iurimatias @LianaHus @ninabreznik @ryestew @yann300 @serapath   

Find us on Remix support chat

How to build a DApp

By Nina Breznik

How to build a DApp

  • 3,779