subbridge
APIs related to service chain ENs.
The namespace subbridge
provides functions related to Service Chain. To use the functions in this namespace, the option subbridge
should be enabled in the SEN connected to the service chain.
subbridge_nodeInfo
Returns bridge node information including the KNI (Klaytn Network Identifier) of the node. A subbridge node can connect to a mainbridge node via the KNI.
Parameters
None
Return Value
Type | Description |
---|---|
JSON string | the bridge node information. |
Example
subbridge_addPeer
Returns true
if adding a mainbridge peer is done successfully.
The addPeer
method adds a new remote node to the peer list. The node will try to maintain connectivity to these nodes at all times, reconnecting every once in a while if the remote connection goes down.
The method accepts a single argument, the kni
URL of the remote peer to start tracking and returns a BOOL
indicating whether the peer was accepted for tracking or some error occurred.
Parameters
Name | Type | Description |
---|---|---|
url | string | Peer's |
Return Value
Type | Description |
---|---|
bool |
|
Example
Console
HTTP RPC
subbridge_removePeer
Returns true
if removing the peer is done successfully.
The removePeer
method disconnects and removes the remote node in the list of tracked static nodes. The method accepts a single argument, the kni
URL of the remote peer to start tracking and returns a BOOL
indicating whether the peer was accepted for tracking or some error occurred.
Parameters
Name | Type | Description |
---|---|---|
url | string | Peer's |
Return Value
Type | Description |
---|---|
bool |
|
Example
Console
HTTP RPC
subbridge_parentOperator
The subbridge_parentOperator
returns the parent operator account address.
Parameters
none
Return Value
Type | Description |
---|---|
Account | Parent chain operator account address. |
Example
subbridge_childOperator
The subbridge_childOperator
returns the child operator account address.
Parameters
none
Return Value
Type | Description |
---|---|
Account | Child chain operator account address. |
Example
subbridge_parentOperatorNonce
The subbridge_parentOperatorNonce
returns the nonce of the parent operator account address.
Parameters
none
Return Value
Type | Description |
---|---|
QUANTITY | Integer of the number of transactions sent from the parent operator account. |
Example
subbridge_childOperatorNonce
The subbridge_childOperator
returns the child operator account address.
Parameters
none
Return Value
Type | Description |
---|---|
QUANTITY | Integer of the number of transactions sent from the child operator account. |
Example
subbridge_parentOperatorBalance
The subbridge_parentOperatorBalance
returns the balance of the parent operator account.
Parameters
none
Return Value
Type | Description |
---|---|
QUANTITY | Integer of the current balance of the parent operator account. |
Example
subbridge_childOperatorBalance
The subbridge_childOperatorBalance
returns the balance of the child operator account.
Parameters
none
Return Value
Type | Description |
---|---|
QUANTITY | Integer of the current balance of the child operator account. |
Example
subbridge_sendChainTxslimit
The sendChainTxslimit
gets the maximum number of pending transactions to pick up for sending at once.
Parameters
None
Return Value
Type | Description |
---|---|
Uint64 | the maximum number of pending transactions to pickup for sending at once. |
Example
subbridge_anchoring
The subbridge_anchoring
can enable/disable the anchoring feature of the service chain.
Parameters
Name | Type | Description |
---|---|---|
enable | Bool |
|
Return Value
Type | Description |
---|---|
bool |
|
Example
Console
HTTP RPC
subbridge_latestAnchoredBlockNumber
The subbridge_latestAnchoredBlockNumber
returns the latest anchored block number of the service chain.
Parameters
None
Return Value
Type | Description |
---|---|
Uint64 | The latest anchored block number. |
Example
subbridge_getReceiptFromParentChain
The subbridge_getReceiptFromParentChain
returns the receipt of the anchoring transaction.
Parameters
Type | Description |
---|---|
32-byte DATA | The child chain block hash that was included the anchoring tx hash. |
Return Value
Object
- A transaction receipt object, or null
when no receipt was found.
Name | Type | Description |
---|---|---|
contractAddress | DATA | The contract address created, if the transaction was a contract creation, otherwise |
gasUsed | QUANTITY | The amount of gas used by this specific transaction alone. |
logs | Array | Array of log objects, which this transaction generated. |
logsBloom | 256-byte DATA | Bloom filter for light clients to quickly retrieve related logs. |
status | QUANTITY | Either |
transactionHash | 32-byte DATA | Hash of the transaction. |
Example
subbridge_deployBridge
The subbridge_deployBridge
deploys a bridge contract to the parent and child chains and returns the addresses of deployed bridge contracts. This method also registers the bridge contracts with the sub-bridge.
Parameters
none
Return Value
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of bridge contract on child chain. |
account | 20-byte DATA | Address of bridge contract on parent chain. |
Example
subbridge_registerBridge
The subbridge_registerBridge
registers already deployed bridge contracts in the parent and child chains.
Parameters
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of bridge contract on child chain. |
account | 20-byte DATA | Address of bridge contract on parent chain. |
Return Value
Name | Type | Description |
---|---|---|
error | Error |
|
Example
subbridge_deregisterBridge
The subbridge.deregisterBridge
deregisters already registered bridge contracts in the parent/child chain.
Parameters
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of bridge contract on child chain. |
account | 20-byte DATA | Address of bridge contract on parent chain. |
Return Value
Name | Type | Description |
---|---|---|
error | Error |
|
Example
subbridge_subscribeBridge
The subbridge_subscribeBridge
subscribes to the registered bridge contracts in the parent and child chains. If the sub-bridge node is subscribed to the bridge contract pair, cross-chain value-transfer requests are handled automatically by the sub-bridge.
Parameters
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of bridge contract on child chain. |
account | 20-byte DATA | Address of bridge contract on parent chain. |
Return Value
Name | Type | Description |
---|---|---|
error | Error |
|
Example
subbridge_unsubscribeBridge
The subbridge_unsubscribeBridge
unsubscribes the sub-bridge from the bridge contracts in the parent and child chains. If the sub-bridge is unsubscribed from the bridge contracts, cross-chain value transfer requests can not be handled by the sub-bridge.
Parameters
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of bridge contract on child chain. |
account | 20-byte DATA | Address of bridge contract on parent chain. |
Return Value
Name | Type | Description |
---|---|---|
error | Error |
|
Example
subbridge_registerToken
The subbridge_registerToken
registers a pair of ERC-20 or 721 tokens with the bridge contracts.
Parameters
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of bridge contract on child chain. |
account | 20-byte DATA | Address of bridge contract on parent chain. |
account | 20-byte DATA | Address of token contract on child chain. |
account | 20-byte DATA | Address of token contract on parent chain. |
Return Value
Name | Type | Description |
---|---|---|
error | Error |
|
Example
subbridge_deregisterToken
The subbridge_deregisterBridge
deregisters already registered token pair from the bridge contracts.
Parameters
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of bridge contract on child chain. |
account | 20-byte DATA | Address of bridge contract on parent chain. |
account | 20-byte DATA | Address of token contract on child chain. |
account | 20-byte DATA | Address of token contract on parent chain. |
Return Value
Name | Type | Description |
---|---|---|
error | Error |
|
Example
subbridge_convertRequestTxHashToHandleTxHash
The subbridge_convertRequestTxHashToHandleTxHash
returns the corresponding "handle value transfer transaction" hash in the opposite chain for the given "request value transfer transaction" hash. "Request value transfer transaction" is a transaction initiated by a user, requesting a cross-chain value transfer. "Handle value transfer transaction" is the transaction created by the sub-bridge to handle the value transfer request from the user.
Parameters
Name | Type | Description |
---|---|---|
Hash | 32-byte DATA | Hash of a "request value transfer" transaction. |
Return Value
Name | Type | Description |
---|---|---|
Hash | 32-byte DATA | Hash of a "handle value transfer" transaction. zero hash means there is no corresponding "handle value transfer" transaction. |
Example
subbridge_listBridge
The subbridge_listBridge
returns the list of all bridge contract pairs that are registered (stored) in the sub-bridge.
Parameters
nonce
Return Value
Name | Type | Description |
---|---|---|
localAddress | account | 20-byte DATA |
localAddress | account | 20-byte DATA |
subscribed | bool |
|
Example
subbridge_getBridgeInformation
The subbridge_getBridgeInformation
returns the information of the given bridge contract.
Parameters
Name | Type | Description |
---|---|---|
account | 20-byte DATA | Address of a bridge contract |
Return Value
Name | Type | Description |
---|---|---|
counterPart | 20-byte DATA | Address of the counterpart bridge contract. (Not supported yet) |
isRunning | bool |
|
isSubscribed | bool |
|
onServiceChain | bool |
|
pendingEventSize | QUANTITY | Number of pending "request value transfer" events generated by the bridge contracts, not handled yet by the sub-bridge. |
requestNonce | QUANTITY | Request nonce of the bridge contract. |
handleNonce | QUANTITY | Upper handle nonce of the bridge contract. |
lowerHandleNonce | QUANTITY | Lower handle nonce of the bridge contract. |
Example
subbridge_txPendingCount
The subbridge_txPendingCount
returns the number of pending transactions in the bridge transaction pool.
Parameters
None
Return Value
Type | Description |
---|---|
Uint64 | The number of pending transactions in the bridge transaction pool. |
Example
subbridge_txPending
The subbridge_txPending
returns the list of pending transactions in the bridge transaction pool.
Parameters
None
Return Value
Type | Description |
---|---|
JSON string | List of pending transactions in the bridge transaction pool. |
Example
Last updated