Skip to content

Conversation

@micahriggan
Copy link
Owner

@micahriggan micahriggan commented Aug 22, 2018

Currently

This branch can connect to an ethereum node and start requesting blocks

geth --rinkeby --verbosity 4 --netrestrict 127.0.0.0/8

Currently working on storing the blocks by changing addBlock and processTransaction to operate on the IBlock and ITransaction types.

In addition to the properties on those types, there is a bucket property that holds chain specific data.

Data added to the bucket property will be stored on blocks, transactions, and coins.

This should allow us to store chain specific data while maintaining one block and transaction model.

Todo

Get balances by processing state transitions in EVM

Config

  "ETH": {
    "RINKEBY": {
      "chainSource": "p2p",
      "trustedPeers": [{
        "host": "127.0.0.1",
        "port": 30303
      }],
      "rpc": {
        "host": "127.0.0.1",
        "port": 8545
      }
    }
  },

State

In order to generate the current ethereum state, we must start an EVM with the genesis state, and then run each transaction through the EVM in order to get the new state. The new state's stateroot should match a block's stateroot.

https://github.com/ethereumjs/ethereumjs-vm/blob/master/examples/run-blockchain/index.js

Once we've calculated a state, we can write it to an ETH state collection.

Calculating state can be done after sync, or during sync

The following are example loops with optional logic in brackets.

Sync Loop

  • -> getHeaders -> getBlock -> write block and transactions ->[ vm.runBlock -> write state] -> *

State Loop

  • ->findBlock -> findTransactions -> vim.runBlock -> write state -> *

@micahriggan micahriggan changed the title Ethereum Sync Support WIP: Ethereum Sync Support Aug 22, 2018
micahriggan pushed a commit that referenced this pull request Oct 24, 2019
micahriggan pushed a commit that referenced this pull request May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants