Home Reference Source Test
public class | source

FullChain

Extends:

ObservableIBlockchainBaseChain → FullChain

Direct Subclass:

LightChain

Indirect Subclass:

PartialLightChain

An anchored, contiguous chain of full blocks.

Static Method Summary

Static Public Methods
public static

createVolatile(accounts: Accounts, time: Time, transactionStore: TransactionStore): Promise<FullChain>

public static

getPersistent(jdb: JungleDB, accounts: Accounts, time: Time, transactionStore: TransactionStore): Promise<FullChain>

Constructor Summary

Public Constructor
public

constructor(store: ChainDataStore, accounts: Accounts, time: Time, transactionStore: TransactionStore): FullChain

Member Summary

Public Members
public get
public get
public get
public get
public get

blockKnownCount: number

public get
public get
public get
public get
public get

height: *

public get
public get
public get
public get

Method Summary

Public Methods
public

accountsHash(): Promise<Hash>

public

async getAccountsProof(blockHash: Hash, addresses: Array<Address>): PromiseAccountsProof>

public

async getAccountsTreeChunk(blockHash: Hash, startPrefix: string): PromiseAccountsTreeChunk>

public

getBlockProof(blockToProve: Block, knownBlock: Block): PromiseBlockChain>

public

getBlocks(startBlockHash: Hash, count: number, forward: boolean): Promise<Array<Block>>

public
public

async getTransactionInfoByHash(transactionHash: Hash): PromiseTransactionStoreEntry>

public

async getTransactionReceiptsByAddress(address: Address, limit: number): Promise<Array<TransactionReceipt>>

public

async getTransactionsProof(blockHash: Hash, addresses: Array<Address>): PromiseTransactionsProof>

public

pushBlock(block: Block): Promise<number>

Protected Methods
protected

async _init(): Promise<FullChain>

protected

async _pushBlock(block: Block): Promise<number>

protected

async _rebranch(blockHash: Hash, chainData: ChainData): Promise<boolean>

protected

async _verifyInterlink(block: Block): 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!

Static Public Methods

public static createVolatile(accounts: Accounts, time: Time, transactionStore: TransactionStore): Promise<FullChain> source

Params:

NameTypeAttributeDescription
accounts Accounts
time Time
transactionStore TransactionStore
  • optional

Return:

Promise<FullChain>

public static getPersistent(jdb: JungleDB, accounts: Accounts, time: Time, transactionStore: TransactionStore): Promise<FullChain> source

Params:

NameTypeAttributeDescription
jdb JungleDB
accounts Accounts
time Time
transactionStore TransactionStore
  • optional

Return:

Promise<FullChain>

Public Constructors

public constructor(store: ChainDataStore, accounts: Accounts, time: Time, transactionStore: TransactionStore): FullChain source

Override:

BaseChain#constructor

Params:

NameTypeAttributeDescription
store ChainDataStore
accounts Accounts
time Time
transactionStore TransactionStore
  • optional

Return:

FullChain

Public Members

public get accounts: Accounts source

public get blockExtendedCount: number source

public get blockForkedCount: number source

public get blockInvalidCount: number source

public get blockKnownCount: number source

public get blockOrphanCount: number source

public get blockRebranchedCount: number source

public get head: Block source

Override:

IBlockchain#head

public get headHash: Hash source

Override:

IBlockchain#headHash

public get height: * source

Override:

IBlockchain#height

public get queue: PrioritySynchronizer source

public get totalDifficulty: BigNumber source

public get totalWork: BigNumber source

public get transactionCache: TransactionCache source

Public Methods

public accountsHash(): Promise<Hash> source

Return:

Promise<Hash>

public async getAccountsProof(blockHash: Hash, addresses: Array<Address>): PromiseAccountsProof> source

Params:

NameTypeAttributeDescription
blockHash Hash
addresses Array<Address>

Return:

PromiseAccountsProof>

public async getAccountsTreeChunk(blockHash: Hash, startPrefix: string): PromiseAccountsTreeChunk> source

Params:

NameTypeAttributeDescription
blockHash Hash
startPrefix string

Return:

PromiseAccountsTreeChunk>

public getBlockProof(blockToProve: Block, knownBlock: Block): PromiseBlockChain> source

Params:

NameTypeAttributeDescription
blockToProve Block
knownBlock Block

Return:

PromiseBlockChain>

public getBlocks(startBlockHash: Hash, count: number, forward: boolean): Promise<Array<Block>> source

Params:

NameTypeAttributeDescription
startBlockHash Hash
count number
forward boolean

Return:

Promise<Array<Block>>

public getChainProof(): Promise<ChainProof> source

Return:

Promise<ChainProof>

public async getTransactionInfoByHash(transactionHash: Hash): PromiseTransactionStoreEntry> source

Params:

NameTypeAttributeDescription
transactionHash Hash

Return:

PromiseTransactionStoreEntry>

public async getTransactionReceiptsByAddress(address: Address, limit: number): Promise<Array<TransactionReceipt>> source

Params:

NameTypeAttributeDescription
address Address
limit number
  • optional
  • nullable: true

Return:

Promise<Array<TransactionReceipt>>

public async getTransactionsProof(blockHash: Hash, addresses: Array<Address>): PromiseTransactionsProof> source

Params:

NameTypeAttributeDescription
blockHash Hash
addresses Array<Address>

Return:

PromiseTransactionsProof>

public pushBlock(block: Block): Promise<number> source

Params:

NameTypeAttributeDescription
block Block

Return:

Promise<number>

Protected Methods

protected async _init(): Promise<FullChain> source

Return:

Promise<FullChain>

protected async _pushBlock(block: Block): Promise<number> source

Params:

NameTypeAttributeDescription
block Block

Return:

Promise<number>

protected async _rebranch(blockHash: Hash, chainData: ChainData): Promise<boolean> source

Params:

NameTypeAttributeDescription
blockHash Hash
chainData ChainData

Return:

Promise<boolean>

Params:

NameTypeAttributeDescription
block Block

Return:

Promise<boolean>