Kryvon / KRYVON DEVELOPER DOCSKRYVON DEVELOPER DOCS

RPC types

Use the rpc types reference for the Kryvon node, with RPC parameters, response types and examples.

RPC reference

RPC Types

Type AlertId

The alert identifier that is used to filter duplicated alerts.

This is a 32-bit unsigned integer type encoded as the 0x-prefixed hex string in JSON. See examples of Uint32.

Type AlertMessage

Legacy alert message.

Fields

AlertMessage is a JSON object with the following fields.

  • id: Uint32 - The unique alert ID.

  • message: string - Alert message.

  • notice_until: Uint64 - The alert is expired after this timestamp.

  • priority: Uint32 - Alerts are sorted by priority, highest first.

Type AlertPriority

Alerts are sorted by priority. Greater integers mean higher priorities.

This is a 32-bit unsigned integer type encoded as the 0x-prefixed hex string in JSON. See examples of Uint32.

Type AncestorsScoreSortKey

A struct as a sorted key for tx-pool

Fields

AncestorsScoreSortKey is a JSON object with the following fields.

  • ancestors_fee: Uint64 - Ancestors fee

  • ancestors_weight: Uint64 - Ancestors weight

  • fee: Uint64 - Fee

  • weight: Uint64 - Weight

Type BannedAddr

A banned P2P address.

Fields

BannedAddr is a JSON object with the following fields.

  • address: string - The P2P address.

    Example: "/ip4/192.168.0.2/tcp/8112/p2p/QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS"

  • ban_reason: string - The reason.

  • ban_until: Uint64 - The address is banned until this time.

  • created_at: Uint64 - When this address is banned.

Type Block

The JSON view of a Block used as a parameter in the RPC.

Fields

Block is a JSON object with the following fields.

  • header: Header - The block header.

  • proposals: Array< ProposalShortId > - The proposal IDs in the block body.

  • transactions: Array< Transaction > - The transactions in the block body.

  • uncles: Array< UncleBlock > - The uncles blocks in the block body.

Type BlockEconomicState

Block Economic State.

It includes the rewards details and when it is finalized.

Fields

BlockEconomicState is a JSON object with the following fields.

  • finalized_at: H256 - The block hash of the block which creates the rewards as cells in its cellbase transaction.

  • issuance: BlockIssuance - Block base rewards.

  • miner_reward: MinerReward - Block rewards for miners.

  • txs_fee: Uint64 - The total fees of all transactions committed in the block.

Type BlockFilter

Block filter data and hash.

Fields

BlockFilter is a JSON object with the following fields.

  • data: JsonBytes - The hex-encoded filter data of the block

  • hash: Byte32 - The filter hash, blake2b hash of the parent block filter hash and the filter data, blake2b(parent_block_filter_hash | current_block_filter_data)

Type BlockIssuance

Block base rewards.

Fields

BlockIssuance is a JSON object with the following fields.

  • primary: Uint64 - The primary base rewards.

Type BlockNumber

Consecutive block number starting from 0.

This is a 64-bit unsigned integer type encoded as the 0x-prefixed hex string in JSON. See examples of Uint64.

Type BlockResponse

The wrapper represents the response of get_block | get_block_by_number, and returns a Block with cycles.

Type BlockTemplate

A block template for miners.

Miners optional pick transactions and then assemble the final block.

Fields

BlockTemplate is a JSON object with the following fields.

  • bytes_limit: Uint64 - The block serialized size limit.

    Miners must keep the block size below this limit, otherwise, the KRYVON node will reject the block submission.

    It is guaranteed that the block does not exceed the limit if miners do not add new transaction commitments.

  • cellbase: CellbaseTemplate - Provided cellbase transaction template.

    Miners must use it as the cellbase transaction without changes in the assembled block.

  • compact_target: Uint32 - The compacted difficulty target for the new block.

    Miners must use it unchanged in the assembled block.

  • current_time: Uint64 - The timestamp for the new block.

    KRYVON node guarantees that this timestamp is larger than the median of the previous 37 blocks.

    Miners can increase it to the current time. It is not recommended to decrease it, since it may violate the median block timestamp consensus rule.

  • cycles_limit: Uint64 - The cycles limit.

    Miners must keep the total cycles below this limit, otherwise, the KRYVON node will reject the block submission.

    It is guaranteed that the block does not exceed the limit if miners do not add new transactions to the block.

  • epoch: Uint64 - The epoch progress information for the new block.

    Miners must use it unchanged in the assembled block.

  • number: Uint64 - The block number for the new block.

    Miners must use it unchanged in the assembled block.

  • parent_hash: H256 - The parent block hash of the new block.

    Miners must use it unchanged in the assembled block.

  • proposals: Array< ProposalShortId > - Provided proposal ids list of transactions for the new block.

  • transactions: Array< TransactionTemplate > - Provided valid transactions which can be committed in the new block.

    Miners must include the transactions marked as required in the assembled new block.

  • uncles: Array< UncleTemplate > - Provided valid uncle blocks candidates for the new block.

    Miners must include the uncles marked as required in the assembled new block.

  • uncles_count_limit: Uint64 - The uncle count limit.

    Miners must keep the uncles count below this limit, otherwise, the KRYVON node will reject the block submission.

  • version: Uint32 - Block version.

    Miners must use it unchanged in the assembled block.

  • work_id: Uint64 - Work ID. The miner must submit the new assembled and resolved block using the same work ID.

  • extension: JsonBytes — Non-genesis blocks carry a 32–96 byte extension beginning with the parent MMR root.

Type BlockView

The JSON view of a Block including header and body.

Fields

BlockView is a JSON object with the following fields.

Type BlockWithCyclesResponse

BlockResponse with cycles format wrapper

Fields

BlockWithCyclesResponse is a JSON object with the following fields.

Type Buried

Represent soft fork deployments where the activation epoch is hard-coded into the client implementation

Fields

Buried is a JSON object with the following fields.

  • active: boolean - Whether the rules are active

  • epoch: Uint64 - The first epoch which the rules will be enforced

Type Byte32

The fixed-length 32 bytes binary encoded as a 0x-prefixed hex string in JSON.

Type Capacity

Cell capacity expressed as an unsigned 64-bit quantity in quarks. One KRVN is 1,000,000,000 quarks. The occupied-capacity calculation charges 10,000,000 quarks (0.01 KRVN) per logical byte.

Type CellData

The cell data content and hash.

Examples
{
  "content": "0x7f454c460201010000000000000000000200f3000100000078000100000000004000000000000000980000000000000005000000400038000100400003000200010000000500000000000000000000000000010000000000000001000000000082000000000000008200000000000000001000000000000001459308d00573000000002e7368737472746162002e74657874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000010000000600000000000000780001000000000078000000000000000a0000000000000000000000000000000200000000000000000000000000000001000000030000000000000000000000000000000000000082000000000000001100000000000000000000000000000001000000000000000000000000000000",
  "hash": "0x28e83a1277d48add8e72fadaa9248559e1b632bab2bd60b27955ebc4c03800a5"
}

Fields

CellData is a JSON object with the following fields.

  • content: JsonBytes - Cell content.

  • hash: H256 - Cell content hash.

Type CellDep

The cell dependency of a transaction.

Examples
{
  "dep_type": "code",
  "out_point": {
    "index": "0x0",
    "tx_hash": "0xa4037a893eb48e18ed4ef61034ce26eba9c585f15c9cee102ae58505565eccc3"
  }
}

Fields

CellDep is a JSON object with the following fields.

  • dep_type: DepType - Dependency type.

  • out_point: OutPoint - Reference to the cell.

Type CellInfo

The JSON view of a cell combining the fields in cell output and cell data.

Examples
{
  "data": {
    "content": "0x7f454c460201010000000000000000000200f3000100000078000100000000004000000000000000980000000000000005000000400038000100400003000200010000000500000000000000000000000000010000000000000001000000000082000000000000008200000000000000001000000000000001459308d00573000000002e7368737472746162002e74657874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000010000000600000000000000780001000000000078000000000000000a0000000000000000000000000000000200000000000000000000000000000001000000030000000000000000000000000000000000000082000000000000001100000000000000000000000000000001000000000000000000000000000000",
    "hash": "0x28e83a1277d48add8e72fadaa9248559e1b632bab2bd60b27955ebc4c03800a5"
  },
  "output": {
    "capacity": "0x802665800",
    "lock": {
      "args": "0x",
      "code_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "hash_type": "data"
    },
    "type": null
  }
}

Fields

CellInfo is a JSON object with the following fields.

  • output: CellOutput - Cell fields appears in the transaction outputs array.

Type CellInput

The input cell of a transaction.

Examples
{
  "previous_output": {
    "index": "0x0",
    "tx_hash": "0x365698b50ca0da75dca2c87f9e7b563811d3b5813736b8cc62cc3b106faceb17"
  },
  "since": "0x0"
}

Fields

CellInput is a JSON object with the following fields.

  • previous_output: OutPoint - Reference to the input cell.

  • since: Uint64 - Restrict when the transaction can be committed into the chain.

    See the RFC Transaction valid since.

Type CellOutput

The fields of an output cell except the cell data.

Examples
{
  "capacity": "0xaa87bee538000",
  "lock": {
    "args": "0xfc6a14efa21dda983e863549c2c6015132147a1e30433db78e0226bfeb4f9908",
    "code_hash": "0x0ab222ccd15b0160e2113b036ffe7a0d4cbcb40ac2fe7454194f381a33bd0d65",
    "hash_type": "data"
  },
  "type": null
}

Fields

CellOutput is a JSON object with the following fields.

  • capacity: Uint64 - The cell capacity.

    Capacity is expressed in quarks. A native SQIsign payment cell with empty data and no type script occupies 73 logical bytes and requires at least 0.73 KRVN.

  • lock: Script - The lock script.

Type CellWithStatus

The JSON view of a cell with its status information.

Examples
{
  "cell": {
    "data": {
      "content": "0x7f454c460201010000000000000000000200f3000100000078000100000000004000000000000000980000000000000005000000400038000100400003000200010000000500000000000000000000000000010000000000000001000000000082000000000000008200000000000000001000000000000001459308d00573000000002e7368737472746162002e74657874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000010000000600000000000000780001000000000078000000000000000a0000000000000000000000000000000200000000000000000000000000000001000000030000000000000000000000000000000000000082000000000000001100000000000000000000000000000001000000000000000000000000000000",
      "hash": "0x28e83a1277d48add8e72fadaa9248559e1b632bab2bd60b27955ebc4c03800a5"
    },
    "output": {
      "capacity": "0x802665800",
      "lock": {
        "args": "0x",
        "code_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "hash_type": "data"
      },
      "type": null
    }
  },
  "status": "live",
  "block_hash": "0x7978ec7ce5b507cfb52e149e36b1a23f6062ed150503c85bbf825da3599095ed"
}
{
  "cell": null,
  "status": "unknown",
  "block_hash": null
}

Fields

CellWithStatus is a JSON object with the following fields.

  • status: string - Status of the cell.

    Allowed values: "live", "dead", "unknown".

    • live - The transaction creating this cell is in the chain, and there are no transactions found in the chain that uses this cell as an input.
    • dead - (Deprecated: the dead status will be removed since 0.36.0, please do not rely on the logic that differentiates dead and unknown cells.) The transaction creating this cell is in the chain, and a transaction is found in the chain which uses this cell as an input.
    • unknown - KRYVON does not know the status of the cell. Either the transaction creating this cell is not in the chain yet, or it is no longer live.

Type CellbaseTemplate

The cellbase transaction template of the new block for miners.

Fields

CellbaseTemplate is a JSON object with the following fields.

  • data: Transaction - The cellbase transaction.

  • hash: H256 - The cellbase transaction hash.

Type CellsInfo

Cells information.

Fields

CellsInfo is a JSON object with the following fields.

  • estimate_live_cells_num: Uint64 - estimate live cells total num

  • total_occupied_capacities: Uint64 - The total occupied capacities currently in the KRYVON

Type ChainInfo

Chain information.

Fields

ChainInfo is a JSON object with the following fields.

  • alerts: Array< AlertMessage > - Legacy alert list. Always empty because the alert protocol has been removed.

  • chain: string - The network name.

    Examples:

    • "kryvon" - Mirana the mainnet.
    • "kryvon_testnet" - Pudge the testnet.
  • difficulty: string - Current difficulty.

    Decoded from the epoch compact_target.

  • epoch: Uint64 - The epoch information of tip block in the chain.

  • is_initial_block_download: boolean - Whether the local node is in IBD, Initial Block Download.

    When a node starts and its chain tip timestamp is far behind the wall clock, it will enter the IBD until it catches up the synchronization.

    During IBD, the local node only synchronizes the chain with one selected remote node and stops responding the most P2P requests.

  • median_time: Uint64 - The median time of the last 37 blocks, including the tip block.

Type Consensus

Returned by get_consensus.

  • id — Network ID.
  • genesis_hash — Hash of the genesis block.
  • sqisign_lock_code_hash — Code hash of Kryvon’s native SQIsign payment lock.
  • initial_block_reward — Initial block subsidy, in quarks.
  • block_reward_halving_interval — Number of mined blocks per halving era.
  • premine — Genesis allocation, in quarks.
  • max_supply — Maximum supply, in quarks.
  • supply_cap_enforced — Whether the fixed height-based issuance rules apply.
  • max_uncles_num — Maximum number of uncles in a block.
  • orphan_rate_target — Target orphan-rate ratio.
  • epoch_duration_target — Target epoch length in seconds.
  • tx_proposal_window — Minimum and maximum block distances between a proposal and commitment.
  • proposer_reward_ratio — Share of a transaction fee allocated to its proposer.
  • cellbase_maturity — Maturity encoded as an epoch number with fraction.
  • median_time_block_count — Number of past blocks used for median time.
  • max_block_cycles — Maximum committed-transaction cycles per block.
  • max_block_bytes — Maximum serialized block size in bytes.
  • block_version — Supported block version.
  • tx_version — Supported transaction version.
  • type_id_code_hash — Code hash reserved for type IDs.
  • max_block_proposals_limit — Maximum proposals in a block.
  • permanent_difficulty_in_dummy — Whether the local dummy proof-of-work engine keeps difficulty fixed.

Type Cycle

Count of cycles consumed by KRYVON VM to run scripts.

This is a 64-bit unsigned integer type encoded as the 0x-prefixed hex string in JSON. See examples of Uint64.

Type DepType

The dep cell type. Allowed values: "code" and "dep_group".

It's an enum value from one of:

  • code : Type "code".

Use the cell itself as the dep cell.

  • dep_group : Type "dep_group".

The cell is a dep group whose members are cells. These members are used as dep cells instead of the group itself.

The dep group stores the array of OutPoints serialized via molecule in the cell data. Each OutPoint points to one cell member.

Type Disk

Struct containing a disk information.

Fields

Disk is a JSON object with the following fields.

  • available_space: integer - Returns the available disk size, in bytes.

  • is_removable: boolean - Returns true if the disk is removable.

  • total_space: integer - Returns the total disk size, in bytes.

Type DiskUsage

Struct containing read and written bytes.

Fields

DiskUsage is a JSON object with the following fields.

  • read_bytes: integer - Number of read bytes since the last refresh.

  • total_read_bytes: integer - Total number of read bytes.

  • total_written_bytes: integer - Total number of written bytes.

  • written_bytes: integer - Number of written bytes since the last refresh.

Type EntryCompleted

Transaction's verify result by test_tx_pool_accept

Fields

EntryCompleted is a JSON object with the following fields.

  • cycles: Uint64 - Cached tx cycles

  • fee: Uint64 - Cached tx fee

Type EpochNumber

Consecutive epoch number starting from 0.

This is a 64-bit unsigned integer type encoded as the 0x-prefixed hex string in JSON. See examples of Uint64.

Type EpochNumberWithFraction

The epoch indicator of a block. It shows which epoch the block is in, and the elapsed epoch fraction after adding this block.

This is a 64-bit unsigned integer type encoded as the 0x-prefixed hex string in JSON. See examples of Uint64.

The lower 56 bits of the epoch field are split into 3 parts (listed in the order from higher bits to lower bits):

  • The highest 16 bits represent the epoch length
  • The next 16 bits represent the current block index in the epoch, starting from 0.
  • The lowest 24 bits represent the current epoch number.

Assume there's a block, which number is 11555 and in epoch 50. The epoch 50 starts from block 11000 and have 1000 blocks. The epoch field for this particular block will then be 1,099,520,939,130,930, which is calculated in the following way:

50 | ((11555 - 11000) << 24) | (1000 << 40)

Type EpochView

JSON view of an epoch.

KRYVON adjusts difficulty based on epochs.

Examples
{
  "compact_target": "0x1e083126",
  "length": "0x708",
  "number": "0x1",
  "start_number": "0x3e8"
}

Fields

EpochView is a JSON object with the following fields.

  • compact_target: Uint32 - The difficulty target for any block in this epoch.

  • length: Uint64 - The number of blocks in this epoch.

  • number: Uint64 - Consecutive epoch number starting from 0.

  • start_number: Uint64 - The block number of the first block in the epoch.

    It also equals the total count of blocks in all the epochs whose epoch number is less than this epoch.

Type EstimateCycles

Response result of the RPC method estimate_cycles.

Fields

EstimateCycles is a JSON object with the following fields.

  • cycles: Uint64 - The count of cycles that the VM has consumed to verify this transaction.

Type EstimateMode

The fee estimate mode.

It's an enum value from one of:

  • no_priority : No priority, expect the transaction to be committed in 1 hour.
  • low_priority : Low priority, expect the transaction to be committed in 30 minutes.
  • medium_priority : Medium priority, expect the transaction to be committed in 10 minutes.
  • high_priority : High priority, expect the transaction to be committed as soon as possible.

Type ExtraLoggerConfig

Runtime logger config for extra loggers.

Fields

ExtraLoggerConfig is a JSON object with the following fields.

  • filter: string - Sets log levels for different modules.

    Examples

    Set the log level to info for all modules

    info
    

    Set the log level to debug for listed modules and info for other modules.

    info,kryvon-rpc=debug,kryvon-sync=debug,kryvon-relay=debug,kryvon-tx-pool=debug,kryvon-network=debug
    

Type FeeRateStatistics

The fee_rate statistics information, includes mean and median, unit: quarks per kilo-weight

Fields

FeeRateStatistics is a JSON object with the following fields.

Type Global

Global system information

Fields

Global is a JSON object with the following fields.

  • disks: Array< Disk > - Returns disks information.

  • global_cpu_usage: number - Returns “global” CPUs usage (aka the addition of all the CPUs).

  • networks: Array< Network > - Returns networks information.

  • total_memory: integer - Returns the RAM size in bytes.

  • used_memory: integer - Returns the amount of used RAM in bytes.

Type H256

The 256-bit binary data encoded as a 0x-prefixed hex string in JSON.

Type Header

The block header.

See the block layout in the Kryvon protocol specification.

Fields

Header is a JSON object with the following fields.

  • compact_target: Uint32 - The block difficulty target.

    It can be converted to a 256-bit target. Miners must ensure the Eaglesong of the header is within the target.

  • epoch: Uint64 - The epoch information of this block.

    See EpochNumberWithFraction for details.

  • extra_hash: H256 - The hash on uncles and extension in the block body.

    The uncles hash is all zeros when uncles is empty, or the hash on all the uncle header hashes concatenated together. The extension hash is the hash of the extension. The extra hash is the hash on uncles hash and extension hash concatenated together.

  • nonce: Uint128 - Miner can modify this field to find a proper value such that the Eaglesong of the header is within the target encoded from compact_target.

  • number: Uint64 - The consecutive block number starting from 0.

  • parent_hash: H256 - The header hash of the parent block.

  • proposals_hash: H256 - The hash on proposals in the block body.

    It is all zeros when proposals is empty, or the hash on all the bytes concatenated together.

  • timestamp: Uint64 - The block timestamp.

    It is a Unix timestamp in milliseconds (1 second = 1000 milliseconds).

    Miners should put the time when the block is created in the header, however, the precision is not guaranteed. A block with a higher block number may even have a smaller timestamp.

  • transactions_root: H256 - The commitment to all the transactions in the block.

    It is a hash on two Merkle Tree roots:

    • The root of a KRYVON Merkle Tree, which items are the transaction hashes of all the transactions in the block.
    • The root of a KRYVON Merkle Tree, but the items are the transaction witness hashes of all the transactions in the block.
  • version: Uint32 - The block version.

    It must equal to 0 now and is reserved for future upgrades.