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.
“One major advantage that BCH has is that fees are still low, while they are getting quite high on Ethereum.”
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.
An intro to how Anyhedge works according to the web portal.
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.
According to the developers, Detoken and Anyhedge very soon.
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.
The post Is Defi Coming to Bitcoin Cash? An Overview of Detoken and the Anyhedge Protocol appeared first on Bitcoin News.