Class: BlockTemplate

BlockTemplate(optsopt)

new BlockTemplate(optsopt)

Initializes a new CryptoNote BlockTemplate object
Parameters:
Name Type Attributes Description
opts BlockTemplate.BlockTemplateConfig <optional>
a configuration object
Source:

Members

activateParentBlockVersion :number

The block major version at which Parent Blocks were enabled
Type:
  • number
Default Value:
  • 2
Source:

block :Block

The block contained in the BlockTemplate
Type:
Source:

blocktemplate :string

The BlockTemplate from the daemon
Type:
  • string
Source:

difficulty :number

The BlockTemplate target difficulty
Type:
  • number
Source:

extraNonce :number

The block extra nonce
Type:
  • number
Source:

height :number

The BlockTemplate height
Type:
  • number
Source:

nonce :number

The block nonce
Type:
  • number
Source:

reservedOffset :number

The BlockTemplate reserved offset
Type:
  • number
Source:

Methods

construct(nonce, branchopt) → {Block}

Reconstructs a full block template using the nonce found by a pool miner by first creating the parent block in the convert method and then merging the two blocks together
Parameters:
Name Type Attributes Description
nonce number The nonce to use in the new block
branch string <optional>
The blockchain branch to use in the new block
Source:
Returns:
the resulting block
Type
Block

convert(blockopt) → {Block}

Converts the block template into a v1 block blob that is used by a compatible miner during its PoW calculations.
Parameters:
Name Type Attributes Description
block Block <optional>
The block to convert
Source:
Returns:
the resulting block
Type
Block

Type Definitions

BlockTemplateConfig

A BlockTemplate Configuration
Type:
  • Object
Properties:
Name Type Attributes Default Description
blocktemplate string The BlockTemplate from the daemon
difficulty number The target difficulty for the BlockTemplate
height number The block height of the BlockTemplate
reservedOffset number The reserved offset of the BlockTemplate
activateParentBlockVersion number <optional>
2 The block major version at which Parent Blocks were enabled
Source: