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
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
url
string
Peer's kni
URL.
Return Value
bool
true
if the peer was accepted, false
otherwise.
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
url
string
Peer's kni
URL.
Return Value
bool
true
if the peer was removed, false
otherwise.
Example
Console
HTTP RPC
subbridge_parentOperator
The subbridge_parentOperator
returns the parent operator account address.
Parameters
none
Return Value
Account
Parent chain operator account address.
Example
subbridge_childOperator
The subbridge_childOperator
returns the child operator account address.
Parameters
none
Return Value
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
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
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
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
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
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
enable
Bool
true
enables the anchoring feature, false
disables it.
Return Value
bool
true
if the anchoring was enabled, false
otherwise.
Example
Console
HTTP RPC
subbridge_latestAnchoredBlockNumber
The subbridge_latestAnchoredBlockNumber
returns the latest anchored block number of the service chain.
Parameters
None
Return Value
Uint64
The latest anchored block number.
Example
subbridge_getReceiptFromParentChain
The subbridge_getReceiptFromParentChain
returns the receipt of the anchoring transaction.
Parameters
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.
contractAddress
DATA
The contract address created, if the transaction was a contract creation, otherwise null
. (will be deprecated)
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 1
(success) or 0
(failure).
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
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
account
20-byte DATA
Address of bridge contract on child chain.
account
20-byte DATA
Address of bridge contract on parent chain.
Return Value
error
Error
null
if the registration succeeds, Error object otherwise.
Example
subbridge_deregisterBridge
The subbridge.deregisterBridge
deregisters already registered bridge contracts in the parent/child chain.
Parameters
account
20-byte DATA
Address of bridge contract on child chain.
account
20-byte DATA
Address of bridge contract on parent chain.
Return Value
error
Error
null
if the deregistration succeeds, Error object otherwise.
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
account
20-byte DATA
Address of bridge contract on child chain.
account
20-byte DATA
Address of bridge contract on parent chain.
Return Value
error
Error
null
if the subscribing succeeds, Error object otherwise.
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
account
20-byte DATA
Address of bridge contract on child chain.
account
20-byte DATA
Address of bridge contract on parent chain.
Return Value
error
Error
null
if the unsubscribing succeeds, Error object otherwise.
Example
subbridge_registerToken
The subbridge_registerToken
registers a pair of ERC-20 or 721 tokens with the bridge contracts.
Parameters
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
error
Error
null
if the registration succeeds, Error object otherwise.
Example
subbridge_deregisterToken
The subbridge_deregisterBridge
deregisters already registered token pair from the bridge contracts.
Parameters
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
error
Error
null
if the deregistration succeeds, Error object otherwise.
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
Hash
32-byte DATA
Hash of a "request value transfer" transaction.
Return Value
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
localAddress
account
20-byte DATA
localAddress
account
20-byte DATA
subscribed
bool
true
if the pair of bridge contracts is subscribed, false
otherwise.
Example
subbridge_getBridgeInformation
The subbridge_getBridgeInformation
returns the information of the given bridge contract.
Parameters
account
20-byte DATA
Address of a bridge contract
Return Value
counterPart
20-byte DATA
Address of the counterpart bridge contract. (Not supported yet)
isRunning
bool
true
if the bridge contract is running, false
otherwise.
isSubscribed
bool
true
if the bridge contract is subscribed, false
otherwise.
onServiceChain
bool
true
if the bridge contact is on child (service) chain, false
otherwise.
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
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
JSON string
List of pending transactions in the bridge transaction pool.
Example
Last updated