sealed trait BlockHeader extends NetworkElement
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce values to make the block's hash satisfy proof-of-work requirements. When they solve the proof-of-work, they broadcast the block to everyone and the block is added to the block chain. The first transaction in the block is a special one that creates a new coin owned by the creator of the block.
- See also
Bitcoin Developer reference: https://bitcoin.org/en/developer-reference#block-headers
Bitcoin Core implementation: https://github.com/bitcoin/bitcoin/blob/master/src/primitives/block.h#L20
- Alphabetic
- By Inheritance
- BlockHeader
- NetworkElement
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def merkleRootHash: DoubleSha256Digest
A
SHA256(SHA256())
hash in internal byte order.A
SHA256(SHA256())
hash in internal byte order. The merkle root is derived from the hashes of all transactions included in this block, ensuring that none of those transactions can be modified without modifying the header.- returns
the merkle root of the merkle tree
- See also
https://bitcoin.org/en/developer-reference#merkle-trees
- abstract def nBits: UInt32
An encoded version of the target threshold this block’s header hash must be less than or equal to.
An encoded version of the target threshold this block’s header hash must be less than or equal to.
- See also
See the nBits format described below. https://bitcoin.org/en/developer-reference#target-nbits
- abstract def nonce: UInt32
An arbitrary number miners change to modify the header hash in order to produce a hash below the target threshold.
An arbitrary number miners change to modify the header hash in order to produce a hash below the target threshold. If all 32-bit values are tested, the time can be updated or the coinbase transaction can be changed and the merkle root updated.
- returns
the nonce used to try and solve a block
- abstract def previousBlockHash: DoubleSha256Digest
A SHA256(SHA256()) hash in internal byte order of the previous block’s header.
A SHA256(SHA256()) hash in internal byte order of the previous block’s header. This ensures no previous block can be changed without also changing this block’s header.
- returns
the previous block's hash
- abstract def time: UInt32
The block time is a Unix epoch time when the miner started hashing the header (according to the miner).
The block time is a Unix epoch time when the miner started hashing the header (according to the miner). Must be greater than or equal to the median time of the previous 11 blocks. Full nodes will not accept blocks with headers more than two hours in the future according to their clock.
- returns
the time when the miner started solving the block
- abstract def version: Int32
The block version number indicates which set of block validation rules to follow.
The block version number indicates which set of block validation rules to follow. See the list of block versions below.
- returns
the version number for this block
- See also
BIP9 for more information on what version number signify https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def byteSize: Long
The size of the NetworkElement in bytes.
The size of the NetworkElement in bytes.
- Definition Classes
- NetworkElement
- lazy val bytes: ByteVector
The byte representation of the NetworkElement
The byte representation of the NetworkElement
- Definition Classes
- BlockHeader → NetworkElement
- def bytesLE: ByteVector
The byte representation of the NetworkElement in little endian
The byte representation of the NetworkElement in little endian
- Definition Classes
- NetworkElement
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def difficulty: BigInt
This is the decoded version of nBits.
This is the decoded version of nBits. nBits is used to compactly represent the difficulty target for the bitcoin network. This field is the expanded version that is the _actual_ requirement needed for the network. This is a 256 bit unsigned integer See the bitcoin developer reference for more information on how this is constructed documentation
The hash of this block needs to be _less than_ this difficulty to be considered a valid block on the network
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- lazy val hash: DoubleSha256Digest
Returns the block's hash in the protocol level little endian encoding
- lazy val hashBE: DoubleSha256DigestBE
Returns the block hash in big endian format, this is useful for rpc and block explorer debugging.
Returns the block hash in big endian format, this is useful for rpc and block explorer debugging. This is *not* used in the core protocol itself. See this link for more info https://bitcoin.stackexchange.com/questions/2063/why-does-the-bitcoin-protocol-use-the-little-endian-notation
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hex: String
The hexadecimal representation of the NetworkElement
The hexadecimal representation of the NetworkElement
- Definition Classes
- NetworkElement
- def hexLE: String
The hexadecimal representation of the NetworkElement in little endian
The hexadecimal representation of the NetworkElement in little endian
- Definition Classes
- NetworkElement
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def merkleRootHashBE: DoubleSha256DigestBE
Returns the merkle root hash in BIG ENDIAN format.
Returns the merkle root hash in BIG ENDIAN format. This is not compatible with the bitcoin protocol but it is useful for rpc clients and block explorers
- See also
this link for more info https://bitcoin.stackexchange.com/questions/2063/why-does-the-bitcoin-protocol-use-the-little-endian-notation
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def previousBlockHashBE: DoubleSha256DigestBE
Returns the big endian encoding of the previous block hash This is useful for using rpc and block exporers, but is NOT used in the protocol itself
Returns the big endian encoding of the previous block hash This is useful for using rpc and block exporers, but is NOT used in the protocol itself
- See also
see this Stack Exchange question for more: https://bitcoin.stackexchange.com/questions/2063/why-does-the-bitcoin-protocol-use-the-little-endian-notation
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- BlockHeader → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()