Go library to access the geth
stored data.
package main
import (
"fmt"
gethdatalayer "github.com/umbracle/geth-data-layer"
)
func main() {
path := "..../chaindata" // path to the storage data
store, err := gethdatalayer.NewStore(path)
if err != nil {
panic(err)
}
iter := store.Iterator()
// iter.Seek(1000000)
for iter.Next() {
val, _ := iter.Value()
fmt.Println(val.Number)
}
}
There are three storage interaces:
NewAncientStore
: Access theancient
store data.NewLevelDbStore
: Access theleveldb
store data.NewStore
: Abstraction on top of theleveldb
andancient
data.