Class MoneroDaemon

Monero daemon interface and default implementations.

Hierarchy

Constructors

Methods

  • Register a listener to receive daemon notifications.

    Parameters

    Returns Promise<void>

  • Flush transactions from the tx pool.

    Parameters

    • Optional hashes: string | string[]

      specific transactions to flush (defaults to all)

    Returns Promise<void>

  • Get known block hashes which are not on the main chain.

    Returns Promise<string[]>

    known block hashes which are not on the main chain

  • Get a block by hash.

    Parameters

    • blockHash: string

      hash of the block to get

    Returns Promise<MoneroBlock>

    with the given hash

  • Get a block by height.

    Parameters

    • height: number

      height of the block to get

    Returns Promise<MoneroBlock>

    with the given height

  • Get a block's hash by its height.

    Parameters

    • height: number

      height of the block hash to get

    Returns Promise<string>

    the block's hash at the given height

  • Get block hashes as a binary request to the daemon.

    Parameters

    • blockHashes: string[]

      specify block hashes to fetch; first 10 blocks hash goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block

    • startHeight: number

      starting height of block hashes to return

    Returns Promise<string[]>

    requested block hashes

  • Get a block header by its hash.

    Parameters

    • blockHash: string

      hash of the block to get the header of

    Returns Promise<MoneroBlockHeader>

    block's header

  • Get a block header by its height.

    Parameters

    • height: number

      height of the block to get the header of

    Returns Promise<MoneroBlockHeader>

    block's header

  • Get block headers for the given range.

    Parameters

    • Optional startHeight: number

      start height lower bound inclusive (optional)

    • Optional endHeight: number

      end height upper bound inclusive (optional)

    Returns Promise<MoneroBlockHeader[]>

    for the given range

  • Get a block template for mining a new block.

    Parameters

    • walletAddress: string

      address of the wallet to receive miner transactions if block is successfully mined

    • Optional reserveSize: number

      reserve size (optional)

    Returns Promise<MoneroBlockTemplate>

    is a block template for mining a new block

  • Get blocks by hash.

    Parameters

    • blockHashes: string[]

      array of hashes; first 10 blocks hashes goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block

    • startHeight: number

      start height to get blocks by hash

    • Optional prune: boolean = false

      specifies if returned blocks should be pruned (defaults to false) // TODO: test default

    Returns Promise<MoneroBlock[]>

    retrieved blocks

  • Get blocks at the given heights.

    Parameters

    • heights: number[]

      heights of the blocks to get

    Returns Promise<MoneroBlock[]>

    are blocks at the given heights

  • Get blocks in the given height range.

    Parameters

    • Optional startHeight: number

      start height lower bound inclusive (optional)

    • Optional endHeight: number

      end height upper bound inclusive (optional)

    Returns Promise<MoneroBlock[]>

    are blocks in the given height range

  • Get blocks in the given height range as chunked requests so that each request is not too big.

    Parameters

    • Optional startHeight: number

      start height lower bound inclusive (optional)

    • Optional endHeight: number

      end height upper bound inclusive (optional)

    • Optional maxChunkSize: number

      maximum chunk size in any one request (default 3,000,000 bytes)

    Returns Promise<MoneroBlock[]>

    blocks in the given height range

  • Get the download bandwidth limit.

    Returns Promise<number>

    download bandwidth limit

  • Get mining fee estimates per kB.

    Parameters

    • Optional graceBlocks: number

      TODO

    Returns Promise<MoneroFeeEstimate>

    mining fee estimates per kB

  • Get the number of blocks in the longest chain known to the node.

    Returns Promise<number>

    the number of blocks!

  • Get general information about the state of the node and the network.

    Returns Promise<MoneroDaemonInfo>

    is general information about the node and network

  • Get the spent status of each given key image.

    Parameters

    • keyImages: string[]

      are hex key images to get the statuses of

    Returns Promise<MoneroKeyImageSpentStatus[]>

    status for each key image

  • Get known peers including their last known online status.

    Returns Promise<MoneroPeer[]>

    the daemon's known peers

  • Gets the total emissions and fees from the genesis block to the current height.

    Parameters

    • height: number

      height to start computing the miner sum

    • numBlocks: number

      number of blocks to include in the sum

    Returns Promise<MoneroMinerTxSum>

    encapsulates the total emissions and fees since the genesis block

  • Get a histogram of output amounts. For all amounts (possibly filtered by parameters), gives the number of outputs on the chain for that amount. RingCT outputs counts as 0 amount.

    Parameters

    • Optional amounts: bigint[]

      amounts of outputs to make the histogram with

    • Optional minCount: number

      TODO

    • Optional maxCount: number

      TODO

    • Optional isUnlocked: boolean

      makes a histogram with outputs with the specified lock state

    • Optional recentCutoff: number

      TODO

    Returns Promise<MoneroOutputHistogramEntry[]>

    are entries meeting the parameters

  • Get outputs identified by a list of output amounts and indices as a binary request.

    Parameters

    • outputs: MoneroOutput[]

      identify each output by amount and index

    Returns Promise<MoneroOutput[]>

    identified outputs

  • Get peer bans.

    Returns Promise<MoneroBan[]>

    entries about banned peers

  • Get peers with active incoming or outgoing connections to the node.

    Returns Promise<MoneroPeer[]>

    the daemon's peers

  • Get a transaction by hash.

    Parameters

    • Optional txHash: string

      hash of the transaction to get

    • Optional prune: boolean = false

      specifies if the returned tx should be pruned (defaults to false)

    Returns Promise<MoneroTx>

    transaction with the given hash or undefined if not found

  • Get a transaction hex by hash.

    Parameters

    • txHash: string

      hash of the transaction to get hex from

    • Optional prune: boolean = false

      specifies if the returned tx hex should be pruned (defaults to false)

    Returns Promise<string>

    tx hex with the given hash

  • Get transaction hexes by hashes.

    Parameters

    • txHashes: string[]

      hashes of transactions to get hexes from

    • Optional prune: boolean = false

      specifies if the returned tx hexes should be pruned (defaults to false)

    Returns Promise<string[]>

    tx hexes

  • Get valid transactions seen by the node but not yet mined into a block, as well as spent key image information for the tx pool.

    Returns Promise<MoneroTx[]>

    are transactions in the transaction pool!

  • Get hashes of transactions in the transaction pool.

    Returns Promise<string[]>

    are hashes of transactions in the transaction pool

  • Get transactions by hashes.

    Parameters

    • txHashes: string[]

      hashes of transactions to get

    • Optional prune: boolean = false

      specifies if the returned txs should be pruned (defaults to false)

    Returns Promise<MoneroTx[]>

    found transactions with the given hashes

  • Get the upload bandwidth limit.

    Returns Promise<number>

    upload bandwidth limit

  • Indicates if the client is connected to the daemon via RPC.

    Returns Promise<boolean>

    true if the client is connected to the daemon, false otherwise

  • Indicates if the daemon is trusted xor untrusted.

    Returns Promise<boolean>

    true if the daemon is trusted, false otherwise

  • Prune the blockchain.

    Parameters

    • check: boolean

      specifies to check the pruning (default false)

    Returns Promise<MoneroPruneResult>

    the prune result

  • Relays a transaction by hash.

    Parameters

    • txHash: string

      hash of the transaction to relay

    Returns Promise<void>

  • Relays transactions by hash.

    Parameters

    • txHashes: string[]

      hashes of the transactinos to relay

    Returns Promise<void>

  • Unregister a listener to receive daemon notifications.

    Parameters

    Returns Promise<void>

  • Reset the download bandwidth limit.

    Returns Promise<number>

    download bandwidth limit after resetting

  • Reset the upload bandwidth limit.

    Returns Promise<number>

    upload bandwidth limit after resetting

  • Set the download bandwidth limit.

    Parameters

    • limit: number

      download limit to set (-1 to reset to default)

    Returns Promise<number>

    new download limit after setting

  • Limit number of incoming peers.

    Parameters

    • limit: number

      maximum number of incoming peers

    Returns Promise<void>

  • Limit number of outgoing peers.

    Parameters

    • limit: number

      maximum number of outgoing peers

    Returns Promise<void>

  • Ban a peer node.

    Parameters

    • ban: MoneroBan

      contains information about a node to ban

    Returns Promise<void>

  • Ban peers nodes.

    Parameters

    • bans: MoneroBan[]

      specify which peers to ban

    Returns Promise<void>

  • Set the upload bandwidth limit.

    Parameters

    • limit: number

      upload limit to set (-1 to reset to default)

    Returns Promise<number>

    new upload limit after setting

  • Start mining.

    Parameters

    • address: string

      address given miner rewards if the daemon mines a block

    • Optional numThreads: number

      number of mining threads to run (default 1)

    • Optional isBackground: boolean

      specifies if the miner should run in the background or not (default false)

    • Optional ignoreBattery: boolean

      specifies if the battery state (e.g. on laptop) should be ignored or not (default false)

    Returns Promise<void>

  • Safely disconnect and shut down the daemon.

    Returns Promise<void>

  • Stop mining.

    Returns Promise<void>

  • Submit a mined block to the network.

    Parameters

    • blockBlob: string

      mined block to submit

    Returns Promise<void>

  • Submit mined blocks to the network.

    Parameters

    • blockBlobs: string[]

      mined blocks to submit

    Returns Promise<void>

  • Submits a transaction to the daemon's pool.

    Parameters

    • txHex: string

      raw transaction hex to submit

    • doNotRelay: boolean = false

      specifies if the tx should be relayed (default false, i.e. relay)

    Returns Promise<MoneroSubmitTxResult>

    contains submission results

  • Get the header of the next block added to the chain.

    Returns Promise<MoneroBlockHeader>

    header of the next block added to the chain

Generated using TypeDoc