Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SimplyBlock

Hierarchy

  • SimplyBlock

Index

Constructors

constructor

  • new SimplyBlock(index: number, timestamp: number, data: any[], previous_hash?: string): SimplyBlock
  • Create a block

    Parameters

    • index: number

      0-based index of the block

    • timestamp: number

      timestamp of the block

    • data: any[]

      data to be added to the block

    • previous_hash: string = ''

      hash of the previous block

    Returns SimplyBlock

Properties

_data

_data: any[]

_difficulty

_difficulty: number

_index

_index: number

_nonce

_nonce: number

_previous_hash

_previous_hash: string

_timestamp

_timestamp: number

Accessors

difficulty

  • get difficulty(): number
  • set difficulty(value: number): void

nonce

  • get nonce(): number
  • set nonce(value: number): void

previousHash

  • get previousHash(): string
  • set previousHash(value: string): void

Methods

hash

  • hash(): string

mineAsync

  • mineAsync(): Promise<unknown>

mineSync

  • mineSync(fn?: (nonce: number) => void): number
  • Mine the block synchronously

    Parameters

    • Optional fn: (nonce: number) => void
        • (nonce: number): void
        • Parameters

          • nonce: number

          Returns void

    Returns number

    the nonce of the block

Generated using TypeDoc