Vernacular than the original chain cross chain technology

With the main side-chain architecture Bystack the introduction of cross-chain issues between the primary side chain has become overcome engineering challenges than the main chain of the original team, the current than the original chain cross chain has introduced two mechanisms, each with different focus, probably because of cross-chain technology itself relatively obscure herein, this wish in a more popular way to introduce the latest technology than the original chain cross chain to the community.

Some prior knowledge

Across the chain simply means that solve how to make a chain transfer token on to the other strand, the essence is to transfer value on one strand to the other strand, across the chain need to ensure the following:

1. Make sure the safekeeping of assets has been across the chain, we can not continue to circulate in the original chain to prevent theft or embezzlement;

2. The transfer of assets to ensure that the two chains are identical, the A chain can not be reduced by the value of the asset 100, while the B chain only increased 50 value assets;

3. Transfer of assets can be safely re-transferred back to the original chain, not just one-way transfer value, or the transfer can not be transferred back to the past;

Based on these requirements, the birth of a lot of different cross-chain solutions, mainly notary mechanism, side-chain / lock relay time and hash and other programs, in addition to distributed private key, and notaries side chain mechanism + hybrid technology. Here are expanded wrong with these technologies, if interested friends can recommend reading V R3 God to write an article about cross chain "Chain Interoperability".

Than the original chain cross chain selection

Cross-chain model than the original chain can not escape across the chain model described above, the current main use of the mechanisms and notary hash time lock mode.

Because the side chain Vapor itself is no assets, so we use a notary public mechanisms to transfer assets to the backbone of the side chain (actually locked in the main chain assets, asset creation in Vapor side chain), and because the mechanism requires notaries some time to review signatures, so we'll use the time to lock the mechanism hashes do to add, you can quickly exchange assets between the primary side chains (but not create hash time lock mechanism assets, but the existing main side chain cross chain asset swaps).

Notary (Gateway) mechanism

But those who participated in the side chains will be familiar than the original super node to vote for the chain transfer across the BTM, by switching to the side chain of the wallet, a key may be achieved across the chain Bycoin, as shown:

By a key chain can be cross-BTM or other assets across to the side chain, such a side chain asset exchange. Then the rationale behind notary mechanism is kind of how it? Ignore the technical details, the value is generated and the destruction of the core, the main interface communications assets managed and a side chain, as shown below:

每当从主链转移到侧链,就需要在侧链上创造相应的资产,而如果要从侧链上转回主链,则需要销毁侧链上相应的资产,这就是价值的生成和销毁。当主链的资产跨链到侧链上,就需要对主链的资产进行托管,出于安全的考虑,一般都会采用多签的方式,还有对大额资产进行冷热分离。

先介绍几个概念:

1. 验证人:侧链的出块人,就是当前的正式出块的超级节点方(前十的超级节点)。

2. 收集人:监控主链锁定在联邦合约地址的交易,收集主链的交易并在侧链上创建等额的资产,监控侧链跨链请求,销毁侧链的资产并释放等额资产到主链上。验证人和收集人都是系统中的角色,并不是指代实际的人,但其中可能会需要人进行参与。

3. 联邦地址:由多名联邦成员公钥生成的多签地址。

当用户点击一键跨链之后,发生了什么事情?

如果是从主链到侧链:

1. 收集人监测到主链的联邦地址接受到了一笔转账;

2. 收集人等待主链打包,当到达一定确认数后这笔交易将不能被逆转;

3. 收集人在侧链上创建等额的资产,通过多签进行审核确认,并打入到用户的侧链地址;

4. 用户的侧链上获得可以流通的资产;

如果是从侧链到主链:

1. 收集人监测到一笔侧链销毁资产的交易(这里用户并不需要将自己的侧链资产打到联邦地址上,而是自己发起一笔销毁侧链资产的交易);

2. 收集人等待侧链打包,当到达一定确认数后这笔交易将不能被逆转;

3. 收集人将联邦地址中等额的资产,通过多签进行审核确认,并打入到用户的主链地址;

4. 用户在主链上获得可以流通的资产;

网关(公证人)机制则是一个被实际场景检验过的高效可实用机制,网关起到了建立跨链信任背书、统一跨链通信协议、协调主侧链交易确认的重要作用。但在实际场景里,跨链网关会面临中心化运营的弊端,导致跨链协作无法完全去信任,互操作性不高。后续的开放式联邦网关管理框架 OFMF就是为了解决中心化的问题,这块后续会专门写文探讨,这里不做赘述。

同时因为需要人工多签的原因,跨链需要用户较长的等待时间,所以又推出了基于哈希时间锁的跨链资产原子互换机制,和公证人机制进行一个互补。

哈希时间锁跨链机制

哈希锁定模式是指用户在规定的时间段对于哈希值的原值进行猜测来支付的一种机制。简单讲,就是在智能合约的基础上,双方先锁定资产,如果都在有限的时间内输入正确哈希值的原值,即可完成交易。

通过公证人机制,可以将比原主链的资产迁移到侧链上去,那么通过哈希时间锁,则可以将比原主链和侧链的资产直接进行交换。

比如你在主链上有BTC,我在侧链上有ETH,如果使用公证人机制,我需要首先将BTC跨到侧链上去,或者将ETH跨到主链上来,这样才能进行互换;而有了哈希时间锁的机制,就可以直接把我主链上的资产打给你,而你将侧链上的资产打给我,并能保证整个过程的原子性和资产安全。

哈希时间锁的大概模式如下图所示:

这个图是简化的流程,为了保证主侧链资产交易的原子性,其中涉及比较多的流程,大致流程描述如下:

1. 用户A想用主链上的BTC换取用户B侧链上的ETH;

2. A开通一个主链上的智能合约,并设置一个能够解开该合约的谜语(哈希锁H),设置一个可以猜谜的时间(时间锁T),超过这个猜谜时间A可以拿回他自己的BTC;

3. A将谜面(哈希锁H)给用户B,用户B用同样的谜语(哈希)在侧链上开通一个智能合约,也设置一个猜谜时间(时间锁t);

4. A,B双方互相检查各自的合约(检查是否用统一的哈希锁,检查是否接收地址是对方的);

5. 确认智能合约无误后,A在时间t内使用谜底(哈希原值)去解锁B的侧链智能合约,并获得侧链的ETH;

6. 一旦A成功解锁B的智能合约,那么谜底(哈希原值)就会暴露,B获得了谜底(哈希原值),在时间T内,去解锁A的主链上的智能合约,并获得主链上的BTC;

7. 双方的资产互换完成;

哈希时间锁完全使用合约来进行跨链资产的交换,所以无需担心中心化的风险,但哈希时间锁机制只能互换主侧链已有的资产,而不能将资产价值转移到另一条链上。当前的比原的哈希时间锁机制并没有集成到界面上,所以普通用户使用还比较困难,需要产品的进一步提升。

跨链的展望

比原链Bystack的跨链技术正在如火如荼的完善中,通过跨链技术,我们可以很好的发挥侧链的高性能优势,让各类资产在侧链上流通起来并形成各种各样的应用。

除此之外,跨链技术的成熟,除了可以利用在我们自己的主侧链之外,我们还可以将这套技术用在比原链跟其他区块链的跨链上,将其他区块链资产都跨到比原链上来,从而实现比原链多样性资产的目标。

Guess you like

Origin www.cnblogs.com/bytom/p/11546629.html