UNPKG

691 BJavaScriptView Raw
1const EthJSBlock = require('ethereumjs-block')
2const ethJSUtil = require('ethereumjs-util')
3const BN = ethJSUtil.BN
4
5function generateBlock (executionContext) {
6 const block = new EthJSBlock({
7 header: {
8 timestamp: (new Date().getTime() / 1000 | 0),
9 number: 0,
10 coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a',
11 difficulty: (new BN('69762765929000', 10)),
12 gasLimit: new BN('8000000').imuln(1)
13 },
14 transactions: [],
15 uncleHeaders: []
16 })
17
18 executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => {
19 executionContext.addBlock(block)
20 })
21}
22
23module.exports = generateBlock