The goal
Spend 3 hours working thru any free resources I find online to get my feet wet with zero preparation in programming a blockchain app
Guidance chosen
An article on Building a Blockchain DApp using truffle, React, Next.js and MobX that two minutes of Google led me to and that looked promising to leverage my learnings thru recent paid work in React and Mobx-State-Tree because it mentioned React and Mobx in the title (see Retro for how much of a good guess this was).
Errata and my notes on the article
Think of this like Snape’s notes on the Advanced Potions book, except I don’t think I’m a Half-Blood Prince, just someone who used the article as guidance prior to you who’s reading it and worked thru the kinks and gotchas.
First I used my Macbook to do this, so with Homebrew and NVM i ensure I was on the latest version of node and using the 7.10.0 of npm
brew install nvm
nvm use 7.10.0
npm i -g yarn
Notes on the guide:
- The URL. Change the line
git clone git@github.com:liors/tvdapp.git
to
git clone https://github.com/liors/tvdapp.git
since either there was an error in the command or the Wifi network I was on was blocking ssh connections.
- Run
yarn install
If it kicks an error like it did for me that
The engine “node” is incompatible with this module.
Expected version “7.10.0”.
error Found incompatible module
Then go back to the terminal console and run
node -v
and if it isn’t listing 7.10.0 follow again the step above to use nvm to install and use that version as the compilation is still using the newer node version so is creating this error.
- Opening the folder in Visual Studio Code and opening “Bookmark.sol” file in VSCode, it offered a few recommendations for a code/syntax highlighter for solidity, the contract-oriented programming language used here, so I went with the most downloaded one.
- At this point I took the recommendation of the article here of reading the docs with regards to solidarity to get a better grasp of what’s happening here. I’d backup this recommendation to future readers as well.
- The article then goes into running the tests, a requirement of which is having “a local instance of testrpc” but it falls short of saying how to go about doing this which also led to me first having to follow these steps to install go-ethereum for a Mac. Fun times.
- In the steps for setting up a local instance of testrpc that I referenced, the command to execute
geth –datadir=”/tmp/eth/60/01″ -verbosity 6 –ipcdisable –port 30301 –rpcport 8101 console 2>> /tmp/eth/60/01.lo
required that i first create execute
mkdir /tmp/eth
mkdir /tmp/eth/60
to create the /tmp/eth/ and /tmp/eth/60 folders before it would successfully execute.
- Run
testrpc
to get the Ethereum TestRPC client up and running and then as per the article execute
yarn test
and all tests should now successfully pass.
Retrospective
So that was quite a bit for just part 1 of the article. Haven’t even gotten to the stuff I wanted to leverage my knowledge of (React, Mobx etc). But still if there’s one takeaway it’s that I now have a hotlist of things I need to read more about now to get deeper into Blockchain application programming, specifically:
- Solidity – and especially mulling over the Solidity by Example sample to grok this better
- Geth – not just setting it up, but understanding how Ethereum nodes operate and peer with each other
- Probably also stepping back to try something simpler first, like building the Greeter app from Ethereum.org before going further including configuring my browser to run DApps with MetaMask chrome extensions