Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Bc workshop intro

10 views

Published on

blockchain ethereum smart contracts

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Bc workshop intro

  1. 1. Let’s write some code Ethereum, Solidity and Javascript
  2. 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. 3. Disclaimer & PreReqs • git repo clone - • Chrome • Ganache - Autogenerate HD Mnemonic • truffle migrate • Nodejs • npm install, npm run dev
  4. 4. Quick intro • Transaction • What is a block? • What is a chain of blocks? • Node ‣ Send ether ‣ Execute function in a contract ‣ Both!
  5. 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. 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
  7. 7. Down to business • Hello Ether
  8. 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. 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
  10. 10. Testing your Contracts • Javascript - To test your contracts from the outside world
  11. 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 ‣ …

×