Files: 7ac30606a95e63244d5792a232ae3d353b000054 / block.js
646 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 | |
10 | module.exports = class Block extends OldBlock { |
11 | get number () { |
12 | return ethUtil.bufferToInt(this.header.number) |
13 | } |
14 | |
15 | get gasLimit () { |
16 | return ethUtil.bufferToInt(this.header.gasLimit) |
17 | } |
18 | |
19 | get difficulty () { |
20 | return ethUtil.bufferToInt(this.header.difficulty) |
21 | } |
22 | |
23 | get timestamp () { |
24 | return ethUtil.bufferToInt(this.header.timestamp) |
25 | } |
26 | |
27 | get coinbase () { |
28 | return new Address(this.header.coinbase) |
29 | } |
30 | } |
31 |
Built with git-ssb-web