Understand the blockchain 24 issues | See these two situations, dare to say that you understand the cross-chain!

The last issue: 9012, the side chain is still a dead and alive Schrödinger cat? We have already talked about the side chain. I have to say a few more words about the side chain. The side chain is native to the Bitcoin community, so there will be a subjective main side in the scene, but in the current scene. The side chain is more of a relational expression, and there is no affiliation, because from the data structure, they can be side-chained with each other.

The sidechain protocol is one way to connect the chain to the chain, but it is not the only way. Today we are going to talk about how there are several ways to cross the chain. In the past data, there is actually a big problem in the classification. In general, people will divide the chain into:

1. Notary schemes;

2. Sidechains/relays (Sidechains/relays);

3. Hash-locking;

4. Distributed private key control.

But why is this so? Is it right? Basically all the information is ambiguous, then today we will break this inherent mode, decode&encode cross-chain!

First of all, we must first understand what the "cross chain" really means. One case is that the assets between the chain and the chain are interchanged; the other is that the assets between the chain and the chain have been transferred.

Hey, everyone should not think that I am playing word games. In fact, there are subtle differences between the two. I will explain them one by one:

In the first case, the assets between the chain and the chain are interchanged.

What does that mean? This refers to the exchange of assets between different users on the two chains, and the ownership of the assets has changed. A typical example of this form is hash locking.

Let us give an example. Suppose Xiaoming has a bitcoin. He wants to exchange 20 Ethereum with Xiaohong. (This analysis process is best to look at the picture)

Their original state of funding is such a drop:

Xiao Ming: 1 bitb, 0 Ethereum

Xiaohong: 0 bitcoins, 20 Ethereum

First, Xiao Ming randomly generates a key K, and then obtains a hash value M through the hash function H(K). Xiao Ming sends the hash value M to Xiaohong and says, "This is put, it is useful!" As for how useful it is, talk about it later!

Well, well prepared, Xiao Ming initiated a transfer in the Bitcoin network, and transferred a bitcoin to B's address. Of course, the premise of the account is Xiaohong signature and provide the correct key K.

Eh? Is it wrong? This turned over? ? ? If Xiaohong has never provided a key, then Xiaoming’s money will be frozen and cannot move?

Yes, it’s not that simple. In order to prevent his own currency from being locked, Xiao Ming initiated a refund transaction before turning it over. The conditions for this refund transaction are such that if the transfer transaction does not receive the correct key and signature within 48 hours (for example), the amount of the transfer will be returned to Xiao Ming. Because Xiao Ming and Xiao Hong were sincere traders, they signed the "contract" together.

In this way, Xiao Ming assuredly initiated a bitcoin transfer transaction, but how does Xiaohong get the key K and get the 1 bitcoin?

That is to change things, Xiaohong also initiated a transfer of 20 Ethereum, of course, before the transfer was initiated, Xiaohong also initiated a refund transaction, the process is the same as above. Xiaohong’s 20 Ethereum transfers are also conditional, that is: only Xiao Ming gave her the correct key K, he can get the 20 Ethereum.

Hey, how did Xiaohong know that Xiaoming gave her the right key or fake?

At this time, M, which is useful, will appear! Xiao Ming gave the hash value M of Xiaohong key K early, M could not deduct K, but can verify the correctness of M, so Xiaohong gave Xiaoming 20 Ethereum, Xiaoming gave her key K, Xiaohong has a key K to get 1 bitcoin, perfect.


We can see that the capital on the two chains has not been transferred, but has been exchanged in their respective chains!


Then the most typical case of hash lock is the lightning network. If you are interested in this, please go back and see the blockchain 18: Centralized Devil or Expanded Essence, 6 minutes to show you lightning network !

Doubt blockchain No. 19: Five major mistakes in the lightning network, have you stepped on the thunder?

The second case: asset transfer between chain and chain

Since two independent chains want to achieve interconnection, no matter how they evolve, there will always be a "middleman" between the two chains. This "middleman" may be one or a group, and may be a central organization. It may be a distributed group, it may be a data collection & transaction confirmation & verification package, or it may only act as a data collector.

First, we divide the "intermediary" into "data collection & transaction confirmation & verification" or just collect data into "Notary schemes" and sidechains/relays.


The notary mode is the simplest and most rude mode. If the notary is a trusted third party such as an exchange, we call it the “single-signature notary mechanism”, which also undertakes the task of data collection & transaction confirmation & verification.

If the notary is a coalition of a group of institutions, we call it the "multi-signature notary public" mechanism, then the transfer of cross-chain funds is controlled by this alliance.

It is obvious that the above two are relatively central, so the third model "distributed signature notary mechanism" was born.

Distributed signature is based on cryptography to generate a secret key, and is divided into multiple parts and distributed to randomly selected notaries. After a certain proportion of notaries can be signed together, the complete key can be pieced together to complete the decentralization. The "data collection verification" process.

The sidechain/relay mode is a completely different concept. He does not have a trusted third party to control, collect data through, for example, Relayer, broadcast the data to the side chain or the main chain, and confirm it by the miners of the side chain and the main chain. And verify the transaction.

This is what we said between the chain and the chain to achieve asset transfer, the specific process of implementation, we have already said in detail in the previous issue, interested friends can go back and see.

If you have any questions about cross-chaining, please leave us a message or Weibo to follow the ChainNode chain node and my personal number, MiaBao, I am not relying on the value of talented fat.




Bottom map