Klaytn Docs Archive
Getting StartedBuild a dAppNode OperationDeveloper Hub
  • Klaytn Docs
  • -
    • Klaytn Overview
      • Why Klaytn
      • Klaytn Design
        • Consensus Mechanism
        • Accounts
        • Transactions
          • Basic
          • Fee Delegation
          • Partial Fee Delegation
          • Ethereum
        • Computation
          • Klaytn Smart Contract
          • Execution Model
          • Computation Cost
            • Computation Cost (Previous docs)
          • Klaytn Virtual Machine
            • Klaytn Virtual Machine (Previous docs)
        • Storage
          • State Migration
          • StateDB Live Pruning
        • Transaction Fees
          • Transaction Fees (Previous docs)
        • Klaytn native coin - KLAY
        • Token Economy
        • Governance
        • Multi-Channel
        • KNI
      • Scaling Solutions
    • Getting Started
      • Deploying Smart Contract Using Foundry
      • Deploying Smart Contract Using Hardhat
      • Deploying Smart Contract Using Thirdweb
      • Deploying Smart Contract Using KEN
        • Launch an Endpoint Node
        • Top up your Account
        • Install Development Tools
        • Deploy a Smart Contract
        • Check the Deployment
        • Account Management
          • Creating Accounts
          • Managing Accounts
      • Development Environment
      • Getting KLAY
    • Smart Contract
      • Solidity - Smart Contract Language
      • Precompiled Contracts
        • Precompiled Contracts (Previous docs)
      • IDE and Tools
        • Truffle
      • Sample Contracts
        • KlaytnGreeter
        • ERC-20
          • 1. Writing ERC-20 Smart Contract
          • 2. Deploying Smart Contract
          • 3. Interacting with ERC-20 token from Klaytn Wallet
        • ERC-721
          • 1. Writing ERC-721 Smart Contract
          • 2. Deploying Smart Contract
      • Testing Guide
      • Deployment Guide
      • Klaytn Compatible Tokens
      • Porting Ethereum Contract
    • Run a Node
      • Deployment
        • Endpoint Node
          • System Requirements
          • Installation Guide
            • Download
            • Installation Guide
            • Configuration
            • Startup the EN
            • Testing the Installation
          • ken CLI commands
          • JSON-RPC APIs
        • Core Cell
          • System Requirements
          • Network Configuration
          • Installation Guide
            • Download
            • Before You Install
            • Consensus Node Setup
              • Installation Guide
              • Configuration
              • Startup the CN
            • Proxy Node Setup
              • Installation Guide
              • Configuration
              • Startup the PN
            • Testing the Core Cell
          • Monitoring Setup
          • H/A Setup
        • Service Chain
          • Getting Started
            • Setting up a 4-node Service Chain
            • Connecting to Baobab
            • Cross-Chain Value Transfer
            • HA(High Availability) for ServiceChain
            • Nested ServiceChain
            • Value Transfer between Sibling ServiceChains
          • Reference Manuals
            • System Requirements
            • Download
            • SCN User Guide
              • Installation
              • Configuration
              • Starting/Stopping SCN
              • Checking Node Status
              • kscn commands
              • homi commands
            • SPN/SEN User Guide
              • Installation
              • Configuration
              • Starting/Stopping Node
              • Checking Node Status
            • Bridge Configuration
            • Anchoring
            • KAS Anchoring
            • Value Transfer
            • Configuration Files
            • Log Files
            • Genesis JSON
            • Upgrade & Hard Fork
          • How-To Guides
        • Download Node Packages
          • v1.12.0
          • v1.11.1
          • v1.11.0
          • v1.10.2
          • v1.10.1
          • v1.10.0
          • v1.9.1
          • v1.9.0
          • v1.8.4
          • v1.8.3
          • v1.8.2
          • v1.8.1
          • v1.8.0
          • v1.7.3
          • v1.7.2
          • v1.7.1
          • v1.7.0
          • v1.6.4
          • v1.6.3
          • v1.6.2
          • v1.6.1
          • v1.6.0
          • v1.5.3
          • v1.5.2
          • v1.5.1
          • v1.5.0
          • v1.4.2
          • v1.4.1
          • v1.4.0
          • v1.3.0
          • v1.2.0
          • v1.1.1
          • v1.0.0
          • v0.9.6
          • v0.8.2
    • Operation Guide
      • Configuration
      • Node Log
      • Log operation
      • Errors & Troubleshooting
      • Klaytn Command
      • Chaindata Change
      • Chaindata Migration
    • dApp Developers
      • JSON-RPC APIs
        • API references
          • eth
            • Caution
            • Account
            • Block
            • Transaction
            • Config
            • Filter
            • Gas
            • Miscellaneous
          • klay
            • Account
            • Block
            • Transaction
              • Working with Klaytn Transaction Types
            • Configuration
            • Filter
            • Gas
            • Miscellaneous
          • net
          • debug
            • Logging
            • Profiling
            • Runtime Tracing
            • Runtime Debugging
            • VM Tracing
            • VM Standard Tracing
            • Blockchain Inspection
          • admin
          • personal
          • txpool
          • governance
        • Service Chain API references
          • mainbridge
          • subbridge
        • Transaction Error Codes
      • RPC Service Providers
        • Public Endpoints
      • SDK & Libraries for interacting with Klaytn Node
        • caver-js
          • Getting Started
          • Sending a sample transaction
          • API references
            • caver.account
            • caver.wallet
              • caver.wallet.keyring
            • caver.transaction
              • Basic
              • Fee Delegation
              • Partial Fee Delegation
            • caver.rpc
              • caver.rpc.klay
              • caver.rpc.net
              • caver.rpc.governance
            • caver.contract
            • caver.abi
            • caver.kct
              • caver.kct.kip7
              • caver.kct.kip17
              • caver.kct.kip37
            • caver.validator
            • caver.utils
            • caver.ipfs
          • caver-js ~v1.4.1
            • Getting Started (~v1.4.1)
            • API references
              • caver.klay
                • Account
                • Block
                • Transaction
                  • Legacy
                  • Value Transfer
                  • Value Transfer Memo
                  • Account Update
                  • Smart Contract Deploy
                  • Smart Contract Execution
                  • Cancel
                • Configuration
                • Filter
                • Miscellaneous
              • caver.klay.net
              • caver.klay.accounts
              • caver.klay.Contract
              • caver.klay.KIP7
              • caver.klay.KIP17
              • caver.klay.abi
              • caver.utils (~v1.4.1)
            • Porting from web3.js
        • caver-java
          • Getting Started
          • API references
          • caver-java ~v1.4.0
            • Getting Started (~v1.4.0)
            • Porting from web3j
        • ethers.js
        • web3.js
      • Tutorials
        • Klaytn Online Toolkit
        • Fee Delegation Example
        • Count DApp
          • 1. Environment Setup
          • 2. Clone Count DApp
          • 3. Directory Structure
          • 4. Write Smart Contract
          • 5. Frontend Code Overview
            • 5-1. Blocknumber Component
            • 5-2. Auth Component
            • 5-3. Count Component
          • 6. Deploy Contract
          • 7. Run App
        • Klaystagram
          • 1. Environment Setup
          • 2. Clone Klaystagram DApp
          • 3. Directory Structure
          • 4. Write Klaystagram Smart Contract
          • 5. Deploy Contract
          • 6. Frontend Code Overview
          • 7. FeedPage
            • 7-1. Connect Contract to Frontend
            • 7-2. UploadPhoto Component
            • 7-3. Feed Component
            • 7-4. TransferOwnership Component
          • 8. Run App
        • Building a Buy Me a Coffee dApp
          • 1. Project Setup
          • 2. Creating a BMC Smart Contract
          • 3. Testing the contract using scripts
          • 4. Deploying BMC Smart contract
          • 5. Building the BMC Frontend with React and Web3Onboard
          • 6. Deploying Frontend code on IPFS using Fleek
          • 7. Conclusion
        • Migrating Ethereum App to Klaytn
        • Connecting MetaMask
        • Connecting Remix
        • Verifying Smart Contracts Using Block Explorers
      • Developer Tools
        • Wallets
          • Kaikas
          • Klaytn Wallet
          • Klaytn Safe
            • Klaytn Safe Design
            • Create a Safe
            • Add assets
            • Send assets
            • Contract Interaction
            • Transaction Builder
            • Points to Note
            • Frequently Asked Questions
          • SafePal S1
          • Wallet Libraries
            • Web3Auth
            • Web3Modal
            • Web3-Onboard
            • Particle Network
        • Oracles
          • Orakl Network
          • Witnet
          • SupraOracles
        • Indexers
          • SubQuery
        • Cross-chain
          • LayerZero
        • Block Explorers
          • Klaytnscope
          • Klaytnfinder
        • Klaytn Contracts Wizard
    • Glossary
  • ---
    • Klaytn Hard Fork History
    • Klaytn 2.0
      • Metaverse Package
      • Finality and Improvements
      • Ethereum Compatibility
      • Decentralizing Governance
      • Massive Eco Fund
    • FAQ
    • Open Source
    • Terms of Use
    • Languages
  • ℹ️Latest Klaytn Docs
Powered by GitBook
On this page
  • subbridge_nodeInfo
  • subbridge_addPeer
  • subbridge_removePeer
  • subbridge_parentOperator
  • subbridge_childOperator
  • subbridge_parentOperatorNonce
  • subbridge_childOperatorNonce
  • subbridge_parentOperatorBalance
  • subbridge_childOperatorBalance
  • subbridge_sendChainTxslimit
  • subbridge_anchoring
  • subbridge_latestAnchoredBlockNumber
  • subbridge_getReceiptFromParentChain
  • subbridge_deployBridge
  • subbridge_registerBridge
  • subbridge_deregisterBridge
  • subbridge_subscribeBridge
  • subbridge_unsubscribeBridge
  • subbridge_registerToken
  • subbridge_deregisterToken
  • subbridge_convertRequestTxHashToHandleTxHash
  • subbridge_listBridge
  • subbridge_getBridgeInformation
  • subbridge_txPendingCount
  • subbridge_txPending
  1. -
  2. dApp Developers
  3. JSON-RPC APIs
  4. Service Chain API references

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.nodeInfo
{
  kni: "kni://f8a1f0cd1e2bebeece571e4fda16e215218fd4b9bc2eddd924f7cd5b5f950fcec8f4b8cd3851390d1d0bacf1b15e1c4a38c882252e429a28d16eeb6edbacd726@[::]:50505?discport=0",
  id: "f8a1f0cd1e2bebeece571e4fda16e215218fd4b9bc2eddd924f7cd5b5f950fcec8f4b8cd3851390d1d0bacf1b15e1c4a38c882252e429a28d16eeb6edbacd726",
  ip: "::",
  listenAddr: "[::]:50505",
  name: "-2",
  ports: {
    discovery: 0,
    listener: 50505
  },
  protocols: {
    servicechain: {
      config: {
        chainId: 2018,
        deriveShaImpl: 0,
        isBFT: true,
        istanbul: {...},
        unitPrice: 0
      },
      difficulty: 87860,
      genesis: "0x711ce9865492659977abb2758d29f68c2b0c82862d9376f25953579f64f95b58",
      head: "0x0d4b130731f1e7560e4531ac73d55ac8c6daccb178abd86af0d96b7aafded7c5",
      network: 1
    }
  }
}

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 kni URL.

Return Value

Type
Description

bool

true if the peer was accepted, false otherwise.

Example

Console

> mainbridge.addPeer("kni://a979fb...1163c@10.0.0.1:50505") // or 'subbridge.addPeer'
true

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"mainbridge_addPeer","params":["kni://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@10.0.0.1:50505"],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":true}

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 kni URL.

Return Value

Type
Description

bool

true if the peer was removed, false otherwise.

Example

Console

> mainbridge.removePeer("kni://a979fb...1163c@10.0.0.1:50505") // or 'subbridge.removePeer'
true

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"mainbridge_removePeer","params":["kni://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@10.0.0.1:50505"],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":true}

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.parentOperator
"0xA057995175B93Ee0D1bdfA54f078Ad0F0116130b"

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.childOperator
"0x5C1C757a6Cb6c6FcEFE398674D8209FDA2A74Df4"

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.parentOperatorNonce
1348

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.childOperatorNonce
1024

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.parentOperatorBalance
1e+50

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.childOperatorBalance
1e+50

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.sendChainTxslimit
100

subbridge_anchoring

The subbridge_anchoring can enable/disable the anchoring feature of the service chain.

Parameters

Name
Type
Description

enable

Bool

true enables the anchoring feature, false disables it.

Return Value

Type
Description

bool

true if the anchoring was enabled, false otherwise.

Example

Console

> subbridge.anchoring(true)
true
> subbridge.anchoring(false)
false

HTTP RPC

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"subbridge_anchoring","params":[true],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":true}
$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"subbridge_anchoring","params":[false],"id":1}' https://public-en-baobab.klaytn.net
{"jsonrpc":"2.0","id":1,"result":false}

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.latestAnchoredBlockNumber
71025

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 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.getReceiptFromParentChain("0x4f300d6574e71d7940c88fe08f27d9ac45cbc7b81d45c17e848d3772f64377b5")
{
  contractAddress: "0x0000000000000000000000000000000000000000",
  gasUsed: "0x9470",
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  status: "0x1",
  transactionHash: "0x3641f52359f44ef2a9941ea840aed4befbace5cac28d5cc8cacd94eae211fd1e"
}

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.deployBridge()
["0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4"]

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

null if the registration succeeds, Error object otherwise.

Example

> subbridge.registerBridge("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4")
null

> subbridge.registerBridge("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4")
Error: bridge already exists

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

null if the deregistration succeeds, Error object otherwise.

Example

> subbridge.deregisterBridge("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4")
null

> subbridge.deregisterBridge("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4")
Error: invalid bridge pair

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

null if the subscribing succeeds, Error object otherwise.

Example

> subbridge.subscribeBridge("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4")
null
> subbridge.subscribeBridge("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4")
Error: already subscribed

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

null if the unsubscribing succeeds, Error object otherwise.

Example

> subbridge.unsubscribeBridge("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4")
null

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

null if the registration succeeds, Error object otherwise.

Example

> subbridge.registerToken("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4","0xA4b0c6e12346426a09FaD70dAE0651E6Dbdd5198","0x865Cca53828C91663BFf0Ca9808827Bac552BAec")
null
> subbridge.registerToken("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4","0xA4b0c6e12346426a09FaD70dAE0651E6Dbdd5198","0x865Cca53828C91663BFf0Ca9808827Bac552BAec")
Error: token already exists

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

null if the deregistration succeeds, Error object otherwise.

Example

> subbridge.deregisterToken("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4","0xA4b0c6e12346426a09FaD70dAE0651E6Dbdd5198","0x865Cca53828C91663BFf0Ca9808827Bac552BAec")
null
> subbridge.deregisterToken("0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a", "0x23dab942822021bbd6d551ef51003208924877e4","0xA4b0c6e12346426a09FaD70dAE0651E6Dbdd5198","0x865Cca53828C91663BFf0Ca9808827Bac552BAec")
Error: invalid token pair

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.convertRequestTxHashToHandleTxHash("0xae5604f8673098436ee4eaf1b453f1a395afccd6e8eb674c60edd63ebb047622")
"0x97493d1a91d65c149763209be6535efdacf8f1b50c99daa22abf06502010b2ee"
> subbridge.convertRequestTxHashToHandleTxHash("0xc585cfd1e7047b4faae69e62e77db192d8a339701b40d6ab4adb58453b934bec")
"0x0000000000000000000000000000000000000000000000000000000000000000"

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

true if the pair of bridge contracts is subscribed, false otherwise.

Example

> subbridge.listBridge
[{
    localAddress: "0x27caeba831d98b5fbb1d81ce0ed20801702f443a",
    remoteAddress: "0x22c41ae528627b790233d2e59ea520be12350eb5",
    subscribed: true
}, {
    localAddress: "0x376b72abe1b29cace831bd3f5acdfa967814c9cd",
    remoteAddress: "0x53160735f7cc6ff75e48619f368bb94daff66a1b",
    subscribed: false
}, {
    localAddress: "0x87d6b9c567e5b84cd00e03bfbe6d20d88209c33a",
    remoteAddress: "0x23dab942822021bbd6d551ef51003208924877e4",
    subscribed: false
}]

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

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.getBridgeInformation("0x27caeba831d98b5fbb1d81ce0ed20801702f443a")
{
  counterPart: "0x0000000000000000000000000000000000000000",
  handleNonce: 0,
  lowerHandleNonce: 0,
  isRunning: true,
  isSubscribed: true,
  onServiceChain: true,
  pendingEventSize: 0,
  requestNonce: 0
}

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.txPendingCount
2

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

> subbridge.txPending
{
  0xa057995175b93ee0d1bdfa54f078ad0f0116130b: [{
      from: "0xa057995175b93ee0d1bdfa54f078ad0f0116130b",
      gas: "0x186a0",
      gasPrice: "0x5d21dba00",
      hash: "0x284c8f5bc82ef987c3a14fc8dac7933beb528777745987ff790014441f26ca03",
      input: "0xf8a9a063f41a6ec8e2f8074c30fccf11f2b8479e7ebd8a0e5aa0c171623bc1f3812e33a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0f845557d8dc2175974f29c2e9d12b1a57f634acaafdf56ae7033201a0796bedea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a09109530b191b47ca3d91012faba70fcf307f13b030f19d932cab38f2c1ece7b78304157c",
      nonce: "0x41589",
      signatures: [{...}],
      type: "TxTypeChainDataAnchoring",
      typeInt: 72
  }, {
      from: "0xa057995175b93ee0d1bdfa54f078ad0f0116130b",
      gas: "0x186a0",
      gasPrice: "0x5d21dba00",
      hash: "0x4dd093916a419608091da28b5d7ffc6e34d894ddaac96328f1904bfef93a4ad0",
      input: "0xf8a9a05b0dd6cc938916e37b17b602690399987b4e8540a14a494626d85e947f721a10a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a063f41a6ec8e2f8074c30fccf11f2b8479e7ebd8a0e5aa0c171623bc1f3812e33a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a09109530b191b47ca3d91012faba70fcf307f13b030f19d932cab38f2c1ece7b78304157d",
      nonce: "0x4158a",
      signatures: [{...}],
      type: "TxTypeChainDataAnchoring",
      typeInt: 72
  }]
}
PreviousmainbridgeNextTransaction Error Codes

Last updated 2 years ago