Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SimplyChain

Hierarchy

  • SimplyChain

Index

Constructors

constructor

Properties

_chain

_chain: ChainObject

_difficulty

_difficulty: number

_lastblock

_lastblock: SimplyBlock

_length

_length: number

_pendingBlock

_pendingBlock: undefined | SimplyBlock

_transactions

_transactions: any[]

Accessors

lastBlock

length

  • get length(): number

pendingBlock

theChain

  • get theChain(): ChainObject

Methods

addBlock

  • addBlock(proofOfWork: number): void
  • Add a block into the chain

    throws

    Invalid block | Invalid proof of work

    Parameters

    • proofOfWork: number

    Returns void

addTransaction

  • addTransaction(data: any): void
  • add a transaction to chain

    Parameters

    • data: any

    Returns void

createBlock

  • createBlock(): void

createGenesisBlock

validate

  • validate(): boolean
  • Check if the chain is valid

    Returns boolean

    if the chain is valid or not

Generated using TypeDoc