Review of Bitcoin side chains; First part: Getting to know the Spacechain mechanism

زنجیره های جانبی بیت کوین

What is the side chain of Bitcoin and what is its use? One of the basic problems of blockchains, including the Bitcoin network Scalability issue Is. Sidechain is a blockchain network that solves the scalability problem to some extent by linking with the main blockchain. Ideas Sidechains As a mechanism for expanding features and scaling solution, Bitcoin is not only a new idea, but it originates from an old and early idea called Merge Mined Chains. An idea that dates back to before the disappearance of Satoshi Nakamoto. Implementation Bitcoin sidechains In three ways SpacechainI see, Softchainha and Drivechainis done. In this article, we will review Spacechains. Stay with the country of blockchain.

Introducing the mechanism of the basic idea of ​​side chains

How to implement Bitcoin side chains

In the Merge Mined Chains proposal, two completely separate and unrelated chains are mined by a joint group of miners, but the miners do not have the ability to transfer anything between the chains. The initial proposal of Side China In 2014 (1393), immediately after the publication of an article by Blockstream was presented. The main idea of ​​the proposal was to be able to transfer coins between the main Bitcoin blockchain and other side chains to previous or subsequent chains by using Simple Payment Verification. Simple Proof of Payment Verification (SPV) is used to prove validity when sending coins from one chain to another. This idea never came to fruition for reasons such as implementation complexities, chain organization, the possibility of theft, and the risks of mining concentration.

Use of one-sided and two-sided pegs in side chains

One-way and two-way pegs in side chains work as follows

in the side chains of Peg mechanism is used Links include one-way and two-way types. As the name of this mechanism suggests, in the two-way peg design, coins can move back and forth between the parent chain and side chains.

But in the design of one-way link or one-way peg (One Way Peg), coins only move from the parent chain to the side chains and do not go back at all. Currently, the only form of two-way pegside chain that is implemented on Bitcoin is through Federated Consensus. In this mechanism, a set of reliable Custodians guarantee the connection. In other words, these operators control the pegged funds in a multisig wallet on the China side until withdrawal.

Other schemes are provided for other non-federated sidechain pegs. For example, Ruben Somsen’s proposal is one of these designs. Ruben Somsen’s is a one-way peg mechanism that uses the Blind Merge Mine scheme like Paul Stztorc’s proposal. In other words, in this mechanism, coins can only enter the side chain and never leave the side chain. In addition, miners do not have to run new software in order to receive China Side mining wages.

Spacechain Proposal

In Merge Mining, miners must run the nodes of both Bitcoin chains and other chains that are being mined. After doing this, the blocks for both chains are compiled and committed to the header block that is being mined.

Hidden hybrid mining is based on the fact that Bitcoin miners only need header blocks from other chains to commit coins to their own Bitcoin block, and someone else can actually put together blocks for other chains.

Somsen for this proposal challenge ANYPREVOUT or (APO) suggests. By using this proposal, anyone can compete to build the next block of the sidechain, but only one block is deposited into the main block of the Bitcoin chain. Another advantage of the Ruben proposal is that it does not require a special soft fork to enable the execution of sidechains. Eltoo/ANYPREVOUT proposals are proposed to enable Flexible Statechains and Channel Factories for the Lightning Network.

What is Marj Mining?

What is Merge Mining?

The general idea of ​​hidden hybrid mining is that, using the APO proposal, it is possible to pre-define a long set of transactions that have the same unspent output (UTXO), and commit that the same set will always be reproduced. Imagine the unspent output of one satoshi. Each predefined transaction guarantees that, upon confirmation, a similar unspent output is generated again as an output.

This particular UTXO is like a token or identifier that a user of the main Bitcoin blockchain can look at and understand, “This is where I have my commitment in X blocks of the sidechain.” If this UTXO has to be reproduced with the same amount, then there is no money to pay the fee.

Solving the fee payment challenge in Marj Mining

The issue of fee payment can be solved by using two signature models SIGHASH_SINGLE and SIGHASH_ANYONECANPAY. In the SIGHASH_SINGLE model, signing an input only signs the corresponding input and output. In the SIGHASH_ANYONECANPAY model, users are free to add more inputs and outputs without invalidating the signature, as long as the SIGHASH_SINGLE input/output remains the same. Anyone can then add an input and modify the output to pay the miner a transaction fee.

This mechanism is also used to commit to the header block of the side chain. As Taproot (Taproot) by changing the normal public key Merkle Tree Root It gives the tree different spending conditions, anyone can change the normal public key with the sidechain header block hash. In this way, the sidechain nodes can identify the header block by referring to the transaction in the main chain and verify or relay it in a decentralized way to prove that this block is really mined. The sidechain nodes then perform all the usual validations to firstly ensure that the sidechain block follows the proper consensus rules and secondly to relay the actual sidechain blocks just like the mainchain.

The possibility of committing to an invalid block or using unused data

If one of the transactions deposited to the sidechain blocks of the main chain is deposited to an invalid block, or even if the data is completely useless, then when the nodes of the sidechain see the commitment transaction used on the chain, there are two possibilities. has it. First, an invalid block can be published throughout the sidechain network, and if it cannot pass the validation process successfully, it becomes an orphaned block.

In the second case, the data is never revealed. In this case, the next block of the side chain is created on the last revealed block and deposited to it, hidden deposits are also ignored. The second possibility follows the same logic as the Longest Chain Logic of the main chain. So even if something is exposed in the future, it will still remain an orphan, because no other blocks will be built on it in the future.

Solving the double spending challenge in Marj Mining

But there is still the problem of double spending. Anyone with the private key to generate the UTXO token can double-spend any of the predefined transactions committed to the sidechain blocks, invalidating the entire set from that point on.

This problem is solved by putting the signature in the locked UTXO script. In other words, by locking the input and output signature, it is ensured that the UTXO identifier is reproduced and used in the next transaction. Since the signature is automatically verified when the UTXO is spent, another signature cannot simply be substituted and spent at a different destination.

Solve the challenge of sending multiple transactions in a row

There is yet another problem. It is theoretically possible to send multiple transactions back-to-back to a single Bitcoin block, and miners can verify a large number of side-chain blocks in a single main-chain block. This process can be exploited in a denial-of-service attack on the side chain.

To solve this problem, the relative time lock CHECKSEQUENCEVERIFY can be placed in the UTXO script to ensure that only one transaction using the UTXO ID can be verified within a given block of the main chain.

This process looks similar to the image below:

Spacechains review, spacechain blockchain revealed by the user
Source: Bitcoinmagazine

We should also note that two different forms of this design can be implemented using CTV update (CHECKTEMPLATEVERIFY) or without any changes. In the following, we will examine how to solve this problem by the CTV proposal.

Using the CTV proposal in the implementation of Bitcoin side chains

The CTV UTXO proposal uses this feature to commit to a chain of transactions that use CTV instead of APO and the signature hack inside the locked script. CTV is assigned to all outputs of a transaction that spend unspent CTV output, but not to any input other than itself.

In other words, you can add inputs to a CTV transaction, but not outputs. So like the APO design, the user can bring their own fees, but cannot add a deposit to the sidechain block header.

So what we need to do is to deposit a transaction completely outside the CTV transaction chain Sidechain create. In this way an unspent output is generated which is only sufficient to pay the CTV transaction fee. (Since there is no way to change the output in this transaction, 100% of the added inputs are added to the fees.) The transaction that prepares the UTXO fee is where we deposit a sidechain header block. So in the first step, a transaction generates a fee for outgoing payment and a deposit for a chain-side header block. In the second step we take the output fee and add it as an input to the CTV transaction. After the confirmation of this transaction, the block of our desired side chain will be mined. This design is similar to the image below:

Investigation of CTV proposal in sidechains
Source: Bitcoinmagazine

CTV proposal challenge

In the CTV proposal, the sidechain block must be committed in a secondary transaction because CTV does not allow transactions that spend an input locked by CTV to add new outputs. This scheme requires the use of a secondary transaction, because if you add a new input or output to the pre-signed chain, you change the transaction identifiers (TXID) and all subsequent pre-signed transactions become invalid. This design is similar to the image below:

Pre-signed transactions and no soft forks on sidechains
Source: Bitcoinmagazine

The challenge of using pre-signed transactions

The downside of the second scheme is that if someone who pre-signed all transactions for use in sidechain block deposits does not delete their private keys, then it is possible for the chain to stop at any time due to the current UTXO identifier being spent twice.

Using pre-signed transactions on Bitcoin sidechains

The next scheme uses pre-signed transactions. Currently it is easy to use this method, but due to the limitations of the script, anyone who wants to create Spacechain must pay all transaction fees in advance.

A chain of transactions starts with an unspent output and creates two outputs in a chain. The first output is the UTXO ID, which indicates that the transaction chain belongs to a particular SpaceChain. The second output is a low-value UTXO that anyone can spend, allowing another input or output to be connected to it. In the second transaction, anyone can commit to being the first to spend the second output of the spacechain transaction chain and use it to commit to their sidechain’s header block.


as it mentioned SidechainA solution for Scalability and interoperability, and the history of this concept dates back to before Satoshi’s disappearance. The above content was the latest proposal of the sidechain project in the Bitcoin network. Implementation Bitcoin sidechains can be done in three ways Spacechain is one of them. propzal Space China It is based on Marj Mining. The general idea is to predefine a long set of transactions that have the same unspent output (UTXO) and to commit that the same set will always be reproduced. in your opinion Implementation of Bitcoin side chains Will they be successful? Will the scalability problem be solved with this solution or will we face new challenges?


Leave a Reply

Your email address will not be published.