-
Introduce web3.js (both the current release and the beta 1.00), running a local blockchain with Ganache, getting and sending ETH between accounts locally on the server side, getting ETH balance from a mainnet account using Infura.
-
Creating a very basic DApp with a front-end to send ETH between accounts using MetaMask. This activity uses boilerplate HTML/JS/CSS code which will then be used in Activity 3 in building a Lending app.
-
As a stretch exercise, continue with activity 2b to learn how to build, sign and broadcast a transaction to the Ropsten account from scratch. This is useful if developing without MetaMask to sign transactions. Introduce
Buffer
, nonces, andethereumjs-tx
library. -
Activity 3 is the meat of the workshop. Participants will:
- Build a solidity contract for a Lending app with a
Loan
struct - Contract also has an
addLoan
function which executes a write transaction to the network - Use Truffle to compile and deploy contract to local blockchain
- Use HTML/CSS/JS templates to wire up front-end similar to Activity 2
- Discuss use of Promises in a few different ways:
.then(function(..){})
- Callback functions passed into
web3.eth.sendTransaction({}, cb{})
for example async/await
- Rendering blockchain data in the HTML
- Identify which account is 'active'
- Build a solidity contract for a Lending app with a
-
Activity 3b is to deploy the Lending app in the previous exercise onto the Ropsten network using Truffle's
HDWalletProvider
tool and Infura to pay the gas fee for deploying the contract to Ropsten. -
Then we take a step back to discuss Smart Contract security considerations, specifically:
- Re-entrancy
- Underflows/overflows
and an introduction to the
Checks-Effects-Interactions
pattern. Participants will also use EthFiddle to interact with smart contract code in the browser.
-
Activity 5 is then to refactor the Lending app to use Link. In particular, the activity requires refactoring the
createLoan
function inapp.js
to make anajax
requests ($.post
and$.get
) using the Link API smart contract endpoints.
By the end of the workshop, participants will:
- Be familiar with some of the common blockchain development tools in the marketplace today
- Be able to make transactions on a local and public Ethereum blockchain
- Create a web app that interacts with a local and public Ethereum blockchain
- Create, deploy and interact with your own smart contract, both locally and on the public testnet
- Learn and debug some common security flaws in smart contract development
- Be the first users of Blockmason Link!
- 10-10:30am - Intros, setup
- 10:30-11am - Activity 1
- 11-12pm - Activity 2
- 12-12:30pm - Lunch, Activity 2b*
- 12:30-1:30pm - Activity 3
- 1:30-2pm - Activity 3b
- 2-2:30pm - Activity 4
- 2:30-2:45 - Break
- 2:45-3:45 - Activity 5
- 3:45-4pm - Wrap up