Maybe you have heard of Anyhedge. Last April news.Bitcoin.com published a article about the announcement, but what is it really? What does it do and how does it work?
The Anyhedge protocol
Anyhedge is a open-source protocol. It’s just a way of using 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 hedging takes place between Bitcoin Cash (the underlying asset of the BCH blockchain) and other assets. Hence the name “Anyhedge”.
I wanted to know more about this so I took a look at it Anyhedge whitepaper. White papers can be intimidating documents, mostly I think because people have become used to information being infused at the spoon. The art of sitting, focusing and mentally digging in to understand something becomes a lost art. But I digress.
The first part of the whitepaper tries to explain why Anyhedge is important and what problem it tries to solve. In a word: volatility. Cryptocurrencies have always been volatile, and it is one of the long-standing issues that crypto naysayers often bring up.
The whitepaper goes on to list some solutions tried in the past, including exchanging crypto for fiat or using different types of stablecoins. Each of these solutions has its own advantages and disadvantages, which are also listed.
Anyhedge takes a market-based approach by trying to enable peer-to-peer ‘risk trading’. A 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 trading tools does more than just solve volatility problems. It also offers opportunities for speculators, and we know that speculation is a huge part of the market today, for better or for worse. This will draw more users to the Bitcoin Cash chain.
To understand how Anyhedge works, we must first understand oracles as they are a key component.
Oracles in Bitcoin are an idea that dates back years. The Bitcoin Wiki talks about “the use of external state” as part of its business, but this is always done indirectly in Bitcoin. Why? This is because the node software is unable to “poll a remote server” or to import a state of conditions. If Bitcoin were set up in such a way, it would have a drastic impact on the whole system and compromise certain properties – for example, the Nakamoto consensus system that ensures that a majority of honest nodes will always outpace the attackers.
But the way the Wiki suggests the use of an oracle is a more primitive method, as the oracle involves evaluating the details of the contract and then interactively signing it.
In many ways this is inferior to using a blind oracle that does not require any interaction and in fact has no awareness of the smart contracts that use the oracle signature. The blind oracle setup uses OP_CHECKDATASIG, a relatively new innovation on Bitcoin Cash (BCH), which does not exist on Bitcoin (BTC).
In 2018, an op_code was added to the Bitcoin Cash protocol called OP_CHECKDATASIG. There is a good article on this opcode here. What makes this opcode possible is that a Bitcoin script checks a digital signature of arbitrary data. This allows oracles to be used in a much more powerful way as the smart contract can be drafted ahead of time without any interaction or permission from the oracle.
A common problem with oracles is that they introduce a point of failure and require trust. However, with the blind oracle setup, the risk of abuse is reduced. In addition, participants using Anyhedge could choose from a variety of oracles, and could theoretically only participate in contracts where the users trust the oracle. In theory, smart contracts could be drafted that allow multiple oracles to be used in different ways, further minimizing risk and reliance on trusted parties.
How Anyhedge works
Now that we understand a little about oracles, how does Anyhedge work? There are two parties to the smart contract, which the newspaper calls “Hedge” and “Short”. I find that terminology somewhat confusing, so let’s just call it “long” and “short”. Since Anyhedge can be used with any asset (such as USD), it is 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 on the dollar and Bob on the dollar.
The smart contract also has an expiration date. The whole thing goes like this: Alice (short on USD) and Bob (long on USD) both put their bitcoin cash (BCH) in the smart contract. At the time of the expiry date, they are both allowed to withdraw bitcoin cash. If it BCH/ USD price is rising, Alice is getting more BCH and Bob gets less. The opposite would happen if the BCH/ USD price was 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’s signature is valid. This is the normal way the smart contracts work – they are closed at maturity. However, there is another way in which the contract can be redeemed, and that is if the price of the asset (such as USD) becomes 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 validates the contract, the money can be withdrawn. The early liquidation is possible because the price has reached one of the two limits.
There is a third way to close the contract, namely a failsafe mechanism. The two parties can conclude the contract in any way they wish (as long as they both agree). This would happen, for example, if the oracle stopped working.
That is it. It’s actually quite simple. Users lock their funds to the smart contract address and can only withdraw under the right conditions.
Creating the market and liquidity
It’s one thing to create an open source protocol on paper, and another to have a working prototype. And it is another thing to have a fully functioning ecosystem that requires liquidity in terms of a sufficient number of participants.
The paper discusses a few different types of “matchmaking setups.”
One possibility is the use of a centralized order book. While 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 allowed. However, this can be combined with a non-custodial client-side setup that retains Anyhedge’s benefits including no custody risk.
For this reason, it makes sense that the first implementation of Anyhedge will be on a centralized exchange.
Another method uses the “Federated” model in which exchanges can communicate with each other via APIs. In theory, Anyhedge contracts could be coordinated between exchanges without trust. Collaboration between exchanges can grow along with a global and reliable demand.
But it is also possible to use Anyhedge contracts between any two parties. An exchange is not even necessary. In practice, order books are needed 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 and potentially more flexible. They are also uncensable and offer more privacy.
Defi and the Bitcoin Cash Advantage
Defi was a huge buzzword in 2020, but are regular users getting involved? One of the most acclaimed applications is the Uniswap smart contract on the Ethereum blockchain, which provides true decentralized exchange (dex) capabilities.
Similar decentralized services can be built on Bitcoin Cash. A big advantage BCH however, the costs are still low, while they are getting quite high on Ethereum. That may change in the future if ETH 2.0 has been rolled out, but it is unclear how long that process will take. In the meantime, BCH is a good option at a low rate for many applications.
Enter the Token
The token is about to be launched. It is an implementation of the Anyhedge protocol.
The folks who ran the Cryptophyl token exchange are busy with its release upcoming product, and the fact that there is a business initiative behind the rollout of this technology is promising as it is likely to receive the attention and resources needed to kickstart liquidity in this burgeoning ecosystem.
Detoken plans to allow SLP token support shortly after launch and says they will allow zero-confirmation transactions, meaning users won’t have to wait for block confirmations before their transactions are made. They also mention combining atomic swaps with Detoken so that reliable and non-custodial transactions can be made with users who have full control over their private keys.
What do you think of Anyhedge and Detoken? Let us know what you think about this topic in the comments 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 invitation to an offer to buy or sell, or a recommendation or endorsement of 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.