Home Reference Source Test
public class | source

LightChain

Extends:

ObservableIBlockchainBaseChainFullChain → LightChain

Direct Subclass:

PartialLightChain

A LightChain is initialized by using NiPoPoWs instead of the full blockchain history, but after initialization, it behaves as a regular full blockchain.

Static Method Summary

Static Public Methods
public static

createVolatile(accounts: Accounts, time: Time): Promise<LightChain>

public static

getPersistent(jdb: JungleDB, accounts: Accounts, time: Time): Promise<LightChain>

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public
Protected Methods
protected

async _init(): *

Inherited Summary

From class Observable
public static get

WILDCARD: string: string

public

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

public

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

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!

From class FullChain
public static

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

public static

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

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
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 getTransactionReceiptsByHashes(hashes: Array<Hash>, limit: number): Promise<?Array<TransactionReceipt>>

public

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

this method was deprecated.
public

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

public

async getTransactionsProofByHashes(blockHash: Hash, hashes: Array<Hash>): PromiseTransactionsProof>

public

pushBlock(block: Block): Promise<number>

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>

Static Public Methods

public static createVolatile(accounts: Accounts, time: Time): Promise<LightChain> source

Override:

FullChain#createVolatile

Params:

NameTypeAttributeDescription
accounts Accounts
time Time

Return:

Promise<LightChain>

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

Override:

FullChain#getPersistent

Params:

NameTypeAttributeDescription
jdb JungleDB
accounts Accounts
time Time

Return:

Promise<LightChain>

Public Constructors

public constructor(store: ChainDataStore, accounts: Accounts, time: Time): PartialLightChain source

Override:

FullChain#constructor

Params:

NameTypeAttributeDescription
store ChainDataStore
accounts Accounts
time Time

Public Methods

public async partialChain(): PartialLightChain source

Protected Methods

protected async _init(): * source

Override:

FullChain#_init

Return:

*