Next event
1. Ethereum- Externally owned accounts
(EOAs) / Contract accounts
2. Truffle framework
3. Dapps - Pet shop
Dev environment
• IDE – Remix
• Dapp browsers– MetaMask
• Smart Contract Language - Solidity
• Simulator - ganache-cli
REMIX
Ethereum
Blockchain
Dev environment
• IDE – Visual Studio Code
• Framework – NodeJS
• Dapp browsers– MetaMask
• Smart Contract Language - Solidity
• Test Framework – Mocha/Chai
• Simulator - ganache-cli
• Library – Web3.js
• Smart contract framework – Truffle
Ethereum account
Ethereum account
• State
• Accounts
• Contracts Accounts (controlled by code)
• Address
• Balance
• Ether
• Externally Owned Accounts (EOAs: User accounts is controlled by private
keys)
• Address
• Balance
• Ether
Contract account
<code>
<code>
<code>
External owned
account
Ethereum account
• Has an address
• Private key protected by password
• Has an address but NO private key
• Hold/Run code
• Associated with accounts(s)
• Lists incoming transactions
Contract account
<code>
<code>
<code>
External owned
account
Ethereum account
• Account state
• nonce: If the account is an externally
owned account, this number
represents the number of transactions
sent from the account’s address.
• balance: The number of Wei owned
by this address. There are 1e+18 Wei
per Ether. storageRoot: A 256-bit
hash of the root node of a Merkle
Patricia tree that encodes the storage
contents of the .
• codeHash: The hash of the EVM
(Ethereum Virtual Machine) code of
this account .
Contracts Accounts- Pros and cons
• Pros
• Contract account can list incoming transactions
• Contract account can be setup as Multisig Accounts
• A Multisig Account can be structured such that it has a daily limit
which you specify, and only if the daily limit is exceeded will multiple
signatures be required
• Cons
• Contract accounts incur a cost whenever you use them.
• Contract accounts can’t initiate new transactions on their own.
Contracts Accounts- Bank
• What does Bank to do ?
• Deposits
• Withdrawals
• Balance Check
Contracts Accounts- Deploy
Coding
Deploy
Contracts Accounts- Deploy
Coding
Deploy
Contracts Accounts- Deposits
Deposits
Contracts Accounts- Bank
• Step
1. Withdraw 10 wei
2. Click “balance”
withdraw
Multisig Accounts user case
Truffle Framework
• Built-in smart contract compilation, linking, deployment and binary
management.
• Automated contract testing for rapid development.
• Scriptable, extensible deployment & migrations framework.
• Network management for deploying to any number of public & private
networks.
• Package management with EthPM & NPM
• Interactive console for direct contract communication.
• Configurable build pipeline with support for tight integration.
• External script runner that executes scripts within a Truffle environment.
Truffle Framework
1. Creating a project
2. Exploring the project
3. Testing
4. Compiling
5. Migrating with Ganache
6. Interacting with the contract
Truffle- Directory structure
•contracts/: Directory for Solidity contracts
•migrations/: Directory for scriptable deployment
files
•test/: Directory for test files for testing your
application and contracts
•truffle.js: Truffle configuration file
Pet-shop
• HTML、JavaScript、CSS
Blockchain
Links
• Remix
• https://remix.ethereum.org
• Ethereum Wallet
• https://wallet.ethereum.org
• Metamask
• https://metamask.io/
• Ganache
• http://truffleframework.com/ganache/
• Ganache-cli
• https://github.com/trufflesuite/ganache-cli
Links
• Node
• https://nodejs.org/en/
• Ganache
• http://truffleframework.com/ganache/
• Ganache-cli
• https://github.com/trufflesuite/ganache-cli
• Visual studio
• https://code.visualstudio.com/
CONTENT THE HUNGRY
LAB
22
Lynn Jamal
Community Ambassador
9270 8334
lynn@thecarrotpatch.co
CONTENT THE HUNGRY
LAB
23
CONTENT THE HUNGRY
LAB
24
Learning, Sharing, Connecting
Step-by-Step Guidance
No BS. Honest Support
Respect & Inclusivity
Entrepreneurship is hard.
You don’t have to do it alone.
Our Community
GUS@thehungrylab.com

20180714 workshop - Ethereum decentralized application with truffle framework

  • 2.
    Next event 1. Ethereum-Externally owned accounts (EOAs) / Contract accounts 2. Truffle framework 3. Dapps - Pet shop
  • 3.
    Dev environment • IDE– Remix • Dapp browsers– MetaMask • Smart Contract Language - Solidity • Simulator - ganache-cli REMIX Ethereum Blockchain
  • 4.
    Dev environment • IDE– Visual Studio Code • Framework – NodeJS • Dapp browsers– MetaMask • Smart Contract Language - Solidity • Test Framework – Mocha/Chai • Simulator - ganache-cli • Library – Web3.js • Smart contract framework – Truffle
  • 5.
  • 6.
    Ethereum account • State •Accounts • Contracts Accounts (controlled by code) • Address • Balance • Ether • Externally Owned Accounts (EOAs: User accounts is controlled by private keys) • Address • Balance • Ether Contract account <code> <code> <code> External owned account
  • 7.
    Ethereum account • Hasan address • Private key protected by password • Has an address but NO private key • Hold/Run code • Associated with accounts(s) • Lists incoming transactions Contract account <code> <code> <code> External owned account
  • 8.
    Ethereum account • Accountstate • nonce: If the account is an externally owned account, this number represents the number of transactions sent from the account’s address. • balance: The number of Wei owned by this address. There are 1e+18 Wei per Ether. storageRoot: A 256-bit hash of the root node of a Merkle Patricia tree that encodes the storage contents of the . • codeHash: The hash of the EVM (Ethereum Virtual Machine) code of this account .
  • 9.
    Contracts Accounts- Prosand cons • Pros • Contract account can list incoming transactions • Contract account can be setup as Multisig Accounts • A Multisig Account can be structured such that it has a daily limit which you specify, and only if the daily limit is exceeded will multiple signatures be required • Cons • Contract accounts incur a cost whenever you use them. • Contract accounts can’t initiate new transactions on their own.
  • 10.
    Contracts Accounts- Bank •What does Bank to do ? • Deposits • Withdrawals • Balance Check
  • 11.
  • 12.
  • 13.
  • 14.
    Contracts Accounts- Bank •Step 1. Withdraw 10 wei 2. Click “balance” withdraw
  • 15.
  • 16.
    Truffle Framework • Built-insmart contract compilation, linking, deployment and binary management. • Automated contract testing for rapid development. • Scriptable, extensible deployment & migrations framework. • Network management for deploying to any number of public & private networks. • Package management with EthPM & NPM • Interactive console for direct contract communication. • Configurable build pipeline with support for tight integration. • External script runner that executes scripts within a Truffle environment.
  • 17.
    Truffle Framework 1. Creatinga project 2. Exploring the project 3. Testing 4. Compiling 5. Migrating with Ganache 6. Interacting with the contract
  • 18.
    Truffle- Directory structure •contracts/:Directory for Solidity contracts •migrations/: Directory for scriptable deployment files •test/: Directory for test files for testing your application and contracts •truffle.js: Truffle configuration file
  • 19.
  • 20.
    Links • Remix • https://remix.ethereum.org •Ethereum Wallet • https://wallet.ethereum.org • Metamask • https://metamask.io/ • Ganache • http://truffleframework.com/ganache/ • Ganache-cli • https://github.com/trufflesuite/ganache-cli
  • 21.
    Links • Node • https://nodejs.org/en/ •Ganache • http://truffleframework.com/ganache/ • Ganache-cli • https://github.com/trufflesuite/ganache-cli • Visual studio • https://code.visualstudio.com/
  • 22.
    CONTENT THE HUNGRY LAB 22 LynnJamal Community Ambassador 9270 8334 lynn@thecarrotpatch.co
  • 23.
  • 24.
    CONTENT THE HUNGRY LAB 24 Learning,Sharing, Connecting Step-by-Step Guidance No BS. Honest Support Respect & Inclusivity Entrepreneurship is hard. You don’t have to do it alone. Our Community GUS@thehungrylab.com

Editor's Notes

  • #25  brand manager – lindsey brassington struggled with weight, health swimmer