The Best way to become an Ethereum Developer in 2018 — part 3

Piotr Brudny
5 min readAug 1, 2018

--

PART 3

If you read previous parts of this guide (1, 2) you should know the basics of Solidity and you have your editor ready. Now it’s a time to write code yourself.

I have prepared a list of 30 challenges for you. I was publishing one challenge a day on Polish Ethereum FB group. Most of the challanges are single smart contracts, some of them are tests or even complete decentralized applications.

Here is the list of covered topics:

  • Solidity smart contracts (lottery, ICO, DAO…)
  • Tokens (ERC20, ERC721)
  • Testing (Solidity tests, JavaScript tests)
  • Security (Re-entry attack)
  • DAPPs & deployment (Truffle, Web3)
  • External services (Oraclize, Infura)
  • Storage (IPFS, Swarm)
  • and many more

How to learn

1. Read requirements.

It is good if you read through the requirements and extra materials I provided or google the subject yourself.

2. Write your code.

For most of the challenges (those without test coverage and frontend part) you can use online editor Remix. This might be easier to use and catch errors because of the auto debugger/compiler.

3. Check the solution.

Once you are done (or you completely got stuck) you can check my solution on the repository https://github.com/pbrudny/learning-solidity-2018 or click the challenge title.

4. Contribute (optional)

If your solution is different than mine. Feel free to make a Pull Request.

Solidity examples — 30 x challenges

01_say_hello

  • set greeting on creation and allow to change it by the owner (creator of the contract)
  • return greeting to everyone who calls sayHello method
  • return Hello Daddy to the creator

02_balance_address_checker

  • return address of the contract
  • return address of the contract’s owner
  • return address of the sender
  • return balance of the contract
  • return balance of the contract’s owner (ONLY if you are the owner)
  • return balance of the sender

03_basic_random

04_lottery_10_users

  • 10 users limit
  • user has to pay 0.1 ether to join the lottery
  • same user can join once
  • owner of the contract can join the lottery
  • when 10 users join then the winner is picked
  • winner receives all the money
  • new lottery starts when the winner is pickecd

05_lottery_no_limit

  • user has to pay 0.1 ether to join the lottery
  • no limit for users number
  • same user can join multiple times
  • owner of the contract can join too
  • owner decides when to pick the winner
  • winner receives all the money
  • new lottery starts when the winner is pickecd

06_lottery_multiple_winners

  • no limit for users
  • user joins paying 0.1 eth and picking number 1–100
  • owner decides when to generate random number (1–100)
  • users who picked generated numbers win
  • total prize is distributed to all winners

07_fundraising

  • fundraising has the goal to reach (amount is set on creation)
  • fundraising has the time limit (time is set on creation)
  • anyone can add any amount until time is up or the goal is reached
  • when the time is up but the goal is not reached users can withdraw their funds
  • when the goal is reached owner can withdraw all the money

08_basic_token

  • intial supply of tokens is set on creation
  • contract creator gets initial tokens
  • tokens can be transferred to any account
  • there is a protection from overflow
  • everyone can check balances

09_ERC_20_token

10_ERC20_usage

  • create your own ERC20 token using Open Zeppelin implementation
  • inherit from “StandardToken”
  • add custom name, symbol, decimals and initial supply

11_ERC_721_usage

  • create your own ERC721 token using Open Zeppelin implementation
  • inherit from “ERC721Token”
  • add custom name and symbol

12_string_converter

  • create function to convert string to bytes32
  • add Solidity test for that function

13_route_manager

  • contract must store a list of bus stops
  • each bus stop has id, name and coordinates (i.e czn1, PKS Cieszyn, 10.123222, 33.212345)
  • owner should be able to add new stops
  • contract must have test coverage

14_testing_route_manager

  • add Solidity tests
  • add JavaScript tests

15_shared_wallet

  • contract has one owner
  • owner can add and remove managers
  • manager can withdraw all the funds
  • contract has a payable fallback function to receive transfers

16_multisig_wallet

  • create a multi signature wallet
  • transfers can only be done when 3 managers sign the transaction

17_crowdsale

  • create mintable coin (use Open Zeppelin)
  • create simple crowdsale (use Open Zeppelin)
  • set opening and closing time
  • set rate and wallet address

18_roles_management

  • create contract which inherites from Ownable (Open Zeppelin)
  • contract must have a list of managers
  • owner can add/update/remove manager
  • owner is a manager too
  • add modifier onlyManager

19_the_dao_attack

  • add very simplified The DAO contract (deposit, withdraw)
  • add attacker contract

20_lpg_price

  • get LPG price using Oraclize API

21_random_oraclize

  • get random number using Oraclize API

22_raffle_oraclize

  • users can join raffle once
  • owner can’t participate
  • winner is picked using RNG from Oraclize

23_ipfs_oraclize

  • add a simple json file to ipfs
  • use oraclize to read that file
  • store the result of one json attribute in a string variable

24_election

  • create one contract per election, providing a short name and address for each candidate.
  • creator of the contract gives the right to vote to each address individually
  • each voter can vote once
  • voter can not vote on himself

25_faucet

  • add fallback function to accept the payment
  • add withdraw function which allows anyone to get maximum 1 ether
  • log both amounts (paid, transferred) using events

26_swarm_oraclize

27_dapp_pet_shop

28_infura_deployment

  • add settings for Ropsten deployment using Infura

29_tic_tac_toe

  • add basic tic tac toe for 2 players
  • 3x3 board
  • no AI needed

30_web3_DAO_deploy

Credits

Not every challange was fully “invented” by me. I have used a lot of different resources:

If you are the author of these resources I hope you are ok with me using it for inspiration. I appreciate Your work very much.

--

--