Bitcoin Forum
June 22, 2024, 03:42:49 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Alternate cryptocurrencies / Altcoin Discussion / shibacharity token on: June 26, 2021, 05:23:08 PM
The virus was first identified in December 2019 in Wuhan, China. As of 13 June 2021, more than 175 million cases have been confirmed, with more than 3.79 million confirmed deaths attributed to COVID-19, making it one of the deadliest pandemics in history.
ShibaCharity ($SHICHA) come out with an excellent and meaningful idea and it has been created by experienced members of the crypto community who wanted to make a real impact on COVID-19 research and treatment around the world.
2.5% of all transactions will be constantly donated towards COVID-19 treatment
COVID-19 is like any other challenge we face in our lives and we should never give up, we are going to be the first meme crypto fight against Covid-19. Let’s fight and win!
2  Bitcoin / Development & Technical Discussion / Re: Trustless Leveraged Trading via Atomic Swaps on: June 26, 2021, 04:28:55 PM
I want to propose a clever mechanism here for building actual markets/exchanges with Atomic Swap technology.

The basic idea is to run a sort of "smart contract" that is really a specialized blockchain of its own.
It does not matter which consensus algorithm it uses, the important points are:

- Has specialized transaction types for making and taking BTC/ALT Atomic Swap offers
- Is 'aware' of Bitcoin chain
- Is 'aware' of Altcoin chain
- Has a native token, let’s call it $TRADE (The native token could be airdropped, mined, backed by USD, whatever works well)

Now an offer to swap BTC/ALT looks something like:
- Volume
- Rate
- Collateral in $TRADE (deposited with the offer)
- Required taker collateral in $TRADE

What is the collateral for? Atomic Swap markets are easily DoS-attackable, you just initiate lots of trades, but don’t follow through with the Atomic Swap protocol. In my proposed design, if either side stops following protocol, they lose their collateral to the counterparty.
That is, in the happy case, both sides can conduct the Atomic Swap entirely in private and simply sign off on a final "Atomic Swap executed" TX jointly, to unlock both of their collaterals on the $TRADE chain.
In the unhappy case that one side tries to dodge the Swap, the victim commits a "complaint" tx to the $TRADE chain. If the perpetrator does not respond with a counter-proof (by pointing to the TX it has conducted on the BTC or ALT chain), their collateral is claimed.
(Inspired by this article: https://medium.com/@graycoding/lessons-learned-from-making-a-chess-game-for-ethereum-6917c01178b6)

Now the interesting thing is we don’t have to dictate the amount of collateral deposited. We can let the market decide.
You can offer better exchange rates, at lower collateral, or worse rates at higher collateral.
At any point, if the unrealized loss from your position exceeds the collateral, you will probably just forfeit the collateral instead of following through with the Swap.
See this very good article for an intro to these dynamics: https://blog.bitmex.com/atomic-swaps-and-distributed-exchanges-the-inadvertent-call-option/

(What you can also try is to build a reputation (your trade history can be public on-chain, after all) as being an honest trader that always Swaps, letting you 'get away' with lower collateral because you have executed 1000 Swaps and dodged 0, for example.)

_____

OK, now we take this to another level. We don’t want every trade to actually be an Atomic Swap – transactions on $BTC and other chains are costly!
Let’s make positions fungible.

Alice posts offer:
- 1 BTC for 50 ALT
- Collateral 100 $TRADE, taker has to bring the same. Let’s say 100 $TRADE is worth 0.1 BTC, so the collateral covers 10% of the position.

Bob takes the offer. Now Bob owes Alice 50 $ALT and Alice owes Bob 1 $BTC. We can think of these as 'positions' in trading,
as long as neither Bob nor Alice insists on the Atomic Swap being executed, they simply hold the 'Call Option'.

Market develops, Carol comes around and posts offer:
- 55 ALT for 1 BTC
- 110 $TRADE collateral

Bob can use the +1 BTC position he holds against Alice, to take this trade! He pockets the 5 $ALT / 10 $TRADE winnings.
Now we have:
- Carol owes Alice 50 $ALT
- Carol owes Bob 5 $ALT, or 10 $TRADE (excess collateral)
- Alice owes Carol 1 BTC
- The position between Alice and Carol is collateralized with 100 $TRADE as before. (Collateral must not shrink)

Bob can now demand payment of 5 $ALT from Carol. Again if Carol does not pay, he complains on the $TRADE chain and the chain decides to let him claim the 10 $TRADE collateral, unless Carol can point to the transaction on the ALT chain where she has actually paid Bob.

Note that Bob needed to find an offer that had a better rate as well as excess collateral to cover his winnings.
He could’ve also made use of an offer that had the _same_ rate, but more collateral, and just claim the excess collateral!

_____


What we discovered is that Bob can trade with leverage. Maybe he owns neither 1 BTC or 50 ALT – he just owns 0.1 BTC worth of $TRADE. So he just traded with 10x leverage.
The scheme is extremely capital-efficient. Rather than locking up the complete worth of the position like in a spot market, or taking out a loan to fund a leveraged position, you transparently engage in trades that are in the end only secured by the collateral.
As the Bitmex article put it, »it may be better to embrace the call option feature as a viable product, rather than ignoring or fighting it.«

Since both "force execution of a position" and "exit a position by trading it away" would be actions on the $TRADE chain, Alice can try calling Bob out on his leveraged play, by frontrunning his trade TX with a TX that forces their pending Swap to start being executed.
In this case, his lack of real funds would come to light and he’d lose his position AND his collateral, even though he was winning the trade! This is a feature.

So, to make life for people like Bob feasible, we can introduce timing windows to positions, e.g. "this Atomic Swap can only be forced to execute from Oct 1, and no later than Oct 3" – like Futures. So if Bob takes the position with Alice on Sep1, he’s got 1 month to exit until his 'bluff' can be called.
He can 'roll' his futures by finding trades of Oct1 vs. Nov1 position etc. A lot of different markets can develop on the $TRADE chain. The number of actually executed Atomic Swaps may grow very very small, but the threat of forcing execution is the thing that makes this market work completely without price Oracles.

There’s a lot of questions I haven’t touched in this overview, and maybe the idea holds a fatal flaw – hard to tell. Would love to hear input on this.

Stray notes:
- Of course there must be BTC/TRADE and ALT/TRADE markets, too
- Many trade-chains can exist and parallel and be arbitraged between, it works wonderfully, scales
- Frontends could offer close-to normal exchange experience, hide the nitty-gritty details of comparing different offers
- Closing one position via another trade can also be done just partially, with the obvious implications of looking at keeping collateral/volume ratio the same etc.
- Positions can also demand an up-front premium in exchange for better rates, mimicking Options. The premium can even be payable in BTC or ALT, does not have to be $TRADE
- To avoid adjusting rates on your offers all the time, you can hook into external price streams. Basically you demand from the Taker a "signed message from #myFavorityCentralizedExchange" that asserts the rate at block height X is Y. Your favorite exchange publishes these messages as a service. Could be multi-sig by a consortium of CEX, too. You get the idea.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!