Files: de14490c984932fcb886b69855e66ae6d5ba7dac / deps / block.js
669 bytesRaw
1 | // |
2 | // This class parses a serialised Ethereum Block |
3 | // |
4 | // The input is a Buffer. |
5 | // |
6 | const Address = require('./address.js') |
7 | const ethUtil = require('ethereumjs-util') |
8 | const OldBlock = require('ethereumjs-block') |
9 | const U256 = require('./u256.js') |
10 | |
11 | module.exports = class Block extends OldBlock { |
12 | get number () { |
13 | return ethUtil.bufferToInt(this.header.number) |
14 | } |
15 | |
16 | get gasLimit () { |
17 | return ethUtil.bufferToInt(this.header.gasLimit) |
18 | } |
19 | |
20 | get difficulty () { |
21 | return new U256(this.header.difficulty) |
22 | } |
23 | |
24 | get timestamp () { |
25 | return ethUtil.bufferToInt(this.header.timestamp) |
26 | } |
27 | |
28 | get coinbase () { |
29 | return new Address(this.header.coinbase) |
30 | } |
31 | } |
32 |
Built with git-ssb-web