ConsenSys has published a paper that details a method of connecting public and private blockchains through a new Atomic Crosschain Transaction technology. They say:
“We propose a crosschain technique which allows transactions to be executed atomically across sidechains, introduce a new mechanism for proving values across sidechains, describe a transaction locking mechanism which works in the context of blockchain to enable atomic transactions, and a methodology for providing a global time-out across sidechains.”
The paper goes into step by step instructions on how to establish this interoperability system, but at a high level conceptual view, we can first consider the Lightning Network (LN) and how it is kind of a sidechain.
LN uses Hashed Timelock Contracts. That is you lock your bitcoin in a multi-sig address (channel) and get a hash that proves how much you have locked. You can share this hash with the receiver who then agrees to the transfer.
The LN nodes, plus bitcoin nodes, can see there was an exchange and an agreement, thus process the transaction and enforce the contract.
Ethereum has smart contracts. So here you have a smart contract on Blockchain A and a smart contract on Blockchain B. You lock the eth on one blockchain, you present the proof of how much was locked, and you unlock it on the other blockchain.
Here too you need to run the node of both Blockchain A and B. In this paper they call them MultiNodes, so you can have C, D… whichever chain you are interested in, transacting in, or validating.
To connect these two smart contracts, there’s a cross-chain transaction. This will get a bit technical, but the paper says:
“A Crosschain Transaction consists of an Originating Transaction and one or more Subordinate Transactions and Subordinate Views, where the Originating Transaction is the Ethereum Transaction which executes on the sidechain on which the Crosschain Transaction was submitted, and the Subordinate Transactions and Subordinate Views are Ethereum Transactions and Ethereum Views which execute on other sidechains as a result of the Originating Transaction.”
The paper says “Ethereum Transactions update the state of the distributed ledger of an Ethereum blockchain but can not return a value. Ethereum Views return values but can not update the state.”
So a cross-chain transaction is one that contains the needed information about the transactions on blockchain A and B and executes both of them.
How? Well the transactions and views contain signed parameters which must match the actual values passed in via the Ethereum Virtual Machine. In other words, hashes, but with smart contract stuff.
“The Coordinating Node on the Originating Sidechain works with other Originating Sidechain validators to threshold sign a Crosschain Transaction Start message. This message contains the Crosschain Transaction Identifier, the Originating Sidechain Identifier, and the Crosschain Transaction Timeout.”
Coordinating nodes here are merely the sidechain specific nodes with threshold signatures being a scheme whereby “any M of the N sidechain validator nodes must collaborate to sign a message.” So sort of multi-sig.
The Crosschain Transaction Timeout is where the public blockchain comes in, here called a Coordinating Blockchain, although it can be any blockchain, including a private blockchain with this method being general and applicable to any smart contracts blockchain.
“Crosschain Coordination Contracts exist on Coordination Blockchains. They allow sidechain nodes to determine whether the state updates related to the Originating Transaction and Subordinate Transactions should be committed or not. The contract is used to determine a common time-out for all sidechains.”
So if after x block validators don’t agree then the transaction fails or if they do agree then the transaction is committed and it is no longer relevant.
Making it a system where validators on two blockchains are communicating with each other through a coordinating blockchain smart contract in a decentralized and trustless manner. An example they give is as follows:
“Imagine contracts which facilitate atomic swaps of Ether between Sidechains A and B. On each sidechain there is an Atomic Swap Registration Contract. These contracts are Nonlockable Contracts.
When an entity wishes to offer Ether on Sidechain A for Ether on Sidechain B, it deploys a new Atomic Swap Execution Contract on each sidechain. These contracts would be Lockable Contracts.
The execution contracts indicate how much Ether the entity has available on Sidechain A and what exchange rate it is prepared to offer. The entity registers each of the execution contracts with the registration contracts on each sidechain.
A second entity wishing to offer Ether on Sidechain B for Ether on Sidechain A could monitor the Atomic Swap Registration Contracts, executing repeated Crosschain View calls.
The Crosschain View calls could check for matching Atomic Swap Execution Contracts which are deployed on each sidechain, which offer Ether on sidechain A at an acceptable exchange rate. The Crosschain View call could return the address of the Atomic Swap Execution Contract on Sidechain A.
The second entity could then execute a Crosschain Transaction to affect the swap, executing the transaction against the Atomic Swap Execution Contract on Sidechain A. The Atomic Swap Execution Contract on Sidechain A would call the Atomic Swap Execution Contract on Sidechain B.
An important characteristic of the atomic swap technique described in the previous paragraph is that the second entity does not need to swap for all of the value which the first entity is offering.”
They say atomic crosschain function calls are not offered by any existing blockchain or proposal, so claiming this as an invention that builds upon an entire sub-field in blockchain science that focuses on getting blockchains to talk with the paper providing a nice overview of current advancements in that area.
Meaning one can now create any blockchain they like, permissioned or public, Proof of Authority or Work, a database like registrar, or whatever requirements, and can connect this blockchain to the ethereum public blockchain for security, storage, or because they’d like some components to be on the public blockchain.
If this is a breakthrough, time will tell in its applicability, but this could go beyond just permissioned blockchains to aid in scalability and much more.
If, for example, one wants archive.org on the blockchain, they can have a sidechain where they can do what they like with that sidechain connecting to a public blockchain smart contract where rules can be laid out and can be more trusted.
So potentially allowing for a lot more experimentation while enjoying some of the capabilities of the public blockchain.