Commit 5be4ecb4 authored by George Hotz's avatar George Hotz

need txs and uncles also

parent ca0d6c8f
......@@ -8,6 +8,14 @@ const rlp = require('rlp')
// local geth
const provider = new ethers.providers.JsonRpcProvider('http://192.168.1.213:8545')
/*
type extblock struct {
Header *Header
Txs []*Transaction
Uncles []*Header
}
*/
function getBlockRlp(block : any) {
let dat = [
block['parentHash'],
......@@ -37,6 +45,7 @@ async function main() {
let blockData = await provider.send("eth_getBlockByNumber", ["0x"+(blockNumber).toString(16), true])
const blockHeaderRlp = getBlockRlp(blockData)
assert(keccak256(blockHeaderRlp) == blockData['hash'])
fs.writeFileSync(`data/block_${blockNumber}`, blockHeaderRlp)
}
......
......@@ -2,17 +2,30 @@ package main
import (
"fmt"
"os"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
)
func main() {
bc := &core.BlockChain{}
//engine := ethash.NewFullFaker()
statedb := &state.StateDB{}
vmconfig := vm.Config{}
processor := core.NewStateProcessor(params.MainnetChainConfig, bc, nil)
fmt.Println("made state processor")
processor.Process()
f, _ := os.Open("../data/block_block_13247502")
defer f.Close()
block := &types.Block{}
block.DecodeRLP(rlp.NewStream(f, 0))
fmt.Println("read block RLP")
processor.Process(block, statedb, vmconfig)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment