As previously discussed, I'm doing the Certified Blockchain Professional course. It is self-directed learning, so I'm going through it at my own pace. In order to consolidate my learning, and help organise my thoughts, I'm blogging about my reflections on each module.
These are mostly notes to myself - but I hope if you find something interesting (or incorrect) that you'll leave a comment.
The first semi-practical module! Including how to write a smart contract on Ethereum.
A variety of "testnets" to play on before deploying to main. Also possible to use a private net.
Use of the
geth client from https://geth.ethereum.org/downloads/
The Certified Blockchain Professional book is poorly edited garbage.— Terence Eden (@edent) May 1, 2022
I'm on the first practical module.
I start by creating a genesis block at `~/ethpriv/`
But, in the next command, it tells me to use `~/etherprivate/`!
Oh, and the rest of the switches are invalid… pic.twitter.com/za5Hqnci1A
Nooooo! Why would you write anything contractual in either of those languages?
Solidity is statically typed so its syntax is checked at compile time.
Data types include
int (signed integer) and
address is a 160bit value.
balance the balance of the address in Wei.
send a method.
address to = 0x6414cc08d148dce9ebf5a2d0b7c2201234567890; address from = this if (to.balance < 10 && from.balance > 50) to.send(20);
Usual range of arrays, loops, etc. Functions and Libraries also available. Libraries can't have state or use inheritance, nor can their receive Ether.
Events can be written to the chain, which is useful for notifying a change of state, or the occurrence of an event.
Functions can be internal to the current contract - or they can be external; calling other contracts.
throw allows a contract to be rolled back.
Can use Web3.js to communicate with Ethereum nodes via RPC using JS.
Metamask is a Dapp browser which lets people run Ethereum Dapps in the browser. Injects a Web3 object into FF & Chrome.
Then lots of tedious copy and pasting with no explanations - and lots of outdated commandline examples.
Data feeds which enter data from the real world into smart contracts.
Use TLS Notary to "prove" provenance of the data. But essentially just saying that website X said Y at Z time.
Use of decentralise storage, addressed by hash.