Class MoneroDaemonRpc

Implements a MoneroDaemon as a client of monerod.

Hierarchy

Properties

Methods

addListener checkForUpdate downloadUpdate flushTxPool getAltBlockHashes getAltChains getBandwidthLimits getBlockByHash getBlockByHeight getBlockHash getBlockHashes getBlockHeaderByHash getBlockHeaderByHeight getBlockHeaderByHeightCached getBlockHeadersByRange getBlockTemplate getBlocksByHash getBlocksByHeight getBlocksByRange getBlocksByRangeChunked getDownloadLimit getFeeEstimate getHardForkInfo getHeight getInfo getKeyImageSpentStatus getKeyImageSpentStatuses getKnownPeers getLastBlockHeader getListeners getMaxBlocks getMinerTxSum getMiningStatus getOutputDistribution getOutputHistogram getOutputs getPeerBans getPeers getPollInterval getProcess getRpcConnection getSyncInfo getTx getTxHex getTxHexes getTxPool getTxPoolHashes getTxPoolStats getTxs getUploadLimit getVersion isConnected isTrusted pruneBlockchain refreshListening relayTxByHash relayTxsByHash removeListener resetDownloadLimit resetUploadLimit setBandwidthLimits setDownloadLimit setIncomingPeerLimit setOutgoingPeerLimit setPeerBan setPeerBans setUploadLimit startMining stop stopMining stopProcess submitBlock submitBlocks submitTxHex waitForNextBlockHeader checkResponseStatus connectToDaemonRpc convertRpcAltChain convertRpcBlock convertRpcBlockHeader convertRpcBlockTemplate convertRpcConnection convertRpcConnectionSpan convertRpcHardForkInfo convertRpcInfo convertRpcMiningStatus convertRpcOutput convertRpcOutputHistogramEntry convertRpcPeer convertRpcSubmitTxResult convertRpcSyncInfo convertRpcTx convertRpcTxPoolStats convertRpcUpdateCheckResult convertRpcUpdateDownloadResult convertToRpcBan normalizeConfig prefixedHexToBI startMonerodProcess

Properties

cachedHeaders: any
config: Partial<MoneroDaemonConfig>
pollListener: any
process: any
proxyDaemon: any
DEFAULT_ID: "0000000000000000000000000000000000000000000000000000000000000000" = "0000000000000000000000000000000000000000000000000000000000000000"
DEFAULT_POLL_PERIOD: 20000 = 20000
MAX_REQ_SIZE: "3000000" = "3000000"
NUM_HEADERS_PER_REQ: 750 = 750

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

  • Returns Promise<any[]>

  • 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

  • Retrieves a header by height from the cache or fetches and caches a header range if not already in the cache.

    Parameters

    • height: any

      height of the header to retrieve from the cache

    • maxHeight: any

      maximum height of headers to cache

    Returns Promise<any>

  • 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 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 the number of blocks in the longest chain known to the node.

    Returns Promise<number>

    the number of blocks!

  • Get a contiguous chunk of blocks starting from a given height up to a maximum height or amount of block data fetched from the blockchain, whichever comes first.

    Parameters

    • Optional startHeight: any

      start height to retrieve blocks (default 0)

    • Optional maxHeight: any

      maximum end height to retrieve blocks (default blockchain height)

    • Optional maxReqSize: any

      maximum amount of block data to fetch from the blockchain in bytes (default 3,000,000 bytes)

    Returns Promise<MoneroBlock[]>

    are the resulting chunk of blocks

  • 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

  • Parameters

    • amounts: any
    • cumulative: any
    • startHeight: any
    • endHeight: any

    Returns Promise<any>

  • 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

  • Returns number

  • Get the internal process running monerod.

    Returns ChildProcess

    the node process running monerod, undefined if not created from new process

  • Get the daemon's RPC connection.

    Returns Promise<any>

    the daemon's rpc connection

  • Get a transaction by hash.

    Parameters

    • Optional txHash: string

      hash of the transaction to get

    • 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

    • 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

    • 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

    • 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

  • Returns void

  • 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>

  • 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

  • Parameters

    • downLimit: any
    • upLimit: any

    Returns Promise<any[]>

  • 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 the internal process running monerod, if applicable.

    Parameters

    • Optional force: boolean = false

      specifies if the process should be destroyed forcibly (default false)

    Returns Promise<number>

    the exit code from stopping the process

  • 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

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

    Returns Promise<MoneroSubmitTxResult>

    contains submission results

  • Parameters

    • resp: any

    Returns void

  • Initializes sync info from RPC sync info.

    Parameters

    • rpcSyncInfo: any

      rpc map to initialize the sync info from

    Returns MoneroDaemonSyncInfo

    is sync info initialized from the map

  • Transfers RPC tx fields to a given MoneroTx without overwriting previous values.

    TODO: switch from safe set

    Parameters

    • rpcTx: any

      RPC map containing transaction fields

    • tx: any

      MoneroTx to populate with values (optional)

    Returns any

    tx - same tx that was passed in or a new one if none given

  • Parameters

    Returns any

  • Converts a '0x' prefixed hexidecimal string to a bigint.

    Parameters

    • hex: any

      is the '0x' prefixed hexidecimal string to convert

    Returns bigint

    the hexicedimal converted to decimal

Generated using TypeDoc