Fiber LogoFiber Docs
RPC API Reference

Types Reference

Common data types used in the JSON-RPC API

Types Reference

Type Attribute

The attributes of the invoice.

Enum with values of

  • final_htlc_timeout - u64, This attribute is deprecated since v0.6.0, The final tlc time out, in milliseconds
  • final_htlc_minimum_expiry_delta - u64, The final tlc minimum expiry delta, in milliseconds, default is 1 day
  • expiry_time - std::time::Duration, The expiry time of the invoice, in seconds
  • description - String, The description of the invoice
  • fallback_addr - String, The fallback address of the invoice
  • udt_script - String, The udt type script of the invoice (serialized as 0x-prefixed hex of molecule bytes)
  • payee_public_key - Pubkey, The payee public key of the invoice (validated compressed secp256k1 key, hex without 0x prefix)
  • hash_algorithm - HashAlgorithm, The hash algorithm of the invoice
  • feature - Vec<String>, The feature flags of the invoice
  • payment_secret - String, The payment secret of the invoice

Type CchInvoice

The generated proxy invoice for the incoming payment.

The JSON representation:

{ "Fiber": String } | { "Lightning": String }

Enum with values of

  • Fiber - String, Fiber invoice string
  • Lightning - String, Lightning invoice string

Type CchOrderStatus

The status of a cross-chain hub order, will update as the order progresses.

Enum with values of

  • Pending - Order is created and waiting for the incoming invoice to collect enough TLCs.
  • IncomingAccepted - The incoming invoice collected the required TLCs and is ready to send outgoing payment to obtain the preimage.
  • OutgoingInFlight - The outgoing payment is in flight.
  • OutgoingSuccess - The outgoing payment is settled and preimage has been obtained.
  • Success - Both payments are settled and the order succeeds.
  • Failed - Order is failed.

Type Channel

The channel data structure.

Fields

  • channel_id - Hash256, The channel ID
  • is_public - bool, Whether the channel is public
  • is_acceptor - bool, Is this channel initially inbound? An inbound channel is one where the counterparty is the funder of the channel.
  • is_one_way - bool, Is this channel one-way? Combines with is_acceptor to determine if the channel able to send payment to the counterparty or not.
  • channel_outpoint - Option<OutPoint>, The outpoint of the channel
  • pubkey - Pubkey, The public key of the channel counterparty.
  • funding_udt_type_script - Option<Script>, The UDT type script of the channel
  • state - ChannelState, The state of the channel
  • local_balance - u128, The local balance of the channel
  • offered_tlc_balance - u128, The offered balance of the channel
  • remote_balance - u128, The remote balance of the channel
  • received_tlc_balance - u128, The received balance of the channel
  • pending_tlcs - Vec<[Htlc](#type-htlc)>, The list of pending tlcs
  • latest_commitment_transaction_hash - Option<H256>, The hash of the latest commitment transaction
  • created_at - u64, The time the channel was created at, in milliseconds from UNIX epoch
  • enabled - bool, Whether the channel is enabled
  • tlc_expiry_delta - u64, The expiry delta to forward a tlc, in milliseconds, default to 1 day, which is 24 * 60 * 60 * 1000 milliseconds This parameter can be updated with rpc update_channel later.
  • tlc_fee_proportional_millionths - u128, The fee proportional millionths for a TLC, proportional to the amount of the forwarded tlc. The unit is millionths of the amount. default is 1000 which means 0.1%. This parameter can be updated with rpc update_channel later. Not that, we use outbound channel to calculate the fee for TLC forwarding. For example, if we have a path A -> B -> C, then the fee B requires for TLC forwarding, is calculated the channel configuration of B and C, not A and B.
  • shutdown_transaction_hash - Option<H256>, The hash of the shutdown transaction
  • failure_detail - Option<String>, Human-readable reason why the channel opening failed. Only present when the channel is in a failed state (e.g. abandoned or funding aborted).

Type ChannelInfo

The Channel information.

Fields

  • channel_outpoint - OutPoint, The outpoint of the channel.
  • node1 - Pubkey, The identity public key of the first node (secp256k1 compressed, hex string).
  • node2 - Pubkey, The identity public key of the second node (secp256k1 compressed, hex string).
  • created_timestamp - u64, The created timestamp of the channel, which is the block header timestamp of the block that contains the channel funding transaction.
  • update_info_of_node1 - Option<[ChannelUpdateInfo](#type-channelupdateinfo)>, The update info from node1 to node2, e.g. timestamp, fee_rate, tlc_expiry_delta, tlc_minimum_value
  • update_info_of_node2 - Option<[ChannelUpdateInfo](#type-channelupdateinfo)>, The update info from node2 to node1, e.g. timestamp, fee_rate, tlc_expiry_delta, tlc_minimum_value
  • capacity - u128, The capacity of the channel.
  • chain_hash - Hash256, The chain hash of the channel.
  • udt_type_script - Option<Script>, The UDT type script of the channel.

Type ChannelState

The state of a channel.

Serialized with adjacently-tagged representation using PascalCase variant names and flags. This is different from the internal ChannelState in fiber-types which uses default serde for bincode compatibility.

Enum with values of

  • NegotiatingFunding - NegotiatingFundingFlags, We are negotiating the parameters required for the channel prior to funding it. For channels opened with external funding, this state is also used together with NegotiatingFundingFlags::AWAITING_EXTERNAL_FUNDING to indicate that we are waiting for the user to sign and submit the funding transaction externally.
  • CollaboratingFundingTx - CollaboratingFundingTxFlags, We're collaborating with the other party on the funding transaction.
  • SigningCommitment - SigningCommitmentFlags, We have collaborated over the funding and are now waiting for CommitmentSigned messages.
  • AwaitingTxSignatures - AwaitingTxSignaturesFlags, We've received and sent commitment_signed and are now waiting for both party to collaborate on creating a valid funding transaction.
  • AwaitingChannelReady - AwaitingChannelReadyFlags, We've received/sent funding_created and funding_signed and are thus now waiting on the funding transaction to confirm.
  • ChannelReady - Both we and our counterparty consider the funding transaction confirmed and the channel is now operational.
  • ShuttingDown - ShuttingDownFlags, We've successfully negotiated a closing_signed dance. At this point, the ChannelManager
  • Closed - CloseFlags, This channel is closed.

Type ChannelUpdateInfo

The channel update info with a single direction of channel.

Fields

  • timestamp - u64, The timestamp is the time when the channel update was received by the node.
  • enabled - bool, Whether the channel can be currently used for payments (in this one direction).
  • outbound_liquidity - Option<u128>, The exact amount of balance that we can send to the other party via the channel.
  • tlc_expiry_delta - u64, The difference in htlc expiry values that you must have when routing through this channel (in milliseconds).
  • tlc_minimum_value - u128, The minimum value, which must be relayed to the next hop via the channel
  • fee_rate - u64, The forwarding fee rate for the channel.

Type CkbInvoice

Represents a syntactically and semantically correct lightning BOLT11 invoice.

There are three ways to construct a CkbInvoice:

  1. using [CkbInvoiceBuilder]
  2. using str::parse::<CkbInvoice>(&str) (see [CkbInvoice::from_str])

Fields

  • currency - Currency, The currency of the invoice
  • amount - Option<u128>, The amount of the invoice
  • signature - Option<String>, The signature of the invoice (hex encoded)
  • data - InvoiceData, The invoice data, including the payment hash, timestamp and other attributes

Type CkbInvoiceStatus

The status of an invoice.

Enum with values of

  • Open - The invoice is open and can be paid.
  • Cancelled - The invoice is cancelled.
  • Expired - The invoice is expired.
  • Received - The invoice is received, but not settled yet.
  • Paid - The invoice is paid.

Type Currency

The currency of the invoice, can also used to represent the CKB network chain.

Enum with values of

  • Fibb - The mainnet currency of CKB.
  • Fibt - The testnet currency of the CKB network.
  • Fibd - The devnet currency of the CKB network.

Type GetPaymentCommandResult

The result of a get_payment command, which includes the payment hash, status, timestamps, error message if failed, fee paid, and custom records.

Fields

  • payment_hash - Hash256, The payment hash of the payment
  • status - PaymentStatus, The status of the payment
  • created_at - u64, The time the payment was created at, in milliseconds from UNIX epoch
  • last_updated_at - u64, The time the payment was last updated at, in milliseconds from UNIX epoch
  • failed_error - Option<String>, The error message if the payment failed
  • fee - u128, fee paid for the payment
  • custom_records - Option<[PaymentCustomRecords](#type-paymentcustomrecords)>, The custom records to be included in the payment.
  • routers - Vec<[SessionRoute](#type-sessionroute)>, The router is a list of nodes that the payment will go through. We store in the payment session and then will use it to track the payment history. If the payment adapted MPP (multi-part payment), the routers will be a list of nodes. For example: A(amount, channel) -> B -> C -> D means A will send amount with channel to B.

Type Hash256

A 256-bit hash (32 bytes), serialized as 0x-prefixed hex string.

On deserialization, both 0x-prefixed and non-prefixed hex strings are accepted. No domain-specific validation is performed — the only check is hex format and 32-byte length.


Type HashAlgorithm

HashAlgorithm is the hash algorithm used in the hash lock.

Enum with values of

  • ckb_hash - The default hash algorithm, CkbHash
  • sha256 - The sha256 hash algorithm

Type HopHint

A hop hint is a hint for a node to use a specific channel.

Fields

  • pubkey - Pubkey, The public key of the node
  • channel_outpoint - OutPoint, The outpoint of the channel
  • fee_rate - u64, The fee rate to use this hop to forward the payment.
  • tlc_expiry_delta - u64, The TLC expiry delta to use this hop to forward the payment.

Type HopRequire

A hop requirement to meet when building a router. Does not include the source node; the last hop is the target node.

Fields

  • pubkey - Pubkey, The public key of the node
  • channel_outpoint - Option<OutPoint>, The outpoint for the channel, which means use channel with channel_outpoint to reach this node

Type Htlc

The htlc data structure.

Fields

  • id - u64, The id of the htlc
  • amount - u128, The amount of the htlc
  • payment_hash - Hash256, The payment hash of the htlc
  • expiry - u64, The expiry of the htlc
  • forwarding_channel_id - Option<[Hash256](#type-hash256)>, If this HTLC is involved in a forwarding operation, this field indicates the forwarding channel. For an outbound htlc, it is the inbound channel. For an inbound htlc, it is the outbound channel.
  • forwarding_tlc_id - Option<u64>, If this HTLC is involved in a forwarding operation, this field indicates the forwarding tlc id.
  • status - TlcStatus, The status of the htlc

Type InboundTlcStatus

The status of an inbound tlc.

Enum with values of

  • RemoteAnnounced - Received tlc from remote party, but not committed yet
  • AnnounceWaitPrevAck - We received another AddTlc peer message when we are waiting for the ack of the last one.
  • AnnounceWaitAck - We have sent commitment signed to peer and waiting ACK for confirming this AddTlc
  • Committed - We have received ACK from peer and Committed this tlc
  • LocalRemoved - We have removed this tlc, but haven't received ACK from peer
  • RemoveAckConfirmed - We have received the ACK for the RemoveTlc, it's safe to remove this tlc

Type InvoiceData

The metadata of the invoice.

Fields

  • timestamp - u128, The timestamp of the invoice
  • payment_hash - Hash256, The payment hash of the invoice
  • attrs - Vec<[Attribute](#type-attribute)>, The attributes of the invoice, e.g. description, expiry time, etc.

Type NodeInfo

The Node information.

Fields

  • node_name - String, The name of the node.
  • version - String, The version of the node.
  • addresses - Vec<String>, The addresses of the node (serialized as strings).
  • features - Vec<String>, The node features supported by the node.
  • pubkey - Pubkey, The identity public key of the node (secp256k1 compressed, hex string), same as pubkey in list_peers.
  • timestamp - u64, The latest timestamp set by the owner for the node announcement. When a Node is online this timestamp will be updated to the latest value.
  • chain_hash - Hash256, The chain hash of the node.
  • auto_accept_min_ckb_funding_amount - u64, The minimum CKB funding amount for automatically accepting open channel requests.
  • udt_cfg_infos - UdtCfgInfos, The UDT configuration infos of the node.

Type OutboundTlcStatus

The status of an outbound tlc.

Enum with values of

  • LocalAnnounced - Offered tlc created and sent to remote party
  • Committed - Received ACK from remote party for this offered tlc
  • RemoteRemoved - Remote party removed this tlc
  • RemoveWaitPrevAck - We received another RemoveTlc message from peer when we are waiting for the ack of the last one.
  • RemoveWaitAck - We have sent commitment signed to peer and waiting ACK for confirming this RemoveTlc
  • RemoveAckConfirmed - We have received the ACK for the RemoveTlc, it's safe to remove this tlc

Type PaymentCustomRecords

The custom records to be included in the payment. The key is hex encoded of u32, it's range limited in 0 ~ 65535, and the value is hex encoded of Vec<u8> with 0x as prefix. For example:

"custom_records": {
   "0x1": "0x01020304",
   "0x2": "0x05060708",
   "0x3": "0x090a0b0c",
   "0x4": "0x0d0e0f10010d090a0b0c"
 }

Fields

  • data - HashMap<u32::Vec<u8>>, The custom records to be included in the payment.

Type PaymentStatus

The status of a payment, will update as the payment progresses. The transfer path for payment status is Created -> Inflight -> Success | Failed.

MPP Behavior: A single session may involve multiple attempts (HTLCs) to fulfill the total amount.

Enum with values of

  • Created - Initial status. A payment session is created, but no HTLC has been dispatched.
  • Inflight - The first hop AddTlc is sent successfully and waiting for the response.
  • Success - The payment is finished. All related HTLCs are successfully settled.
  • Failed - The payment session has terminated.

Type PeerInfo

The information about a peer connected to the node.

Fields

  • pubkey - Pubkey, The identity public key of the peer.
  • address - String, The multi-address associated with the connecting peer (as a string). Note: this is only the address which used for connecting to the peer, not all addresses of the peer. The graph_nodes in Graph rpc module will return all addresses of the peer.

Type Privkey

A private key byte array (32 bytes), serialized as hex without 0x prefix.

On deserialization, only hex format and 32-byte length are checked. Both 0x-prefixed and non-prefixed hex strings are accepted on input. Cryptographic validation is left to the RPC layer's conversion to internal Privkey.


Type Pubkey

A compressed public key (33 bytes), serialized as hex without 0x prefix.

On deserialization, only hex format and 33-byte length are checked (no secp256k1 validation). Both 0x-prefixed and non-prefixed hex strings are accepted on input. Cryptographic validation is left to the RPC layer's conversion to internal Pubkey.


Type RemoveTlcReason

The reason for removing a TLC.

Enum with values of

  • RemoveTlcFulfill - The reason for removing the TLC is that it was fulfilled
  • RemoveTlcFail - The reason for removing the TLC is that it failed

Type RevocationData

Data needed to revoke an outdated commitment transaction.

Fields

  • commitment_number - u64, The commitment transaction version number that was revoked
  • aggregated_signature - Vec<u8>, The aggregated signature from both parties that authorizes the revocation (hex string, 64 bytes)
  • output - CellOutput, The output cell from the revoked commitment transaction (hex-encoded molecule bytes)
  • output_data - Bytes, The associated data for the output cell (e.g., UDT amount for token transfers, hex-encoded molecule bytes)

Type RouterHop

A router hop information for a payment, a paymenter router is an array of RouterHop, a router hop generally implies hop target will receive amount_received with channel_outpoint of channel.

Fields

  • target - Pubkey, The node that is sending the TLC to the next node.
  • channel_outpoint - OutPoint, The channel of this hop used to receive TLC
  • amount_received - u128, The amount that the source node will transfer to the target node.
  • incoming_tlc_expiry - u64, The expiry for the TLC that the source node sends to the target node.

Type SessionRoute

The router is a list of nodes that the payment will go through.

Fields

  • nodes - Vec<[SessionRouteNode](#type-sessionroutenode)>, The nodes in the route

Type SessionRouteNode

The node and channel information in a payment route hop.

Fields

  • pubkey - Pubkey, The public key of the node
  • amount - u128, The amount for this hop
  • channel_outpoint - OutPoint, The channel outpoint for this hop

Type SettlementData

Data needed to authorize and execute a settlement transaction.

Fields

  • local_amount - u128, The total amount of CKB/UDT being settled for the local party
  • remote_amount - u128, The total amount of CKB/UDT being settled for the remote party
  • tlcs - Vec<[SettlementTlc](#type-settlementtlc)>, The list of pending Time-Locked Contracts (TLCs) included in this settlement

Type SettlementTlc

Data needed to authorize and execute a Time-Locked Contract (TLC) settlement transaction.

Fields

  • tlc_id - TLCId, The ID of the TLC (either offered or received)
  • hash_algorithm - HashAlgorithm, The hash algorithm used for the TLC
  • payment_amount - u128, The amount of CKB/UDT involved in the TLC
  • payment_hash - Hash256, The hash of the payment preimage
  • expiry - u64, The expiry time for the TLC in milliseconds
  • local_key - Privkey, The local party's private key used to sign the TLC (hex without 0x prefix)
  • remote_key - Pubkey, The remote party's public key used to verify the TLC (hex without 0x prefix)

Type TLCId

The id of a TLC, it can be either offered or received.

Enum with values of

  • Offered - u64, Offered TLC id
  • Received - u64, Received TLC id

Type TlcStatus

The status of a tlc.

Enum with values of


Type TransportType

The type of transport to filter by when resolving peer addresses.

Enum with values of

  • tcp - TCP transport (e.g. /ip4/1.2.3.4/tcp/8080)
  • ws - WebSocket transport (e.g. /ip4/1.2.3.4/tcp/8080/ws)
  • wss - WebSocket Secure transport (e.g. /dns/example.com/tcp/443/wss)

Type UdtArgInfo

The UDT argument info which is used to identify the UDT configuration.

Fields

  • name - String, The name of the UDT.
  • script - UdtScript, The script of the UDT.
  • auto_accept_amount - Option<u128>, The minimum amount of the UDT that can be automatically accepted.
  • cell_deps - Vec<[UdtDep](#type-udtdep)>, The cell deps of the UDT.

Type UdtCellDep

The UDT cell dep which is used to identify the UDT configuration for a Fiber Node.

Fields

  • out_point - OutPointWrapper, The out point of the cell dep.
  • dep_type - DepType, The type of the cell dep.

Type UdtCfgInfos

A list of UDT configuration infos.


Type UdtDep

Udt script on-chain dependencies.

Fields

  • cell_dep - Option<[UdtCellDep](#type-udtcelldep)>, cell dep described by out_point.
  • type_id - Option<Script>, cell dep described by type ID.

Type UdtScript

The UDT script which is used to identify the UDT configuration for a Fiber Node.

Fields

  • code_hash - H256, The code hash of the script.
  • hash_type - ScriptHashType, The hash type of the script.
  • args - String, The arguments of the script.

Fiber AI Assistant

Ask me anything

I can answer questions about Fiber Network using our documentation.

AI answers are based on Fiber documentation