Types
The go-ethereum
project defines 57 types. Only some of them are discussed in this documentation.
This section describes critical data structures used in go-ethereum
. The main categories of types defined by this documentation are:
- Common – foundational types used throughout
- Database – defines blockchain data structures
- Peer to Peer – defines Ethereum nodes
- Smart Contract – defines data structures for smart contracts
Public / Private Visibility
Remember, publicly visible methods and properties in Go (those that are exported) are denoted by having names that start with a capital letter. Private scope is denoted by names starting with a lower-case letter.
If a data structure / type has no publicly visible data members, the only way to access its properties from other packages are via public methods.
Incantation: Counting Types
The following incantation reports the number of types in the go-ethereum
project:
grep -rIhw --include \*.go "^\s*Type\s*" | \
tr -d ',' | tr -d ':' | sed 's^//.*^^' | awk '{$1=$1};1' | \
sort | uniq | wc -l