RPC Chain commands

chain/estimateFeeRate

Estimates fee given an optional priority

Request

{
  priority: 'slow' | 'average' | 'fast'
} | undefined

Response

{
  rate: string
}

chain/estimateFeeRates

Estimates fee rates for all priorities

Request

undefined

Response

{
  slow: string
  average: string
  fast: string
}

chain/exportChainStream

Exports the chain as a stream with an optional sequence range

Request

{
  start?: number | null
  stop?: number | null
} | undefined

Response

{
  start: number
  stop: number
  block?: {
    hash: string
    seq: number
    prev: string
    main: boolean
    graffiti: string
    timestamp: number
    work: string
    difficulty: string
    head: boolean
    latest: boolean
  }
}

chain/followChainStream

Follows the chain from a given sequence and streams blocks from chain connects and disconnects

Request

{
  head?: string | null
} | undefined

Response

{
  type: 'connected' | 'disconnected' | 'fork'
  head: {
    sequence: number
  }
  block: {
    hash: string
    sequence: number
    previous: string
    graffiti: string
    difficulty: string
    size: number
    timestamp: number
    work: string
    main: boolean
    transactions: Array<{
      hash: string
      size: number
      fee: number
      notes: Array<{ commitment: string }>
      spends: Array<{ nullifier: string }>
      mints: Array<{
        id: string
        metadata: string
        name: string
        owner: string
        value: string
      }>
      burns: Array<{
        id: string
        value: string
      }>
    }>
  }
}

chain/getAsset

Gets an asset from the blockchain from an identifier

Request

{
  id: string
}

Response

{
  createdTransactionHash: string
  id: string
  metadata: string
  name: string
  owner: string
  supply: string
}

chain/getBlock

Gets a block from the chain from a hash or sequence

Request

{
  search?: string
  hash?: string
  sequence?: number
  confirmations?: number
}

Response

{
  block: {
    graffiti: string
    difficulty: string
    hash: string
    previousBlockHash: string
    sequence: number
    timestamp: number
    transactions: Array<{
      fee: string
      hash: string
      signature: string
      notes: number
      spends: number
    }>
  }
  metadata: {
    main: boolean
    confirmed: boolean
  }
}
curl -d '{"sequence": 1}' -X POST http://localhost:8021/chain/getBlock
Restart the animation
curl -d '{"sequence": 1}' -X POST http://localhost:8021/chain/getBlock{ "block": { "graffiti": "genesis", "difficulty": "131072", "hash": "d2a2ef4d7d5c6b92aac56af05877e6a39332cf3541b8ea3c907f343c2cbeac07", "previousBlockHash": "0000000000000000000000000000000000000000000000000000000000000000", "sequence": 1, "timestamp": 1678227692542, "transactions": [ { "signature": "cbc791f1c5afa287807d44e248c3b0a1d65cb5687b191f1c4bc990def2b692eb1d249536d2de6afefe775e900ef28535349c71dc8128f75051db30c607c13f04", "hash": "99b37ae17d4ee1b7486aece754c1612c6fad8a4a738ba00ed54a28ed2a818739", "fee": "0", "spends": 0, "notes": 1 }, { "signature": "889c17e4ce1c5c8c241e66fb7df91a981ab127236dededd0959cf945dee72b5a5a4ed7e09e09be1ddfa455a1af6ab25c258ba767371feecc5f48331af0556f09", "hash": "b71de53a1a4a5d0bc91a0bd8c578d941bcfd477af1cc894f33fd1732028f7746", "fee": "-4200000000000000", "spends": 0, "notes": 1 }, { "signature": "3148fc5284913e54936ea951736a115ee8034b65a5f82cd3f7ddb07d0eae6087063ac6e4ab2adbd179d111c18f36172dd6a8e8a09f8c34ed44983c73ea7fb302", "hash": "3381f200b19d4e6d3744812dc4fe144b2241c10dcc1cc0b630979eb963fd0acd", "fee": "0", "spends": 1, "notes": 1 } ] }, "metadata": { "main": true, "confirmed": true } }

chain/getChainInfo

Gets information about the node's chain

Request

undefined

Response

{
  currentBlockIdentifier: {
    index: string
    hash: string
  }
  genesisBlockIdentifier: {
    index: string
    hash: string
  }
  oldestBlockIdentifier: {
    index: string
    hash: string
  }
  currentBlockTimestamp: number
}

chain/getConsensusParameters

Gets consensus parameters from the chain

Request

undefined

Response

{
  allowedBlockFuturesSeconds: number
  genesisSupplyInIron: number
  targetBlockTimeInSeconds: number
  targetBucketTimeInSeconds: number
  maxBlockSizeBytes: number
}

chain/getDifficulty

Gets block difficulty from a given sequence or the head

Request

{
  sequence?: number | null
} | undefined

Response

{
  sequence: number
  hash: string
  difficulty: string
}

chain/getNetworkHashPower

Gets hash power from the chain from a sequence or block range

Request

{
  blocks?: number | null
  sequence?: number | null
}

Response

{
  hashesPerSecond: number
  blocks: number
  sequence: number
}

chain/getNetworkInfo

Get information about the node's network

Request

undefined

Response

{
  networkId: number
}

chain/getTransaction

Gets a transaction from a block hash and transaction hash

Request

{ 
  blockHash: string
  transactionHash: string 
}

Response

{
  fee: string
  expiration: number
  notesCount: number
  spendsCount: number
  signature: string
  notesEncrypted: string[]
  mints: {
    assetId: string
    value: string
  }[]
  burns: {
    assetId: string
    value: string
  }[]
}

chain/getTransactionStream

Streams transactions from a head sequence given an incoming view key

Request

{ 
  incomingViewKey: string
  head?: string | null 
}

Response

{
  type: 'connected' | 'disconnected' | 'fork'
  head: {
    sequence: number
  }
  block: {
    hash: string
    previousBlockHash: string
    sequence: number
    timestamp: number
  }
  transactions: {
    hash: string
    isMinersFee: boolean
    notes: {
      assetId: string
      assetName: string
      value: string
      memo: string
    }[]
    mints: {
      assetId: string
      assetName: string
      value: string
    }[]
    burns: {
      assetId: string
      assetName: string
      value: string
    }[]
  }[]
}

chain/showChain

Renders the chain from an optional sequence range

Request

{
  start?: number | null
  stop?: number | null
} | undefined

Response

{
  content: string[]
}

chain/getNoteWitness

Returns a witness (merkle path) to a specified note in the note merkle tree. This witness is necessary for creating a transaction that spends the note. This endpoint would primarily be used to construct transactions without using the Iron Fish wallet. The returned treeSize and rootHash values will always reference the note merkle tree state at the current HEAD of the chain. If the chain experiences a re-org and the referenced HEAD moves to a fork, this witness will no longer be usable in a transaction.

Request

{
  index: number
}

Response

{
  treeSize: number
  rootHash: string
  authPath: {
    side: 'Left' | 'Right'
    hashOfSibling: string
  }[]
}