Home Reference Source
public class | source

MiniBlockchainLight

Extends:

inheritBlockchainMiniBlockchainMiniBlockchainAdvanced → MiniBlockchainLight

Light Nodes virtualize prevHash, prevTimestamp and prevDifficultyTarget

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public
public

proofPi: *

Private Members
private
private

Method Summary

Public Methods
public

getBlock(height: *): *

public

getDifficultyTarget(height: *): *

public

getHashPrev(height: *): *

public

getSavingSafePosition(height: *): *

public

getTimeStamp(height: *): *

public

async includeBlockchainBlock(block: *, resetMining: *, socketsAvoidBroadcast: *): Promise<*>

operate the mini-blockchain accountant tree mini-blockchain, will update reward and take in consideration all transactions

public
Private Methods
private
private

_getLoadBlockchainValidationType(indexStart: *, i: *, numBlocks: *, onlyLastBlocks: *): *

private
private

async _loadBlock(indexStart: *, i: *, blockValidation: *): *

private

async _loadBlockchain(): *

Load blocks and check the Accountant Tree

private

async _loadLightSettings(serializationAccountantTreeInitial: *): {"result": boolean, "numBlocks": *, "diffIndex": *}

private

async _onBlockCreated(block: *, saveBlock: *)

private

async _recalculateLightPrevs(height: *, block: *, serialization: *, serializationGzip: *, save: boolean): boolean

It must be last element

private

async _saveLightSettings(diffIndex: *): boolean

Inherited Summary

From class MiniBlockchain
public
public
public
public
public

getBalances(address: *): *

public

async includeBlockchainBlock(block: *, resetMining: *, socketsAvoidBroadcast: *): Promise<*>

operate the mini-blockchain accountant tree mini-blockchain, will update reward and take in consideration all transactions

public

async simulateNewBlock(block: *, revertAutomatically: *, revertActions: *, callback: *, showUpdate: boolean): boolean

private
private

async _loadBlockchain(): *

Load blocks and check the Accountant Tree

From class MiniBlockchainAdvanced
public
public
public
private
public

getSerializedAccountantTree(height: *, gzipped: boolean): *

public

async saveAccountantTree(serialization: *, length: *)

public
private
private
private

async _onBlockCreated(block: *, saveBlock: *)

Public Constructors

public constructor() source

Override:

MiniBlockchainAdvanced#constructor

Public Members

public lightPrevDifficultyTargets: {} source

public lightPrevHashPrevs: {} source

public lightPrevTimeStamps: {} source

public proofPi: * source

Private Members

private _difficultyNotValidated: boolean source

private _lightLoadingDifficultyNextDifficulty: * source

Public Methods

public getBlock(height: *): * source

Params:

NameTypeAttributeDescription
height *

Return:

*

public getDifficultyTarget(height: *): * source

Params:

NameTypeAttributeDescription
height *

Return:

*

public getHashPrev(height: *): * source

Params:

NameTypeAttributeDescription
height *

Return:

*

public getSavingSafePosition(height: *): * source

Params:

NameTypeAttributeDescription
height *

Return:

*

public getTimeStamp(height: *): * source

Params:

NameTypeAttributeDescription
height *

Return:

*

public async includeBlockchainBlock(block: *, resetMining: *, socketsAvoidBroadcast: *): Promise<*> source

operate the mini-blockchain accountant tree mini-blockchain, will update reward and take in consideration all transactions

Override:

MiniBlockchain#includeBlockchainBlock

Params:

NameTypeAttributeDescription
block *
resetMining *
socketsAvoidBroadcast *

Return:

Promise<*>

public async saveBlockchainTerminated(): boolean source

Override:

MiniBlockchainAdvanced#saveBlockchainTerminated

Return:

boolean

Private Methods

private _deleteOldLightSettings() source

private _getLoadBlockchainValidationType(indexStart: *, i: *, numBlocks: *, onlyLastBlocks: *): * source

Params:

NameTypeAttributeDescription
indexStart *
i *
numBlocks *
onlyLastBlocks *

Return:

*

private _initializeMiniBlockchainLight() source

private async _loadBlock(indexStart: *, i: *, blockValidation: *): * source

Params:

NameTypeAttributeDescription
indexStart *
i *
blockValidation *

Return:

*

private async _loadBlockchain(): * source

Load blocks and check the Accountant Tree

Override:

MiniBlockchainAdvanced#_loadBlockchain

Return:

*

boolean

private async _loadLightSettings(serializationAccountantTreeInitial: *): {"result": boolean, "numBlocks": *, "diffIndex": *} source

Params:

NameTypeAttributeDescription
serializationAccountantTreeInitial *

Return:

{"result": boolean, "numBlocks": *, "diffIndex": *}

private async _onBlockCreated(block: *, saveBlock: *) source

Override:

MiniBlockchainAdvanced#_onBlockCreated

Params:

NameTypeAttributeDescription
block *
saveBlock *

private async _recalculateLightPrevs(height: *, block: *, serialization: *, serializationGzip: *, save: boolean): boolean source

It must be last element

Params:

NameTypeAttributeDescription
height *
block *
serialization *
serializationGzip *
save boolean
  • optional
  • default: true

Return:

boolean

private async _saveLightSettings(diffIndex: *): boolean source

Params:

NameTypeAttributeDescription
diffIndex *

Return:

boolean