RPC Types (continued)
Type HeaderView
The JSON view of a Header.
This structure is serialized into a JSON object with field hash and all the fields in
Header.
Examples
{
"compact_target": "0x1e02cbd3",
"epoch": "0x0",
"extra_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"hash": "0xfc53392312b0f85d23f8bfd7bb33e9a105095acc89f6f579687bb124c2827334",
"nonce": "0x0",
"number": "0x0",
"parent_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x1a22c0031e0",
"transactions_root": "0x8a31e59ebb73c2b142ec49e864caaee7e442469fcbc8041fb18dd945ada36184",
"version": "0x0"
}
Fields
HeaderView 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
EpochNumberWithFractionfor details. -
extra_hash:H256- The hash onunclesand extension in the block body.The uncles hash is all zeros when
unclesis 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. -
hash:H256- The header hash. It is also called the block hash. -
nonce:Uint128- Miner can modify this field to find a proper value such that the Eaglesong of the header is within the target encoded fromcompact_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 onproposalsin the block body.It is all zeros when
proposalsis 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.
Type IndexerCell
Live cell
Fields
IndexerCell is a JSON object with the following fields.
-
block_number:Uint64- the number of the transaction committed in the block -
out_point:OutPoint- reference to a cell via transaction hash and output index -
output:CellOutput- the fields of an output cell -
tx_index:Uint32- the position index of the transaction committed in the block
Type IndexerCellType
Cell type
It's an enum value from one of:
- input : Input
- output : Output
Type IndexerCellsCapacity
Cells capacity
Fields
IndexerCellsCapacity is a JSON object with the following fields.
-
block_hash:H256- indexed tip block hash -
block_number:Uint64- indexed tip block number -
capacity:Uint64- total capacity
Type IndexerOrder
Order Desc | Asc
It's an enum value from one of:
- desc : Descending order
- asc : Ascending order
Type IndexerPagination<IndexerCell>
IndexerPagination wraps objects array and last_cursor to provide paging
Fields
IndexerPagination<IndexerCell> is a JSON object with the following fields.
-
last_cursor:JsonBytes- pagination parameter -
objects:Array<IndexerCell>- objects collection
Type IndexerPagination<IndexerTx>
IndexerPagination wraps objects array and last_cursor to provide paging
Fields
IndexerPagination<IndexerTx> is a JSON object with the following fields.
Type IndexerRange
An array representing (half-open) range bounded inclusively below and exclusively above [start, end).
Examples
| JSON | range |
|---|---|
| ["0x0", "0x2"] | [0, 2) |
| ["0x0", "0x174876e801"] | [0, 100000000001) |
Type IndexerScriptType
ScriptType Lock | Type
It's an enum value from one of:
- lock : Lock
- type : Type
Type IndexerSearchKey
SearchKey represent indexer support params
Fields
IndexerSearchKey is a JSON object with the following fields.
-
script:Script- Script -
script_type:IndexerScriptType- Script Type
Type IndexerSearchKeyFilter
IndexerSearchKeyFilter represent indexer params filter
Fields
IndexerSearchKeyFilter is a JSON object with the following fields.
block_range:IndexerRange|nullfilter cells by block number rangeoutput_capacity_range:IndexerRange|nullfilter cells by output capacity rangeoutput_data:JsonBytes|nullfilter cells by output dataoutput_data_filter_mode:IndexerSearchMode|nulloutput data filter mode, optional default isprefixoutput_data_len_range:IndexerRange|nullfilter cells by output data len rangescript:Script|nullif search script type is lock, filter cells by type script prefix, and vice versascript_len_range:IndexerRange|nullfilter cells by script len range
Type IndexerSearchMode
IndexerSearchMode represent search mode, default is prefix search
It's an enum value from one of:
- prefix : Mode
prefixsearch with prefix - exact : Mode
exactsearch with exact match - partial : Mode
partialsearch with partial match
Type IndexerTip
Indexer tip information
Fields
IndexerTip is a JSON object with the following fields.
Type IndexerTx
Indexer Transaction Object
Type IndexerTxWithCell
Ungrouped Tx inner type
Fields
IndexerTxWithCell is a JSON object with the following fields.
-
block_number:Uint64- the number of the transaction committed in the block -
io_index:Uint32- the position index of the cell in the transaction inputs or outputs -
io_type:IndexerCellType- io type -
tx_hash:H256- transaction hash -
tx_index:Uint32- the position index of the transaction committed in the block
Type IndexerTxWithCells
Grouped Tx inner type
Fields
IndexerTxWithCells is a JSON object with the following fields.
-
block_number:Uint64- the number of the transaction committed in the block -
cells:Array<(IndexerCellType,Uint32)>- Array [(io_type, io_index)] -
tx_hash:H256- transaction hash -
tx_index:Uint32- the position index of the transaction committed in the block
Type JsonBytes
Variable-length binary encoded as a 0x-prefixed hex string in JSON.
Example
| JSON | Binary |
|---|---|
| "0x" | Empty binary |
| "0x00" | Single byte 0 |
| "0x636b62" | 3 bytes, UTF-8 encoding of kryvon |
| "00" | Invalid, 0x is required |
| "0x0" | Invalid, each byte requires 2 digits |
Type LocalNode
The information of the node itself.
Examples
{
"active": true,
"addresses": [
{
"address": "/ip4/192.168.0.2/tcp/8112/p2p/QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS",
"score": "0xff"
},
{
"address": "/ip4/0.0.0.0/tcp/8112/p2p/QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS",
"score": "0x1"
}
],
"connections": "0xb",
"node_id": "QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS",
"protocols": [
{
"id": "0x0",
"name": "/kryvon/ping",
"support_versions": [
"0.0.1"
]
},
{
"id": "0x1",
"name": "/kryvon/discovery",
"support_versions": [
"0.0.1"
]
}
],
"version": "0.34.0 (f37f598 2020-07-17)"
}
Fields
LocalNode is a JSON object with the following fields.
-
active:boolean- Whether this node is active.An inactive node ignores incoming p2p messages and drops outgoing messages.
-
addresses:Array<NodeAddress>- P2P addresses of this node.A node can have multiple addresses.
-
connections:Uint64- Count of currently connected peers. -
node_id:string- The unique node ID derived from the p2p private key.The private key is generated randomly on the first boot.
-
protocols:Array<LocalNodeProtocol>- Supported protocols. -
version:string- KRYVON node version.Example: "version": "0.34.0 (f37f598 2020-07-17)"
Type LocalNodeProtocol
The information of a P2P protocol that is supported by the local node.
Fields
LocalNodeProtocol is a JSON object with the following fields.
-
id:Uint64- Unique protocol ID. -
name:string- Readable protocol name. -
support_versions:Array<string>- Supported versions.See Semantic Version about how to specify a version.
Type MainLoggerConfig
Runtime logger config.
Fields
MainLoggerConfig is a JSON object with the following fields.
-
color:boolean|nullWhether using color when printing the logs to the process stdout.nullmeans keeping the current option unchanged. -
filter:string|nullSets log levels for different modules.nullmeans keeping the current option unchanged.Examples
Set the log level to info for all modules
infoSet 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 -
to_file:boolean|nullWhether appending the logs to the log file.nullmeans keeping the current option unchanged. -
to_stdout:boolean|nullWhether printing the logs to the process stdout.nullmeans keeping the current option unchanged.
Type MerkleProof
Proof of KRYVON Merkle Tree.
KRYVON Merkle Tree is a CBMT using KRYVON blake2b hash as the merge function.
Fields
MerkleProof is a JSON object with the following fields.
-
indices:Array<Uint32>- Leaves indices in the CBMT that are proved present in the block.These are indices in the CBMT tree not the transaction indices in the block.
-
lemmas:Array<H256>- Hashes of all siblings along the paths to root.
Type MinerReward
Block rewards for miners.
Fields
MinerReward is a JSON object with the following fields.
-
committed:Uint64- The transaction fees that are rewarded to miners because the transaction is committed in the block.Miners get 60% of the transaction fee for each transaction committed in the block.
-
primary:Uint64- The primary base block reward allocated to miners. -
proposal:Uint64- The transaction fees that are rewarded to miners because the transaction is proposed in the block or its uncles.Miners get 40% of the transaction fee for each transaction proposed in the block and committed later in its active commit window.
Type MiningInfo
Mining information structure for the KRYVON-TUI Terminal module.
Fields
MiningInfo is a JSON object with the following fields.
-
difficulty:string- Current network difficulty, represented as a U256 integer. -
hash_rate:string- Current network hash rate, represented as a U256 integer (in hashes per second). This approximates the total computational power of the mining network.
Type Network
Getting volume of received and transmitted data.
Fields
Network is a JSON object with the following fields.
-
interface_name:string- Returns network interface name -
received:integer- Returns the number of received bytes since the last refresh. -
total_received:integer- Returns the total number of received bytes. -
total_transmitted:integer- Returns the total number of transmitted bytes. -
transmitted:integer- Returns the number of transmitted bytes since the last refresh.
Type NetworkInfo
Network peer latency information.
Fields
NetworkInfo is a JSON object with the following fields.
-
connected_peers:Uint64- Total number of connected peers -
inbound_peers:Uint64- Number of inbound connections -
outbound_peers:Uint64- Number of outbound connections -
peers:Array<PeerInfo>- List of individual peer information with their latencies
Type NodeAddress
Node P2P address and score.
Fields
NodeAddress is a JSON object with the following fields.
-
address:string- P2P address.This is the same address used in the whitelist in kryvon.toml.
Example: "/ip4/192.168.0.2/tcp/8112/p2p/QmTRHCdrRtgUzYLNCin69zEvPvLYdxUZLLfLYyHVY3DZAS"
-
score:Uint64- Address score.A higher score means a higher probability of a successful connection.
Type OutPoint
Reference to a cell via transaction hash and output index.
Examples
{
"index": "0x0",
"tx_hash": "0x365698b50ca0da75dca2c87f9e7b563811d3b5813736b8cc62cc3b106faceb17"
}
Fields
OutPoint is a JSON object with the following fields.
-
index:Uint32- The output index of the cell in the transaction specified bytx_hash. -
tx_hash:H256- Transaction hash in which the cell is an output.
Type OutputsValidator
Transaction output validators that prevent common mistakes.
It's an enum value from one of:
- passthrough : the default validator, bypass output checking, thus allow any kind of transaction outputs.
- well_known_scripts_only : restricts the lock script and type script usage
Type Overview
Overview data structure aggregating system and mining information for the KRYVON-TUI Terminal module.
Fields
Overview is a JSON object with the following fields.
-
cells:CellsInfo- Cells information. -
mining:MiningInfo- Mining information, covering hash power, difficulty. -
network:NetworkInfo- Network peer latency information. -
pool:TerminalPoolInfo- Transaction pool information. -
sys:SysInfo- System information, including hardware and OS metrics. -
version:string- KRYVON node version.Example: "version": "0.34.0 (f37f598 2020-07-17)"
Type PeerInfo
Individual peer connection information.
Fields
PeerInfo is a JSON object with the following fields.
-
address:string- Peer address -
is_outbound:boolean- Whether this is an outbound connection -
latency_ms:Uint64- Round-trip time in milliseconds for this peer (0 if not available) -
peer_id:integer- Unique identifier for peer
Type PeerSyncState
The chain synchronization state between the local node and a remote node.
Fields
PeerSyncState is a JSON object with the following fields.
-
can_fetch_count:Uint64- The count of blocks are available for concurrency download. -
inflight_count:Uint64- The count of concurrency downloading blocks. -
unknown_header_list_size:Uint64- The total size of unknown header list.Deprecated: this is an internal state and will be removed in a future release.
Type PoolTransactionReject
TX reject message, PoolTransactionReject is a JSON object with following fields.
type: the Reject type with following enum valuesdescription:string- Detailed description about why the transaction is rejected.
An enum value from one of:
LowFeeRate: Transaction fee lower than configExceededMaximumAncestorsCount: Transaction exceeded maximum ancestors count limitExceededTransactionSizeLimit: Transaction exceeded maximum size limitFull: Transactions are replaced because the pool is fullDuplicated: Transaction already exists in transaction_poolMalformed: Malformed transactionDeclaredWrongCycles: Declared wrong cyclesResolve: Resolve failedVerification: Verification failedExpiry: Transaction expiredRBFRejected: RBF rejectedInvalidated: Invalidated rejected
Type PoolTxDetailInfo
A Tx details info in tx-pool.
Fields
PoolTxDetailInfo is a JSON object with the following fields.
-
ancestors_count:Uint64- The ancestors count of tx -
descendants_count:Uint64- The descendants count of tx -
entry_status:string- The detailed status in tx-pool,pending,gap,proposed -
pending_count:Uint64- The pending(pendingandgap) count -
proposed_count:Uint64- The proposed count -
rank_in_pending:Uint64- The rank in pending, starting from 0 -
score_sortkey:AncestorsScoreSortKey- The score key details, useful to debug -
timestamp:Uint64- The time added into tx-pool
Type ProposalShortId
The 10-byte fixed-length binary encoded as a 0x-prefixed hex string in JSON.
Example
0xa0ef4eb5f4ceeb08a4c8
Type ProposalWindow
Two protocol parameters closest and farthest define the closest
and farthest on-chain distance between a transaction's proposal
and commitment.
A non-cellbase transaction is committed at height h_c if all of the following conditions are met:
- it is proposed at height h_p of the same chain, where w_close <= h_c − h_p <= w_far ;
- it is in the commitment zone of the main chain block with height h_c ;
ProposalWindow { closest: 2, farthest: 10 }
propose
\
\
13 14 [15 16 17 18 19 20 21 22 23]
\_______________________/
\
commit
Fields
ProposalWindow is a JSON object with the following fields.
-
closest:Uint64- The closest distance between the proposal and the commitment. -
farthest:Uint64- The farthest distance between the proposal and the commitment.
Type Ratio
Represents the ratio numerator / denominator, where numerator and denominator are both
unsigned 64-bit integers.
Fields
Ratio is a JSON object with the following fields.
Type RationalU256
The ratio which numerator and denominator are both 256-bit unsigned integers.
Type RawTxPool
All transactions in tx-pool.
RawTxPool is equivalent to TxPoolIds | TxPoolEntries.
Type RemoteNode
Information of a remote node.
A remote node connects to the local node via the P2P network. It is often called a peer.
Examples
{
"addresses": [
{
"address": "/ip6/::ffff:18.185.102.19/tcp/8115/p2p/QmXwUgF48ULy6hkgfqrEwEfuHW7WyWyWauueRDAYQHNDfN",
"score": "0x64"
},
{
"address": "/ip4/18.185.102.19/tcp/8115/p2p/QmXwUgF48ULy6hkgfqrEwEfuHW7WyWyWauueRDAYQHNDfN",
"score": "0x64"
}
],
"connected_duration": "0x2f",
"is_outbound": true,
"last_ping_duration": "0x1a",
"node_id": "QmXwUgF48ULy6hkgfqrEwEfuHW7WyWyWauueRDAYQHNDfN",
"protocols": [
{
"id": "0x4",
"version": "0.0.1"
},
{
"id": "0x2",
"version": "0.0.1"
},
{
"id": "0x1",
"version": "0.0.1"
},
{
"id": "0x64",
"version": "1"
},
{
"id": "0x6e",
"version": "1"
},
{
"id": "0x66",
"version": "1"
},
{
"id": "0x65",
"version": "1"
},
{
"id": "0x0",
"version": "0.0.1"
}
],
"sync_state": {
"best_known_header_hash": null,
"best_known_header_number": null,
"can_fetch_count": "0x80",
"inflight_count": "0xa",
"last_common_header_hash": null,
"last_common_header_number": null,
"unknown_header_list_size": "0x20"
},
"version": "0.34.0 (f37f598 2020-07-17)"
}
Fields
RemoteNode is a JSON object with the following fields.
-
addresses:Array<NodeAddress>- The remote node addresses. -
connected_duration:Uint64- Elapsed time in milliseconds since the remote node is connected. -
is_outbound:boolean- Whether this is an outbound remote node.If the connection is established by the local node,
is_outboundis true. -
node_id:string- The remote node ID which is derived from its P2P private key. -
protocols:Array<RemoteNodeProtocol>- Active protocols.KRYVON uses Tentacle multiplexed network framework. Multiple protocols are running simultaneously in the connection.
-
version:string- The remote node version.
Type RemoteNodeProtocol
The information about an active running protocol.
Fields
RemoteNodeProtocol is a JSON object with the following fields.
-
id:Uint64- Unique protocol ID. -
version:string- Active protocol version.
Type ResponseFormat<BlockView>
This is a wrapper for JSON serialization to select the format between Json and Hex.
Examples
ResponseFormat<BlockView> returns the block in its Json format or molecule serialized
Hex format.
Type ResponseFormat<HeaderView>
This is a wrapper for JSON serialization to select the format between Json and Hex.
Examples
ResponseFormat<BlockView> returns the block in its Json format or molecule serialized
Hex format.
Type ResponseFormat<TransactionView>
This is a wrapper for JSON serialization to select the format between Json and Hex.
Examples
ResponseFormat<BlockView> returns the block in its Json format or molecule serialized
Hex format.
Type Script
Describes the lock script and type script for a cell.
Examples
{
"args": "0xfc6a14efa21dda983e863549c2c6015132147a1e30433db78e0226bfeb4f9908",
"code_hash": "0x0ab222ccd15b0160e2113b036ffe7a0d4cbcb40ac2fe7454194f381a33bd0d65",
"hash_type": "data"
}
Fields
Script is a JSON object with the following fields.
-
args:JsonBytes- Arguments for script. -
code_hash:H256- The hash used to match the script code. -
hash_type:ScriptHashType- Specifies how to use thecode_hashto match the script code.