Skip to content

web3mirror/sf-ethereum

 
 

Repository files navigation

Ethereum on StreamingFast

reference License

Requirements (clone repos, build stuff...)

Install Geth

git clone git@github.com:streamingfast/go-ethereum.git
cd go-ethereum
git checkout release/geth-1.10.x-dm
go install ./cmd/geth
go install ./cmd/bootnode

Install sfeth

git clone git@github.com:streamingfast/sf-ethereum.git
cd sf-ethereum
go install ./cmd/sfeth

Quickstart, connecting to an existing chain

  • Start from a clean folder

  • Create a file named sf.yaml and put the following content:

    start:
    args:
    - merger
    - firehose
    - mindreader-node
    - relayer
    flags:
      common-chain-id: "1"
      common-network-id: "1"
      mindreader-node-bootstrap-data-url: ./mindreader/genesis.json
      mindreader-node-log-to-zap: false
      mindreader-node-arguments: "+--bootnodes=enode://<enode1>@<ip>:<port>,enode://<enode2>@<ip>:<port>"
    

    Note Up to date boot nodes info for Geth supported network(s) can be found here.

  • Create a folder mindreader

  • Copy the genesis.json file of the chain into the mindreader folder.

    Note It's possible to use geth dumpgenesis to dump actual genesis file to disk

    • Mainnet - geth --mainnet dumpgenesis > ./mindreader/genesis.json
    • Ropsten - geth --ropsten dumpgenesis > ./mindreader/genesis.json
    • Goerli - geth --goerli dumpgenesis > ./mindreader/genesis.json
    • Rinkeby - geth --rinkeby dumpgenesis > ./mindreader/genesis.json
  • sfeth start -vv

    Note It's recommended to launch with -vv the first time to more easily see what's happening under the hood.

  • Wait around a minute leaving enough time for the Geth process to start the syncing process. You should then have some merged blocks under ./sf-data/storage/merged-blocks. You should also be able to test that Firehose is able to stream some blocks to you.

    grpcurl -insecure -import-path ../proto -import-path ../proto-ethereum -proto dfuse/ethereum/codec/v1/codec.proto -proto dfuse/bstream/v1/bstream.proto -d '{"start_block_num": -1}' 127.0.0.1:13042 dfuse.bstream.v1.BlockStreamV2.Blocks

    Note You will need to have grpcurl and a clone of both https://github.com/streamingfast/proto and https://github.com/streamingfast/proto-ethereum, we assume they are sibling of the folder you are currently in, adjust -import-path ... flags in the command above to where the files are located.

Release

Use the ./bin/release.sh Bash script to perform a new release. It will ask you questions as well as driving all the required commands, performing the necessary operation automatically. The Bash script runs in dry-mode by default, so you can check first that everything is all right.

Releases are performed using goreleaser.

Contributing

Issues and PR in this repo related strictly to the Ethereum on StreamingFast.

Report any protocol-specific issues in their respective repositories

Please first refer to the general StreamingFast contribution guide, if you wish to contribute to this code base.

This codebase uses unit tests extensively, please write and run tests.

License

Apache 2.0

Packages

No packages published

Languages

  • Go 94.9%
  • Shell 4.9%
  • Dockerfile 0.2%