Welcome to the world of decentralized blockchain. This book guides you through interacting with Ethereum and other EVM-compatible chains using Golang and the go-ethereum SDK: querying on-chain data, sending transactions, parsing contract storage slots, cryptography utilities, and building your own private POA chain.
This book is not for complete beginners.
I expect you to be an experienced developer who has programmed in any programming language. It'll also be helpful if you know the syntax of Solidity. If not, it's not a big problem: check out the companion Solidity Book first, then come back.
However, this book is for blockchain beginners.
If you only heard about blockchains and were interested but haven't had a chance to dive deeper, this book is for you! You'll learn how to query and send transactions on chains, how contract storage works under the hood, and how to run and test a private chain on your computer.
Alright, let's get started!
- This book is hosted on GitHub: https://github.com/yuhuajing/web3-development-with-go-book
- Page: https://yuhuajing.github.io/web3-development-with-go-book/index.html
- Milestone 0. Golang BaseGround
- init / slice / map / channel / func / defer
- GMP / GC
- random / database (MySQL, MongoDB) / opFile / interactive input (huh)
- Milestone 1. 查询链上数据
- initConn
- accountBalance / accountCodes / generateAccount
- getBlocks / getTransactions
- subscribe newHead / pendingTransactions / filterLogs
- Milestone 2. 发送链上交易
- sendValueByRawTransaction
- estimateGas
- writeContractByRawTx / readSmartContract / writeContractByAbi
- Milestone 3. 解析合约 slot 数据
- slot
- static types: uint / int / bool / address / bytes / array / struct
- dynamic types: array / string / mapping
- Milestone 4. 二进制树和椭圆曲线加解密
- merkleTree
- signature
- Milestone 5. 创建私有区块链
- build geth
- geth console (node 1 / node 2)
- connect wallet
To run the book locally:
- Install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Install mdBook:
cargo install mdbook
cargo install mdbook-katex- Clone the repo:
git clone https://github.com/yuhuajing/web3-development-with-go-book.git
cd web3-development-with-go-book
mdbook serve --open- Visit http://localhost:3000/