remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/libs/remix-simulator/src/genesis.ts

22 lines
730 B

import { Block } from '@ethereumjs/block'
4 years ago
import { BN } from 'ethereumjs-util'
export function generateBlock (vmContext) {
return new Promise((resolve, reject) => {
const block: Block = Block.fromBlockData({
header: {
timestamp: (new Date().getTime() / 1000 | 0),
number: 0,
coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a',
difficulty: new BN('69762765929000', 10),
gasLimit: new BN('8000000').imuln(1)
}
}, { common: vmContext.vmObject().common })
4 years ago
vmContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => {
vmContext.addBlock(block)
resolve({})
}).catch((e) => reject(e))
4 years ago
})
}