2020-11-26 10:31:29 +00:00
|
|
|
# eth-statediff-service
|
2020-08-23 20:00:11 +00:00
|
|
|
|
|
|
|
[![Go Report Card](https://goreportcard.com/badge/github.com/vulcanize/eth-statediff-service)](https://goreportcard.com/report/github.com/vulcanize/eth-statediff-service)
|
|
|
|
|
2020-08-19 06:07:34 +00:00
|
|
|
>> standalone statediffing service ontop of leveldb
|
|
|
|
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Stand up a statediffing service directly on top of a go-ethereum leveldb instance.
|
|
|
|
This service can serve historical state data over the same rpc interface as
|
|
|
|
[statediffing geth](https://github.com/vulcanize/go-ethereum/releases/tag/v1.9.11-statediff-0.0.5) without needing to run a full node
|
|
|
|
|
2020-11-26 10:31:29 +00:00
|
|
|
## Usage
|
2020-08-19 06:07:34 +00:00
|
|
|
|
2020-12-03 02:08:20 +00:00
|
|
|
### `serve`
|
|
|
|
|
2020-11-26 10:31:29 +00:00
|
|
|
To serve state diffs over RPC:
|
2020-08-19 06:07:34 +00:00
|
|
|
|
2020-11-26 10:31:29 +00:00
|
|
|
`eth-statediff-service serve --config=<config path>`
|
|
|
|
|
|
|
|
Available RPC methods are:
|
|
|
|
* `statediff_stateTrieAt()`
|
|
|
|
* `statediff_streamCodeAndCodeHash()`
|
|
|
|
* `statediff_stateDiffAt()`
|
|
|
|
* `statediff_writeStateDiffAt()`
|
|
|
|
|
2020-12-03 02:08:20 +00:00
|
|
|
### `write`
|
|
|
|
|
2020-11-26 10:31:29 +00:00
|
|
|
To write state diffs directly to a database:
|
|
|
|
|
|
|
|
`eth-statediff-service write --config=<config path>`
|
|
|
|
|
|
|
|
This depends on the `database` settings being properly configured.
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
An example config file:
|
2020-08-19 06:07:34 +00:00
|
|
|
|
|
|
|
```toml
|
|
|
|
[leveldb]
|
|
|
|
path = "/Users/user/Library/Ethereum/geth/chaindata"
|
|
|
|
ancient = "/Users/user/Library/Ethereum/geth/chaindata/ancient"
|
|
|
|
|
|
|
|
[server]
|
|
|
|
ipcPath = "~/.vulcanize/vulcanize.ipc"
|
|
|
|
httpPath = "127.0.0.1:8545"
|
|
|
|
|
2020-11-26 10:31:29 +00:00
|
|
|
[write]
|
|
|
|
ranges = [[1, 2], [3, 4]]
|
|
|
|
[write.params]
|
|
|
|
IntermediateStateNodes = true
|
|
|
|
IntermediateStorageNodes = false
|
|
|
|
IncludeBlock = true
|
|
|
|
IncludeReceipts = true
|
|
|
|
IncludeTD = true
|
|
|
|
IncludeCode = false
|
|
|
|
|
|
|
|
[statediff]
|
|
|
|
workers = 4
|
|
|
|
|
2020-08-19 06:07:34 +00:00
|
|
|
[log]
|
2020-11-26 10:31:29 +00:00
|
|
|
file = "~/.vulcanize/statediff.log"
|
2020-08-19 06:07:34 +00:00
|
|
|
level = "info"
|
|
|
|
|
|
|
|
[eth]
|
|
|
|
chainID = 1
|
2020-11-26 10:31:29 +00:00
|
|
|
|
2020-08-19 06:07:34 +00:00
|
|
|
```
|