import InterfaceBlockchain from 'node-webdollar/src/common/blockchain/interface-blockchain/blockchain/Interface-Blockchain.js'
InterfaceBlockchain
Extends:
Blockchain contains a chain of blocks based on Proof of Work
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
freeMemory: * |
|
public |
hardForks: * |
Method Summary
Public Methods | ||
public |
|
|
public |
getBlock(height: *): * |
|
public |
getDifficultyTarget(height: *): * |
|
public |
getHashPrev(height: *): * |
|
public |
getTimeStamp(height: *): * |
|
public |
async includeBlockchainBlock(block: *, resetMining: *, socketsAvoidBroadcast: *): Promise<boolean> Include a new block at the end of the blockchain, by validating the next block Will save the block in the blockchain, if it is valid |
|
public |
async removeBlockchain(index: *, removeFiles: boolean): boolean |
|
public |
async saveBlockchain(startingHeight: *, endingHeight: *): boolean |
|
public |
async saveBlockchainTerminated(): Promise<boolean> Save Blockchain when the application was terminated |
|
public |
async saveNewBlock(block: *, saveLength: boolean, saveInfinitum: boolean): boolean |
|
public |
async simulateNewBlock(block: *, revertAutomatically: *, revertActions: *, callback: *, showUpdate: boolean): * |
|
public |
async validateBlockchain(): boolean |
|
public |
async validateBlockchainBlock(block: *, prevDifficultyTarget: *, prevHash: *, prevTimeStamp: *, blockValidationType: *): Promise<boolean> Validate the block, but the Block WAS NOT ADDED in the blockchain array |
Private Methods | ||
private |
async _blockIncluded(block: *) |
|
private |
_getLoadBlockchainValidationType(indexStart: *, i: *, numBlocks: *, indexStartProcessingOffset: *): * |
|
private |
async _loadBlock(indexStart: *, i: *, blockValidation: *): * |
|
private |
async _loadBlockchain(indexStartLoadingOffset: *, indexStartProcessingOffset: *, numBlocks: *): * |
|
private |
_onBlockCreated(block: *, saveBlock: *) Event fired when a new Block has been inserted in the blockchain |
Inherited Summary
From class InterfaceBlockchainBasic | ||
public |
agent: * |
|
public |
blockCreator: * |
|
public |
blocks: * |
|
public |
db: * |
|
public |
|
|
public |
mining: * |
|
public |
|
|
public |
|
|
public |
timestamp: * |
|
public |
|
|
public |
transactions: * |
|
private |
|
|
private |
|
|
public |
async loadBlockchain(): * |
|
public |
sleep(ms: *): * |
|
public |
toJSON() |
|
public |
toString() |
|
private |
|
|
private |
async _loadBlockchain(): boolean |
|
private |
_setAgent(newAgent: *) |
Public Constructors
Public Methods
public getDifficultyTarget(height: *): * source
Params:
Name | Type | Attribute | Description |
height | * |
Return:
* |
public async includeBlockchainBlock(block: *, resetMining: *, socketsAvoidBroadcast: *): Promise<boolean> source
Include a new block at the end of the blockchain, by validating the next block Will save the block in the blockchain, if it is valid
Params:
Name | Type | Attribute | Description |
block | * | ||
resetMining | * | ||
socketsAvoidBroadcast | * |
public async removeBlockchain(index: *, removeFiles: boolean): boolean source
Params:
Name | Type | Attribute | Description |
index | * | ||
removeFiles | boolean |
|
public async saveBlockchain(startingHeight: *, endingHeight: *): boolean source
Params:
Name | Type | Attribute | Description |
startingHeight | * | ||
endingHeight | * |
public async saveBlockchainTerminated(): Promise<boolean> source
Save Blockchain when the application was terminated
public async simulateNewBlock(block: *, revertAutomatically: *, revertActions: *, callback: *, showUpdate: boolean): * source
Params:
Name | Type | Attribute | Description |
block | * | ||
revertAutomatically | * | ||
revertActions | * | ||
callback | * | ||
showUpdate | boolean |
|
Return:
* |
public async validateBlockchainBlock(block: *, prevDifficultyTarget: *, prevHash: *, prevTimeStamp: *, blockValidationType: *): Promise<boolean> source
Validate the block, but the Block WAS NOT ADDED in the blockchain array
Params:
Name | Type | Attribute | Description |
block | * | ||
prevDifficultyTarget | * | ||
prevHash | * | ||
prevTimeStamp | * | ||
blockValidationType | * |
Private Methods
private async _blockIncluded(block: *) source
Params:
Name | Type | Attribute | Description |
block | * |
private _getLoadBlockchainValidationType(indexStart: *, i: *, numBlocks: *, indexStartProcessingOffset: *): * source
Params:
Name | Type | Attribute | Description |
indexStart | * | ||
i | * | ||
numBlocks | * | ||
indexStartProcessingOffset | * |
Return:
* |
private async _loadBlock(indexStart: *, i: *, blockValidation: *): * source
Params:
Name | Type | Attribute | Description |
indexStart | * | ||
i | * | ||
blockValidation | * |
Return:
* |
private async _loadBlockchain(indexStartLoadingOffset: *, indexStartProcessingOffset: *, numBlocks: *): * source
Params:
Name | Type | Attribute | Description |
indexStartLoadingOffset | * |
|
|
indexStartProcessingOffset | * |
|
|
numBlocks | * |
Return:
* |
private _onBlockCreated(block: *, saveBlock: *) source
Event fired when a new Block has been inserted in the blockchain
Params:
Name | Type | Attribute | Description |
block | * | ||
saveBlock | * |