Introduction
In episode 9, Bill introduced the idea of the genesis record and its role in his blockchain. As a recap, the genesis record will be used to customize the settings of his blockchain. The approach Bill takes here is similar to how Ethereum operates because he is storing the record in JSON format.
In this video, Bill starts by defining the Go types his blockchain will use. The first type he defines will represent the genesis record. This type will be populated by the data found in the genesis record and will ensure Bill reaps all the benefits of using strongly typed language. Before he proceeds with the next type definition, he highlights the possible limitations he can encounter by using type uint64
. Watch to learn how to write idiomatic and durable Go code that will load your blockchain’s settings from disk.
Things you will learn in this video
- Map JSON data for a Go struct.
- Load a JSON from disk onto a Go struct.
- Determine the right built-in type to use for a struct field.
Video