This article summarizes the concept of a hybrid blockchain, describes a simple use case scenario, and then walks through the scenario with a demonstration. Follow along at http://hybrid.chainweb.com/ to experience Kadena’s hybrid blockchain yourself.
A hybrid blockchain application allows public and private blockchain networks to share data between them (“interoperate”) through smart contracts deployed on each network, respectively. The smart contracts from both networks communicate through a bridge.
In practice, a hybrid blockchain transaction is composed of three parts. For example:
A user posts new data to a smart contract on Kadena’s public chain
Once mined, this transaction is recognized by a piece of middleware that acts as a bridge between the two networks
The bridge calls the corresponding smart contract on the private chain to execute a task
- Data sharing can be bi-directional, starting on either the private or public side and moving to the other.
Traditional banking (current state)
Transferring funds between bank accounts takes moments to approve but days to settle in the United States, leaving the recipient unable to access pending funds. Transaction settlement involves numerous intermediaries operating only during traditional business hours.
Hybrid blockchain solution
In this example, using smart contracts in a hybrid application allows customers to convert crypto assets on the public network into a stablecoin, which can move between public and private blockchain networks. On the public side, participants experience the usual ~1 minute transaction settlement on the Kadena Proof-of-Work network, an easily-verifiable and secure payment system. On the private side, participants benefit from instant transaction settlement and reduced operational complexity.
Note: This is a simplified use case designed to illustrate how data moves across a hybrid blockchain. To read more industry use cases and discover the real-world benefits enabled by hybrid blockchain, see Hybrid Blockchain 101 and the Smart Contract Sharing Economy.
The demo requires that users install (1) Chainweaver and have a (2) Testnet account with some funds:
Download the crypto wallet Chainweaver to generate a key pair.
Visit the Coin Faucet and select “Create Account” (creating an account this way automatically funds the account with 10 KDA on Testnet).
“Kadena (KDA)” is the native cryptocurrency for the Kadena Public network.
“StablecoinX (SCX)” is a stablecoin which trades 1:1 with KDA on the public network.
“SCX InstantPay” is the token used for instant transaction settlement on the private network.
Follow along with the full demo video, or by using the walkthrough instructions below.
Visit http://hybrid.chainweb.com/ and enter your account name
With Chainweaver open, select “Buy SCX.” This will prompt a signing request within Chainweaver.
Sign the transaction by filling out the dialog screens:
“Configuration” tab: No action needed. Press “Next.”
“Sign” tab: Use the public key associated with your account to grant the
transfercapabilities. Press “Next.”
“Preview” tab: In the Raw Response section, you should see `”Write succeeded.” Press “Submit.”
Then allow ~1 minute for the transaction to clear. Select “Refresh Balances” to confirm success.
- Transfer SCX from the public network to get SCX InstantPay on the private network
Sign the transaction using Chainweaver (as before), allow ~1 minute for the transaction to clear, then select “Refresh Balances” to confirm success.
- Transfer SCX InstantPay coins to any existing SCX InstantPay account
Sign the transaction using the demo’s private network in Chainweaver.
“Configuration” tab: Private network transactions do not require any gas, so you may ignore the gas configuration settings. Press “Next”.
“Sign” tab: The Grant Capabilities sub-section may be left blank. In the Unrestricted Signing Keys sub-section, check the box beside the signing account’s public key. Press “Next”.
“Preview” tab: In the Raw Response section, you should see ”Write succeeded” (in some cases you might see “Couldn’t get a response from the node” but you may still proceed). Press “Submit”.
Note: In order to execute transactions on the private network, you must first change the active network within Chainweaver from “Testnet” to a custom network consisting of the private network’s nodes.
For the demonstration, let’s call this private network “Kuro.”
Here’s how to add a custom network to Chainweaver:
In Chainweaver, select the Settings option from the left-side menu, then select Network
Within the Edit Networks section, enter the new network name “Kuro,” then press “Create”
In the network list, find this new network and press the arrow button to expand the network’s node list. Add 4 nodes to the network: 126.96.36.199:9002, 188.8.131.52:9000, 184.108.40.206:9001, 220.127.116.11:9003
Finish by selecting “Ok” to close the Network Settings dialog screen
- Transfer SCX InstantPay coins on the private network back into SCX coins on the public network
Sign the transaction using the demo’s private network in Chainweaver. Your SCX InstantPay balance will immediately go down, and your SCX balance will go up in ~1 minute once the transaction is mined in a block.
- Sell SCX to return funds back into KDA
Toggle the active network within Chainweaver back to “Testnet.”
Sign the transaction using Chainweaver, then allow ~1 minute for the transaction to clear. Select “Refresh Balances” to confirm success.
To take a closer look at the technical implementation of this Hybrid Demo, you can view the open-source GitHub repository here, the public chain hybrid exchange smart contract here, and the private chain token smart contract here.
A hybrid blockchain application takes advantage of both the efficiency and availability of a public network, and the security and fast finality of a private network. With hybrid apps, we can start to create secure digital marketplaces, and businesses can launch safe, private blockchain-based solutions that also have the ease of access and scalability of a massively-parallel Proof-of-Work blockchain. This new landscape allows for unprecedented levels of business cooperation through safe and verified data sharing across private and public networks. Only hybrid blockchain can capture both the decentralization of public networks and the security controls of private networks.