https://github.com/umbracle/geth-data-layer
Go library to access the blockchain state of Go-ethereum
https://github.com/umbracle/geth-data-layer
blockchain data geth
Last synced: 3 months ago
JSON representation
Go library to access the blockchain state of Go-ethereum
- Host: GitHub
- URL: https://github.com/umbracle/geth-data-layer
- Owner: umbracle
- License: mpl-2.0
- Created: 2022-09-28T13:50:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-14T10:52:46.000Z (over 2 years ago)
- Last Synced: 2025-04-17T16:03:22.084Z (3 months ago)
- Topics: blockchain, data, geth
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 16
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Geth-data-layer
Go library to access the [`geth`](https://github.com/ethereum/go-ethereum) stored data.
## Usage
```go
package mainimport (
"fmt"gethdatalayer "github.com/umbracle/geth-data-layer"
)func main() {
path := "..../chaindata" // path to the storage datastore, 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 the `ancient` store data.
- `NewLevelDbStore`: Access the `leveldb` store data.
- `NewStore`: Abstraction on top of the `leveldb` and `ancient` data.