Maybe youâ€™ve heard of Anyhedge. Last April, news.Bitcoin.com published an article about its announcement, but what is it really? What does it do, and howâ€™s it work?
The Anyhedge Protocol
Anyhedge is an open-source protocol. It is simply a way to use the blockchain (in this case, the Bitcoin Cash blockchain) to create a specific type of smart contract. The smart contract here is a â€œhedgeâ€� where the hedge is between Bitcoin Cash (the underlying asset of the BCH blockchain) and any other asset. Hence, the name â€œAnyhedgeâ€�.
I wanted to understand more about this, so I took a look at the Anyhedge whitepaper. Whitepapers can be intimidating documents, mostly I think because people have grown accustomed to information being spoon-fed to them. The art of sitting down, focusing, and burrowing in mentally to understand something is becoming a lost art. But, I digress.
The first part of the whitepaper attempts to explain why Anyhedge is important and what problem it is trying to solve. In a word: volatility. Cryptocurrencies have always been volatile, and itâ€™s one of the long-standing issues that crypto naysayers frequently bring up.
The whitepaper then mentions some solutions that have been tried in the past, including exchanging crypto into fiat or using various kinds of stablecoins. Each of these solutions has its own advantages and disadvantages, which are also enumerated.
Anyhedge takes a market-based approach by attempting to enable peer-to-peer â€œrisk trading.â€� One big advantage of something like Anyhedge, is that there is no single point of failure, unlike, for example, a fiat-backed stablecoin.
But creating decentralized tools for trading does more than just handle volatility issues. It also offers opportunities to speculators, and we know that speculation makes up a large part of the market today, for better or for worse. This will attract more users to the Bitcoin Cash chain.
To understand how Anyhedge works, first we need to understand oracles, as they are a key component.
Oracles in Bitcoin are an idea that goes back years. The Bitcoin Wiki talks about â€œusing external stateâ€� as part of its operations, but this is always done indirectly in Bitcoin. Why? Itâ€™s because the node software isnâ€™t capable of â€œpolling an external serverâ€� or importing a state of conditions. If Bitcoin were to be set up in such a way, it would drastically impact the entire system and compromise certain properties â€” for example, the Nakamoto consensus system that ensures that a majority of honest nodes will always outpace attackers.
But the way the Wiki suggests using an oracle is a more primitive method, as it involves the oracle evaluating the specifics of the contract and then interactively providing a signature.
In many ways, this is inferior to using a blind oracle that doesnâ€™t require any interaction and in fact doesnâ€™t have any awareness of the smart contracts utilizing the oracle signature. The blind oracle set up uses OP_CHECKDATASIG, which is a relatively new innovation on Bitcoin Cash (BCH), which doesnâ€™t exist on Bitcoin (BTC).
In 2018, an op_code was added to the Bitcoin Cash protocol called OP_CHECKDATASIG. Thereâ€™s a good article about this opcode here. What this opcode allows is for a Bitcoin script to check a digital signature of any arbitrary piece of data. This allows oracles to be used in a much more powerful way, as the smart contract can be set up ahead of time without any interaction or permission from the oracle.
One common problem with oracles, is that they introduce a point of failure and require trust. However, with the blind oracle setup, the potential for misuse is reduced. In addition, participants using Anyhedge could choose from different oracles, and could theoretically only participate in contracts where the users trust the oracle. In theory, smart contracts could be set up that allow multiple oracles to be used in various ways, thus further minimizing risk and reliance on trusted parties.
How Anyhedge Works
Now that we understand a bit about oracles, how does Anyhedge work? There are two parties to the smart contract, which the paper calls â€œHedgeâ€� and â€œShortâ€�. I find that terminology slightly confusing, so letâ€™s just call them â€œlongâ€� and â€œshortâ€�. Since Anyhedge can be used with any asset (such as USD), itâ€™s this external asset that the long and short refer to. Example: If Alice thinks BCH will go up and USD will go down, and Bob thinks the opposite, then Alice is short the dollar, and Bob is long the dollar.
The smart contract also has a maturity date. The whole thing goes like this: Alice (short on USD) and Bob (long on USD) both put their bitcoin cash (BCH) into the smart contract. At the time of maturity, they both are allowed to withdraw bitcoin cash. If the BCH/USD price goes up, Alice gets more BCH and Bob gets less. The opposite would happen if the BCH/USD price had gone down.
The trusted oracle provides a signed message with a price and time stamp, and the smart contract funds can be unlocked when the oracle signature is valid. This is the normal way that the smart contracts function â€” they get closed out at the time of maturity. However, there is another way that the contract can be redeemed, and that is if the price of the asset (such as USD) goes unusually high or unusually low.
The smart contract allows the users to specify a liquidation price on both the low and the high side. Again, if the oracle provides a signed message and the contract validates it, the funds can be withdrawn. The early liquidation is possible because price has reached one of the two boundaries.
There is a third way to close out the contract, which is a failsafe mechanism. The two parties can close out the contract any way they want (as long as they both agree). This would happen if the oracle stops operating, for example.
Thatâ€™s it. Itâ€™s pretty simple, really. Users lock their funds in the smart contract address, and only can withdraw under the right conditions.
Creating the Market and Liquidity
Itâ€™s one thing to create an open-source protocol on paper, and another thing to have a working prototype. And itâ€™s yet another thing to have a fully functioning ecosystem, which requires liquidity in terms of a sufficient number of participants.
The paper discusses a few different types of â€œmatchmaking setupsâ€�.
One option is using a centralized order book. Although decentralized exchanges are great in theory, they donâ€™t necessarily provide the most responsive system. Centralized exchanges have their advantages â€” namely the ability to attract liquidity. In this model, access to the order book itself is permissioned. However, this can be combined with a noncustodial client-side setup that preserves the advantages of Anyhedge including having no custodial risk.
For this reason, it makes sense that the first deployment of Anyhedge will be on a centralized exchange.
Another method utilizes the â€œFederatedâ€� model in which exchanges can communicate with each other via APIs. In theory, Anyhedge contracts could be trustlessly coordinated between exchanges. Cooperation between exchanges can grow along with a global and trustless pool of demand.
But it is also possible to use Anyhedge contracts between any two willing parties. An exchange is not even necessary. In practice, order books are necessary to create an efficient market. Just as OTC trading is common, tools can be released for ad-hoc contracts. These tools may have lower liquidity and speed, but they are also more private, as well as potentially more flexible. They are also impossible to censor and offer more privacy.
Defi and the Bitcoin Cash Advantage
Defi was a huge buzzword in 2020, but are ordinary users getting involved? One of the most praised applications is the Uniswap smart contract on the Ethereum blockchain, which is providing true decentralized exchange (dex) capabilities.
Similar decentralized services can be built on Bitcoin Cash. One major advantage that BCH has is that fees are still low, while they are getting quite high on Ethereum. That may change in the future as ETH 2.0 is rolled out, but it is unclear how long that process may take. In the meantime, BCH is a good low fee option for many applications.
Detoken is about to be launched. Itâ€™s an implementation of the Anyhedge protocol.
The folks who ran the Cryptophyl token exchange are busy working on the release of this upcoming product, and the fact that there is a business-driven initiative behind the rollout of this technology is promising, since it will likely receive the attention and resources necessary to bootstrap liquidity in this nascent ecosystem.
Detoken is planning to allow SLP token support shortly after launching and says they will allow zero-confirmation trades, which means users donâ€™t have to wait for block confirmations before their transactions are created. They also mention combining atomic swaps with Detoken so that trustless and noncustodial trades can be accomplished with users having full control of their private keys.
What do you think about Anyhedge and Detoken? Let us know what you think about this subject in the comments section below.
Image Credits: Shutterstock, Pixabay, Wiki Commons, Anyhedge.com, Detoken,
Disclaimer: This article is for informational purposes only. It is not a direct offer or solicitation of an offer to buy or sell, or a recommendation or endorsement of any products, services, or companies. Bitcoin.com does not provide investment, tax, legal, or accounting advice. Neither the company nor the author is responsible, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any content, goods or services mentioned in this article.
The post Is Defi Coming to Bitcoin Cash? An Overview of Detoken and the Anyhedge Protocol appeared first on TechFans.