Hive Bridge - Atomic Token Swaps

in Hive Improvement4 years ago

Hive Bridge - Atomic Token Swaps


image.png


In a recent video by @theycallmedan, he brings up the idea of wrapping the HIVE token in an ETH contract to facilitate Hive -> Ethereum token transfers and getting HIVE listed on the Uniswap DEX.

This is a topic that has come up many times before in the past and I have put a little bit of thought into how it could be implemented on Hive. In my opinion, atomic token swaps should be integrated into the core blockchain code and processed by witnesses like normal transactions.

HF24 is feature locked right now and a code release candidate should be coming out shortly (definitely within this month). With that said, now is the time to start looking to what modifications should be included in HF25. If we can get atomic token swaps enabled in the following hardfork, Hive will be in a position to integrate directly with countless other blockchains (Ethereum, Bitcoin, EOS, Tezos, etc etc).

Of course, cross-chain token swaps can already be enabled today through the added use of Oracles. The caveat with this implementation is that it adds a layer of trust that is necessary; which some may say is the antithesis to the idea of blockchain in the first place.


If the atomic token swaps were built into the Hive source code, I envision that the code would be delivered as an optional plugin that a witness user can choose to run. If the witness has enabled the "bridge" plugin, when processing blocks they will also process the pending atomic token swaps by first verifying balances on the Ethereum based smart contract that holds the wrapped Hive tokens.

If for some reason the witness server cannot make a proper verification of funds, the transaction will not be processed and will instead enter into a pending queue until the balances can be properly verified.

Building the atomic token swap code into the blockchain can further enable new features in the internal market. However, supporting additional tokens on the internal market would probably be a change to make a bit more down the road after the base atomic swap framework can be fully tested and verified.

Some other developers have started some work related to wrapping Hive on Ethereum. I think @fbslo and @lightproject have some experience here also.


So what do you think? Would you support the inclusion of atomic token swaps (cross-chain token swaps) in Hive for HF25? Do you have any suggestions or input on things that I have not mentioned here or that I didn't cover thoroughly enough?

If so, leave your questions/comments below and let's get a discussion started about the future of the Hive blockchain.

Sort:  

I would 1000% support something like this in a future HF. It was briefly discussed in a comment thread on @blocktrades post about second layer applications on Hive (https://peakd.com/hive/@blocktrades/hive-s-future-as-a-2nd-layer-blockchain-network#@blocktrades/qd642s) as being a "holy grail" for blockchains, which I agree with.

The key is how it can be implemented though. I'm not entirely sure how you see this working:

they will also process the pending atomic token swaps by first verifying balances on the Ethereum based smart contract that holds the wrapped Hive tokens

I think it would have to be done by submitting a proof that the transaction took place on Ethereum which the Hive node can validate, or potentially having some time-lock mechanism like what is used for BTC atomic swaps. I don't know the details about how these work, but they have been done for other chains so hopefully we can borrow what they have done.

Either way I would definitely support putting funds towards researching and implementing a solution for this. I would think that if it's implemented for HIVE it should be able to be used for SMTs too which would be a big added benefit for projects to create their own tokens here one day.

Yeah implementation details would have to be figured out but as you said other chains have swaps with timelocks and different ideas we can possibly adapt.

I suggest to look at blocknet and use their api for cross blockchain trust and trx. I found this is the only cross-blockchain solution that is working. Others are still in development.

Absolutely yes.

Lately I've discussed briefly an idea of an entity similar to hive.fund where users could send Hive to receive some form of stablecoin. So let's say I send $200 worth of Hive to receive 100 HBDs. Those HBDs could then be wrapped and sent to ETH network for buying other tokens etc. To receive back my locked Hive, I would need to send the HBDs back (+ fee?).

This could help a little with the HBD peg but much more importantly this would allow me to hold 2 tokens - Hive and whatever other crypto I would buy using the wHBD. I think that services like these are crucial for Hive not only when it comes to thriving, but also survival. Blogging should be only the entry point.

Also this :)

The leaders on Atomic Swaps are Komodo Platform, they have the Atomic Dex, https://github.com/KomodoPlatform/atomicDEX-Pro they were the first project to bridge BTC blochains to Ethereum, that was about three years ago. Nowadays with that techology, they can bridge up to 90% of all blockchains, I am sure they can guide us. Actually a collaboration initiative can work for both projects, if Hive is interesed in a close approach, I know the main developer (JL777) he is always trying to help good initiatives.

This would be an interesting collaboration between blockchains, good idea Nacho!.

Fascinating things are revealed when multiple brains collaborate. So much knowledge out there, only so much brainpower to process it.
Thanks

Having atomic swaps on Hive would be amazing! Having to use a centralized oracle to use wrapped assets is a big problem.

Code for Wrapped Hive oracle is almost ready, but I wish there was more trustless solution.

Ngl, having a bridge to ERC20 or other tokens would be huge, maybe one of the biggest additions to Hive in the whole history. Imagine having HIVE listed on all of those DeFi apps and so much other use cases.

I have nothing against this but for heaven's sake please work on the SMT automated market maker first. We need to be able swap between tokens seamlessly within our own chain before we think about cross chain swaps at all. The AMM also functions as permanent HIVE sink too so the sooner it gets released the better.

I think Inter-blockchain Operability will be key in the future, and creating bridges for token swaps is great for the entire space and token holders in general.
An added bonus is that it has the potential of diminishing the power of CEXes and is more in line with the original ethos of decentralization. There's a lot of hype around DeFi at the moment and everyone is scrambling to get in on the action. That being said, I think a measured approach with attainable goals in mind could be really beneficial for Hive. As @yabapmatt mentioned, if this capability is extended to wrapped SMTs it would be even more valuable to the ecosystem. DEFInitely a conversation worth having.

I am leery of anything that creates any kind of dependence on centralized institutions, which I consider CEXes to be, and blockchains' dependence on them to be able to present their tokens as money unacceptable.

However, atomic swaps (as I understand them) make CEXes unnecessary. Blockchain tokens will be exchangable natively on blockchains, although not for FIAT currencies. Given that I now believe FIAT to be a trap creating dependence on oppressive institutions, I do not find that 'drawback' to be a negative at all.

The concern I have is that our access to communications with each other, the internet itself, and blockchains, remains dependent on centralized ISPs and the backbone that is owned by legacy institutions.

Absent some form of mesh network that enables individuals to bypass censorship, blockchains are potentially the same trap as FIAT, that create dependence on centralized institutions.

So, it's a great move, but presupposes free access to communications. I am unable to fully invest my productive work in anything which remains liable to the kind of fraud that enabled CITI to steal $100s of thousands of my wealth. I will not use banks today, and until we have a mechanism that enables wealth to be transferred outside the control of such institutions, I will not use tokens as money either.

I just gave my life's work to banksters because the corrupt legal system was designed to prevent me from holding them accountable and return my money to me. I will not be susceptible to such mechanisms going forward, and I hope devs consider this principle in time to prevent many more people who do consider tokens as money and depend on extant mechanisms to spend them being subjected to the kind of theft by fraud I have suffered.

I can't argue with that. Control of the internet has been, and will continue to be, consolidated into fewer and fewer conglomerates. This experiment in decentralized systems is still important and, from my opinion, is appealing to more and more people who no longer have faith in established systems and institutions. As crypto is demonstrating, there are possible parallel structures that can be created and we should continue to create/support/experiment with new systems that empower the many and not only the few.

Atomic swaps + SMTs can be Huge!

Whish this was done sooner. But better late than never. Like the atomic swap idea a lot.
I guess wHIVE doesnt care about atomic swaps. Both can be implemented?

The atomic swap as I see it would have plugins for each blockchain to support. If a witness wanted to support HIVE->ETH swaps then they could opt to only run that plugin if they wanted.

But each plugin would work together with the related blockchain to verify the transfer/balance. So I think for ETH, the wHIVE (wrapped HIVE) contract would work in conjunction with the Hive atomic swap plugin.

I mentioned two ideas in the post, one having the swaps coded into the blockchain either via a plugin or something else, and the other is enabling swaps thru the use of Oracles. I far prefer the former option personally.

interoperability is the future, thanks for the thoughts and update 👊

Was looking at what it would take to get on Uniswap, any experience with them?

I do agree native on chain solution is ideal.

Nah the only Uniswap experience I have so far is thru research and reading their website and docs. But essentially it requires an ETH token contract that represents "wrapped HIVE".

Of course the balances cannot just be created out of thin air. So the ETH token contract would have to mint new tokens as they are burned or transferred from a Hive user account to the built in contract on chain.

After a burning transfer can be verified, the ETH contract should mint those same amount of wHIVE tokens and allow a user to claim them with the private key that relates to the one they specified in their original transfer.

@theycallmedan has said once the necessary infrastructure is in place he wouldn't mind providing liquidity in the form of ETH or HIVE to make everything work. There will need to be enough ETH available to process Hive transfers, and enough Hive available to process ETH transfers.

@lightproject might have more info on specifically what is required for Uniswap.

Would definitely support this. Just a win no downside.

Hell yes!

That’s a fantastic idea and it should have already happened!! This is like rocket fuel!

I guess my question would be what are the negatives, of any.

Posted using Dapplr

Great idea, also thought about atomic swaps between HIVE <> ETH recently because of the DeFi hype. Would also like to suggest adding a DeFi category on hivedapps.com and including all DeFi apps there such as the internal market, hive-engine, nft showroom etc.

And the problem of fees? Or is it not affected? Ethereum and ERC20 have really out of this world fees in the last period.

Native solution would be great. If it can only be done via “oracles,” I wouldn’t even bother.

I think HF25 would be good for this. Hopefully it’s one of very few changes or the only focus for the HF. Quick delivery would be fantastic, assuming it’s thoroughly tested.

This is an interesting factor to promote #hive and increase the capacity to hold
#hive elsewhere.
If there is a will there is a way.

Can it be sold as a cool and interesting feature that generates hype?.. I think so.
Would it potentially pay for its development?... Quite likely

Its a yes from me.

This is the way to go. I believe it will increase Hive in leaps and bounds. Hive would be everywhere and will definitely lead to more adoption of the token.

So it’s possible to do the cross chain in a trustless manner. As you may be aware we just completed such an implementation on Peerplays. For the time being we are talking to Bitcoin and can be easily extended to other chains. The design is generic.

Hi @netuoso

Thank you for explaining this, including the importance point of how somewhat centralized solutions can be enacted faster, but also create trusted relationships, in an environment normally favoring trustless ones.

A fascinating thing code, it can liberate or enslave, on a spectrum.

@shortsegments

Eliminating our dependence on CEXes to use Hive as money is a great step forward. However, until we have independent means of accessing Hive the path to that ability is able to be blocked by centralized institutions in the form of ISPs.

I do not disparage atomic swaps. If we cannot guarantee our access to communications, Hive itself is ultimately vulnerable to centralized control, and I will not invest my productive work into such traps again, having once suffered the loss of my life's work through theft by fraud.

Absent mesh networks, or some similar decentralized means of communications that prevents censorship by ISPs and other centralized institutions, it is potentially simply a trap.

Better tasting bait is not a solution to the trap we must solve.

This sounds very exciting, if the market doesn't come to you, then you have to go to the market. Getting into other DEX's won't be an issue either in my opinion. However i hope these atomic swaps will be open for future chains too not just ethereum,, such as cardano, polkadot or EOS for instance.

Great idea netuoso. Very good Improvement for hive if it can be implemented.

the added use of Oracles. The caveat with this implementation is that it adds a layer of trust that is necessary

Have you looked at Equilibria (XEQ)? Their project died when their core guy split, but from my understanding it was the first really trustless oracle. I could be wrong, but it might be worth a look anyway:
https://github.com/orgs/EquilibriaCC/repositories

For Bitshares, I remember we put quite a bit of time into ILP and HTLC ACCS..
https://www.jmjatlanta.com/index.php/2018/09/27/bitshares-and-hashed-time-lock-contracts-htlc/
https://whaleshares.io/@christopher/bitshares-and-interledger-ilp-summit-summary-for-the-bitshares-community

I realize Bitshares is not Hive, but Graphene is where all this spawned from iirc.

Anyhooz, I love seeing posts like this because it brings us one step closer to dumping all reliance on CEX's! :)

I really think Hive is ready for Atomic Swaps. From Hive to BTC

100%
It’s nice to imagine everyone coming over to hive but in reality we should be bridging to all big name blockchains, working together and growing together.