git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: d40898a1c0e4f37c6b28da6da6646db86398ebcb

Files: d40898a1c0e4f37c6b28da6da6646db86398ebcb / block.js

669 bytesRaw
1//
2// This class parses a serialised Ethereum Block
3//
4// The input is a Buffer.
5//
6const Address = require('./address.js')
7const ethUtil = require('ethereumjs-util')
8const OldBlock = require('ethereumjs-block')
9const U256 = require('./u256.js')
10
11module.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