Home Reference Source Test
public class | source

NanoChain

Extends:

ObservableIBlockchainBaseChain → NanoChain

Constructor Summary

Public Constructor
public

constructor(time: Time): Promise<NanoChain>

Member Summary

Public Members
public get
public get
public get

height: number

Method Summary

Public Methods
public
public

pushHeader(header: BlockHeader): Promise<number>

public

pushProof(proof: ChainProof): Promise<boolean>

Inherited Summary

From class Observable
public static get

WILDCARD: string: string

public

bubble(observable: Observable, types: ...string)

public

fire(type: string, args: ...*): Promise | null

public

off(type: string, id: number)

public

on(type: string, callback: Function): number

From class IBlockchain
public get abstract
public get abstract
public get abstract

height: number

From class BaseChain
public static

async isBetterProof(proof1: ChainProof, proof2: ChainProof, m: number): Promise<boolean>

public static

async manyPow(headers: Array<BlockHeader>): Promise<void>

protected static

async _getProofScore(chain: BlockChain, lca: Block, m: number): Promise<number>

public

async getBlock(hash: Hash, includeForks: boolean, includeBody: boolean): PromiseBlock>

public

getBlockAt(height: number, includeBody: boolean): PromiseBlock>

public

async getBlockLocators(): Promise<Array<Hash>>

public

getNearestBlockAt(height: number, lower: boolean): PromiseBlock>

public

async getNextTarget(block: Block, next: Block): Promise<BigNumber>

Computes the target value for the block after the given block or the head of this chain if no block is given.

public

getRawBlock(hash: Hash, includeForks: boolean): PromiseUint8Array>

public

async getSuccessorBlocks(block: Block): Promise<Array<Block>>

protected

async _extendChainProof(proof: ChainProof, header: BlockHeader, failOnBadness: boolean): Promise<ChainProof>

protected

async _getBlockProof(blockToProve: Block, knownBlock: Block): PromiseBlockChain>

MUST be synchronized with .pushBlock() and variants!

protected

MUST be synchronized with .pushBlock() and variants!

Public Constructors

public constructor(time: Time): Promise<NanoChain> source

Override:

BaseChain#constructor

Params:

NameTypeAttributeDescription
time Time

Return:

Promise<NanoChain>

Public Members

public get head: Block source

Override:

IBlockchain#head

public get headHash: Hash source

Override:

IBlockchain#headHash

public get height: number source

Override:

IBlockchain#height

Public Methods

public getChainProof(): Promise<ChainProof> source

Return:

Promise<ChainProof>

public pushHeader(header: BlockHeader): Promise<number> source

Params:

NameTypeAttributeDescription
header BlockHeader

Return:

Promise<number>

public pushProof(proof: ChainProof): Promise<boolean> source

Params:

NameTypeAttributeDescription
proof ChainProof

Return:

Promise<boolean>