Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
5be4ecb4
Commit
5be4ecb4
authored
Sep 17, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
need txs and uncles also
parent
ca0d6c8f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
get_block.ts
helpers/get_block.ts
+9
-0
main.go
minigeth/main.go
+14
-1
No files found.
helpers/get_block.ts
View file @
5be4ecb4
...
...
@@ -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
)
}
...
...
minigeth/main.go
View file @
5be4ecb4
...
...
@@ -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
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment