2. Objective
• Understanding the Ethereum Developer Environment
• Start writing smart contracts
• Automate Contract Testing using Mocha Framework
• Building a DAPP powered by smart contracts using
Javascript
3. Disclaimer & PreReqs
• git repo clone -
• Chrome
• Ganache - Autogenerate HD Mnemonic
• truffle migrate
• Nodejs
• npm install, npm run dev
4. Quick intro
• Transaction
• What is a block?
• What is a chain of blocks?
• Node
‣ Send ether
‣ Execute function in a contract
‣ Both!
5. More intro..
• Unit - Ether
• Address - withdraw or deposit Ether
• User Account - tied to user
• Contracts - tied to code
• same code on different address => different
contract!
6. …
• Contracts
‣ state
‣ function - change the state of a contract
• Gas - Transaction fee
• Every function comprises of operations - there is a cost
to every operation
• DAPP
8. Solidity Overview
• Turing complete
• State
• type - bool, int, uint, address, mapping, bytes, string,
struct
• visibility - public or private (default)
• Uninitialized or undeclared values are zero. There is no
null
9. Solidity Overview
• Units - Wei, Finney, Ether .… 1 Ether = 10^18 Wei
• Global variable - now - present time - time when the
block is mined
• msg - Information regarding the current transaction
‣ msg.sender - address of sender
‣ msg.value - value sent with the transaction
• address.transfer - to send ether to address
11. Game time
• You run a Casino
• You wish to host a game for 2 Players
• Game Rules
‣ Bet to get the higher number in a draw
‣ 80% of the pot money goes to the winner
‣ 20% goes to the casino
‣ …