Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounty Claim #29

Open
siulynot opened this issue Feb 19, 2018 · 32 comments
Open

Bounty Claim #29

siulynot opened this issue Feb 19, 2018 · 32 comments

Comments

@siulynot
Copy link

siulynot commented Feb 19, 2018

Hi!
We at the Komodo Platform just did a ETH/DOGE atomic swap. We exchanged it in BarterDEX using ETOMIC.

This is the proof:

SWAP completed! 1322053329-1186185224 {"expiration":1519068637,"tradeid":335663668,"requestid":1322053329,"quoteid":1186185224,"iambob":0,"Bgui":"","Agui":"nogui","gui":"nogui","bob":"ETH","bobtomic":"0x0000000000000000000000000000000000000000","etomicsrc":"0x012f7e74120d3d002e8f215ccc6f6f65618f00cb","srcamount":0.04928730,"bobtxfee":0.00001000,"alice":"DOGE","etomicdest":"0x078a1db84a2995c22cb72a390c3d279448dbfbf2","destamount":10,"alicetxfee":1,"aliceid":"2572377750843424768","sentflags":["alicespend", "bobpayment", "alicepayment", "bobdeposit", "myfee"],"values":[0.04929730, 0, 0.04930730, 12, 0.05546821, 0, 0.01287001, 0, 0, 0, 0],"result":"success","status":"finished","finishtime":1519053161,"bobdeposit":"417b4a91650b74e06b84a50cd4f90c757502f9615ae732702a50682f8925d6fd","alicepayment":"df1547ec128a5d78604bd6c6610c6a6e6b096d8f8ced1acb7bb6ed1611f5322f","bobpayment":"6c3a2269a8f3b111142c1291ffc9548bde61fc2d34ec465486e8a4e937c12217","paymentspent":"f2cf1b572d0084684cf1915de608f664604a92eaf3961d04676e7598d6d12d59","Apaymentspent":"0000000000000000000000000000000000000000000000000000000000000000","depositspent":"0000000000000000000000000000000000000000000000000000000000000000","method":"tradestatus","finishtime":1519053161}

  • bob makes Eth deposit
    ropsten.etherscan.io/tx/0xea333077d5753d29909136f950b2ba224312a0a6ed7dd8558350faaacd877c74

  • alice payment
    dogechain.info/tx/df1547ec128a5d78604bd6c6610c6a6e6b096d8f8ced1acb7bb6ed1611f5322f

  • bob makes Eth payment
    ropsten.etherscan.io/tx/0xdf181653159e77194f8dbd91aa397250062e1f1d38d839b300c29d5678711185

  • alice claims payment
    ropsten.etherscan.io/tx/0x874449fb261e1bda008af33bf8264c464a7363140d34d735b2b02e2d0c891db7

  • bob claims deposit
    ropsten.etherscan.io/tx/0xcda27396a376909ef73e86d241f284de0c6bc04a4c9a6bd19834612408d6800c

@alexvandesande
Copy link

Could you tell us more about how BarterDEX and ETOMIC work?

@jl777
Copy link

jl777 commented Feb 19, 2018

https://github.com/SuperNETorg/komodo/wiki/barterDEX-Whitepaper-v2

the above describes how barterDEX works, it is a bitcoin protocol based atomic swap DEX, with automated ordermatching via orderbooks

@jl777
Copy link

jl777 commented Feb 19, 2018

continuing...

It has taken a lot of work to get barterDEX working and debugged to the level it has and I wanted a solution for swapping ETH/ERC20 that had minimal changes to the source code. So I came up with ETOMIC, which is a special purpose coin whose purpose is to dynamically create a custom colored coin, just for a specific swap.

the ETH side is locked in a contract to be released only if the corresponding ETOMIC utxo is properly spent via atomic swap protocol. Basically possession of the ETOMIC utxo proves you performed the atomic swap and we have ETH side contracts that implement the various hashlocking and time releases.

It is a bit strange, but ETOMIC basically creates a virtual set of utxos for ETH to use for the atomic swap, so we can then use the existing barterDEX to swap ETOMIC as if it was the ETH. With pre and post lock and unlock actions to the ETH smartcontract to make it complete the ETH swap

@siulynot
Copy link
Author

siulynot commented Feb 19, 2018

SWAP 1806692336-4120247766 finished LP_numfinished.1 !

>>>>>>>>>>>>>>>>>>>>>>>>> SWAP completed! 1806692336-4120247766 {"expiration":1519076406,"tradeid":3612540877,"requestid":1806692336,"quoteid":4120247766,"iambob":0,"Bgui":"","Agui":"nogui","gui":"nogui","bob":"ETH","bobtomic":"0x0000000000000000000000000000000000000000","etomicsrc":"0x012f7e74120d3d002e8f215ccc6f6f65618f00cb","srcamount":0.05391053,"bobtxfee":0.00001000,"alice":"DOGE","etomicdest":"0x0bb040504daf112bfcf37548df477d7f7fe6f506","destamount":10,"alicetxfee":1,"aliceid":"14683126010157989888","sentflags":["alicespend", "bobpayment", "alicepayment", "bobdeposit", "myfee"],"values":[0.05392053, 0, 0.05393053, 12, 0.06066934, 0, 0.01287001, 0, 0, 0, 0],"result":"success","status":"finished","finishtime":1519060928,"bobdeposit":"64a801e4536a3a8b0b904374a046e7a7461a2b25bf42da4a51c90f37ec8d9a09","alicepayment":"bbf61f42d5317bfe77d6b334575e51ddaf88e2992ead16e397960dd94a33a7af","bobpayment":"4e2f5476c058ad3d7f8611e6d563b7e590cb40b802d04263e9217a66b9675b74","paymentspent":"64a365bfacb024d072ac3fc966fa284cd99ec5c0f2896f59cae24779e6a82aa0","Apaymentspent":"0000000000000000000000000000000000000000000000000000000000000000","depositspent":"0000000000000000000000000000000000000000000000000000000000000000","method":"tradestatus","finishtime":1519060928}

We have another one.

@jl777
Copy link

jl777 commented Feb 19, 2018

ETOMIC is still in testing stage, but so far it is working as intended on the ETH testnet. to change to mainnet, we just need to change the server we are talking to and create the ETH side smartcontracts on the mainchain.

Since the ETH smartcontract only has to deal with the hash/time locking/unlocking, it can be streamlined as it doesnt have to deal with any ordermatching, blockchain data posting, etc. The only time ETH transactions are needed are when doing a swap, there is no need for oracles to be posting DOGE chain info to the ETH chain

@jl777
Copy link

jl777 commented Feb 19, 2018

The ETOMIC is a special purpose coin that we give out for free. So people shouldnt have problems getting a set of size matched utxos.Well actually we give out free BEER and people can swap BEER for ETOMIC. We will be adding a direct ETOMIC faucet and probably just make it issue the required utxos directly for the requested swap.

from: http://www.dexstats.info/
32 | ETOMIC/BEER | 196.37838754 | 1966.89403343 | 10.01583758

Let me know if you have any more questions.

@siulynot
Copy link
Author

We have also complete and inverse swap... ETH to DOGE....

>>>>>>>>>>>>>>>>>>>>>>>>> SWAP completed! 1937579793-1699304927 {"expiration":1519084788,"tradeid":3535193613,"requestid":1937579793,"quoteid":1699304927,"iambob":0,"Bgui":"","Agui":"nogui","gui":"nogui","bob":"DOGE","etomicsrc":"0x012f7e74120d3d002e8f215ccc6f6f65618f00cb","srcamount":85.85019195,"bobtxfee":1,"alice":"ETH","alicetomic":"0x0000000000000000000000000000000000000000","etomicdest":"0x0bb040504daf112bfcf37548df477d7f7fe6f506","destamount":0.40000000,"alicetxfee":0.00001000,"aliceid":"15630223814500089857","sentflags":["alicespend", "bobpayment", "alicepayment", "bobdeposit", "myfee"],"values":[86.85019195, 0, 87.85019195, 0.40002000, 98.58146594, 0, 0.00051480, 0, 0, 0, 0],"result":"success","status":"finished","finishtime":1519069428,"bobdeposit":"1c36a8a046f5f0c6240c64e8fab8196d2d3153118cbdd8c4161e8731cf002d1a","alicepayment":"e9ec6d31bb10d84c3474767879e1711a7544f5847b817fd7ac167146789b69fa","bobpayment":"f10a32cf69fa0b162ed28547399ede0e04db943a8a3c14336ac92a2ed12f1d08","paymentspent":"840db8628a44dcfc5e6b8ce472f18f56e171a6d492435dd77fb2aceb9681e078","Apaymentspent":"0000000000000000000000000000000000000000000000000000000000000000","depositspent":"0000000000000000000000000000000000000000000000000000000000000000","method":"tradestatus","finishtime":1519069428}

@siulynot
Copy link
Author

siulynot commented Feb 19, 2018

First ever ETH/DOGE atomic swap repeated also on mainnet!!!

>>>>>>>>>>>>>>>>>>>>>>>>> SWAP completed! 4044925166-140654157 {"expiration":1519136718,"tradeid":2889566325,"requestid":4044925166,"quoteid":140654157,"iambob":0,"Bgui":"","Agui":"nogui","gui":"nogui","bob":"DOGE","etomicsrc":"0x078a1db84a2995c22cb72a390c3d279448dbfbf2","srcamount":40.51684390,"bobtxfee":1,"alice":"ETH","alicetomic":"0x0000000000000000000000000000000000000000","etomicdest":"0x0bb040504daf112bfcf37548df477d7f7fe6f506","destamount":0.20000000,"alicetxfee":0.00001000,"aliceid":"18276913042489147393","sentflags":["alicespend", "bobpayment", "alicepayment", "bobdeposit", "myfee"],"values":[41.51684390, 0, 42.51684390, 0.20002000, 47.58144938, 0, 0.00025740, 0, 0, 0, 0],"result":"success","status":"finished","finishtime":1519121307,"bobdeposit":"36cd09f6606b664eaba1ceefe4a629ac965adcd789fada58c3c9b35a996ac3a1","alicepayment":"dc8d8822c02ebc663ee3c8e9b75e72b6b80b8323238b44c8aa9a80760977338d","bobpayment":"149d0f0ba5f6e4d9da43d5c4576a757cc55e5522f8fa80d1234c559f97f4d6d1","paymentspent":"7845590de8fd2397ee570bd38a9451b0ad40844d741473b78517af6161d99b96","Apaymentspent":"0000000000000000000000000000000000000000000000000000000000000000","depositspent":"0000000000000000000000000000000000000000000000000000000000000000","method":"tradestatus","finishtime":1519121307}

Proof of Ethereum tx:
https://etherscan.io/tx/0x674b0fdd27ab43e9afb6dbcbcca25fd2238ae7302e9242abd53bcd1b685f0be8

Proof of Dogecoin tx:
https://dogechain.info/tx/7845590de8fd2397ee570bd38a9451b0ad40844d741473b78517af6161d99b96

@SriCrypto
Copy link

World Leader in Atomic Swaps strikes again. Kudos Team Komodo :)

@soldat13
Copy link

GREAT job Komodo !

@siulynot
Copy link
Author

First DOGE/ETH swap:
>>>>>>>>>>>>>>>>>>>>>>>>> SWAP completed! 1404541970-4285690891 {"expiration":1519136493,"tradeid":0,"requestid":1404541970,"quoteid":4285690891,"iambob":1,"Bgui":"nogui","Agui":"","gui":"nogui","bob":"ETH","bobtomic":"0x0000000000000000000000000000000000000000","etomicsrc":"0x012f7e74120d3d002e8f215ccc6f6f65618f00cb","srcamount":0.05560527,"bobtxfee":0.00001000,"alice":"DOGE","etomicdest":"0x078a1db84a2995c22cb72a390c3d279448dbfbf2","destamount":10,"alicetxfee":1,"aliceid":"12927123131918057473","sentflags":["alicespend", "bobspend", "bobpayment", "alicepayment", "bobdeposit"],"values":[0.05561527, 11, 0.05562527, 12, 0.06257592, 0, 0, 0, 0, 0, 0],"result":"success","status":"finished","finishtime":1519121051,"bobdeposit":"d3ecfbe6ff31e3192863f4514c95d4987c715f3ea2701a2281e54e280006a8af","alicepayment":"861982b929e02db7782b10122c80a407540fd84f9b4abe2216dc79ec48168b81","bobpayment":"2f04811b6518b036e7cc3d23ce7f23e6914d3f7ee878c42c454da3c2f3df8c8b","paymentspent":"95483834f2aeeb1af69cd209c8758d8080930fa6fbd55e5894edc44c09c4e7e3","Apaymentspent":"a701f3aff33fe79459f9ed38713c06c98936767973c62e653ed38d5c959cdd0c","depositspent":"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef","method":"tradestatus","finishtime":1519121051}

Proof of Ethereum tx:
https://etherscan.io/tx/0x5f2226c06c83d7878e0803fd0cc8e41d49f7195c8bf78371e07aa7efc2ec861b

Proof of Dogecoin tx:
https://dogechain.info/tx/a701f3aff33fe79459f9ed38713c06c98936767973c62e653ed38d5c959cdd0c

@alexvandesande
Copy link

I've been reviewing the work and I'm still beginning to understand so here are some questions:

BarterDEX is a decentralized exchange, not a 1:1 bridge, correct? This means that it always requires two parties, a buyer and a seller. You are showing examples of a swap between ETH/DOGE. That is not what the goal of the bounty, which is a swap between DOGE and a ethereum based token (call it DOGE-TOKEN) which keeps a 1:1 parity with Doge at all times.

If that's the case, then the BarterDEX seems like it can be used to solve the first problem: how to create a swap between Doge and any ethereum token, but it doesn't solve the other one, which is how do you create a 1:1 corresponding token.

A possible solution could be to try to create a stable coin, using a similar method (or the same method) that DAI uses, that it always tries to keep a 1:1 price parity with Doge. It's a creative solution but it might be badly received on the Doge community: since you are creating a new token with value parity to doge, without removing doge from circulation, then you're effectively increasing the supply of total dogecoins.

So that's indeed an interesting challenge: how can you use barterDEX to exchange it with a token with price parity with doge AND not alter the total circulating supply of doge?

@jl777
Copy link

jl777 commented Feb 20, 2018

you can deploy marketmakers to swap DOGE for DOGEERC20 at a 1:1 price
this becomes a decentralized solution that doesnt require a centralized asset management

to solve the coin supply issue, you could burn a corresponding amount of DOGE to the amount of DOGEERC20 created

@satindergrewal
Copy link

@alexvandesande I don't have good grasp of this, but may be this will be helpful somewhere: https://github.com/artemii235/etomic-swap

@alexvandesande
Copy link

you can deploy marketmakers to swap DOGE for DOGEERC20 at a 1:1 price
this becomes a decentralized solution that doesnt require a centralized asset management

Well that would be the MakerDao style solution, but it's easier said than done. I believe another project that can be looked into would be Prism, as it should be theoretically possible to create a huge prism backed by only doge - but again, it requires a counterparty (in Prism's case, it's Shapeshift)

to solve the coin supply issue, you could burn a corresponding amount of DOGE to the amount of DOGEERC20 created

But how do you "unburn" it to make sure you can get it back?

Without a full roadmap on how we can turn an atomic swap into a full bridge, I don't feel it merits a bounty. The coinfabrik/truebit team had multiple rounds of conversations before we made the first payment, so I encourage you to make more detailed plans in that direction if you want to receive one too.

@jl777
Copy link

jl777 commented Feb 20, 2018

actually to make a 1:1 market for DOGE/DOGE20 is a matter to make a single autoprice api call, it isnt difficult at all: https://www.youtube.com/watch?v=tPLvO0AUYmI

the idea is that DOGE20 is created by burning DOGE and it is 1:1 equivalent

so the marketmakers are always exchanging DOGE 1:1 for DOGE20, there is no need to unburn it, just swap it back. Our method avoids having to write data regularly to the ETH chain, and I think that is a cost prohibitive approach that btcrelay has. Just use a small fraction of that cost to buy DOGE and burn it and fund the marketmakers

@jl777
Copy link

jl777 commented Feb 21, 2018

What exactly are the requirements for being a full bridge?

@tloriato
Copy link

I'm speaking solely as spectator, not in any official capacity.

@jl777 It's my understanding that a full bridge would be able to allow a party to "transport" its Dogecoin to the Ethereum Network. But what's happening with this "transportation"?

  • The amount sent in Dogecoin is locked within the Dogecoin Blockchain
  • A new equivalent amount is created in the Ethereum Blockchain, possible an ERC777 (ERC20 is so old 😝). Let's call this equivalent DogETH.
  • At any given time this person might choose to destroy an amount of DogETH and "free" those coins in the Dogecoin Blockchain and obtain access to them.

Hopefully my description is accurate but might be wise to wait for 2avsa

@jl777
Copy link

jl777 commented Feb 23, 2018

It seems our current solution is very close to the above, it just requires burning the DOGE to create the DogETH. I guess a difference is that in our method, the DogETH that is created lives forever, but not sure how meaningful these differences are.

@alexvandesande
Copy link

alexvandesande commented Feb 23, 2018 via email

@jl777
Copy link

jl777 commented Feb 23, 2018

it might be possible for us to add a way to "atomic swap" against the smart contract to issue the DogETH without any time limit on the redeem.

If we added that, would it qualify? Actually it could be that just doing that would be enough

@alexvandesande
Copy link

without any time limit on the redeem.

I don't understand what you meant. How that solves the dogeth->doge issue?

@jl777
Copy link

jl777 commented Feb 23, 2018

The only issue with current solution is that to preserve DOGE supply, it required a burn.
So I replaced the burn with a long term lock of DOGE for DogETH. That allows DOGE -> DogETH to be issued without increasing the supply of DOGE and also without any burning.
The swap part is already working

@alexvandesande
Copy link

The problem is NOT keeping the doge supply the same (although that is a nice to have), but mainly the burn itself. Can you describe better how this "long term lock" would work?

Just a general question: the goal of the bounty is to fund new work to be done on the bridge. My goal with this conversation is to set a framework in which, if you propose a plan of new tech to be developed (using or not tools you already accomplished) I want to assure you that after few months of work it will be rewarded. It's not our goal to give a reward by retroactively fitting existing stuff into something that might be technically in scope.

@alexvandesande
Copy link

Not sure this is what you are saying but an interesting solution to this would be to issue new temporary doge tokens that burn after a given period of time, and after this period the doge itself gets released back. Not sure how this would work as it breaks the fungibility of the doge tokens, but it can be an interesting model.

@jl777
Copy link

jl777 commented Feb 23, 2018

There is no need for that. The no-time limit locking of DOGE for DogETH fully solves the requirement as I see it.

What part is not fulfulled?

DOGE supply is unchanged
DOGE can be turned into DogETH by anybody with DOGE (by locking without time limit)
DogETH can be redeemed by the one that locked it at any time
DogETH can be swapped for DOGE 1:1 via atomic swaps, so DOGE <-> DogETH is possible

@alexvandesande
Copy link

I still don't understand the "locking without time limit" bit. What do you mean by that?

@jl777
Copy link

jl777 commented Feb 23, 2018

A special form of an atomic swap where you basically swap the DOGE for DogETH with yourself and it wont have any timelimit.

which means you can redeem the DOGE for DogETH at anytime

The smartcontract would issue DogETH in exchange for the lock and require DogETH back to unlock the DOGE. not sure how exactly to achieve this, but just saying if we achieved that, would we fulfill the requirements

@alexvandesande
Copy link

The smartcontract would issue DogETH in exchange for the lock and require DogETH back to unlock the DOGE. not sure how exactly to achieve this, but just saying if we achieved that, would we fulfill the requirements

Yes. If you are able to do an atomic swap between both then it would be worth a bounty.

As a comparison, the Truebit team worked for many months and presented us a working demo which they were able to execute the one way exchange. If you intend to pursue this bounty, then the next step would probably to document it step by step and make live demo you can demonstrate on a video call.

@jl777
Copy link

jl777 commented Feb 23, 2018

OK, we still need to explore the feasibility of the no time limit DOGE lock, but that is the only missing step. Once we have a plan for the no time limit lock, I will post again the plan.

We are doing the atomic swaps via the barterDEX framework, so getting videos, etc. wont be any problems

@artemii235
Copy link

Hello @alexvandesande!
I have 2 suggestions about 1:1 bridge, first involves BarterDex atomic swaps, second doesn't require BarterDex at all. (However both of them are not truly decentralized and look like proof of authority):
Suggestion A:

  1. DogETH token is created on ETH side - this token has same supply as initial Dogecoin.
  2. Whole DogETH supply is locked on authorized ETH address - this address is not allowed to directly transfer tokens to anyone. He can transfer tokens only to BarterDex smart contracts for further exchange. Also DogETH issuer is not allowed to receive the tokens by direct transfer from anyone - only from exchange Smart Contracts.
  3. DogETH owner places 1:1 orders to BarterDex to exchange DogETH/Doge and Doge/DogETH.
  4. We make an assumption that DogETH issuer is nice. Issuer will lock received Doge voluntarily and use it only on BarterDex to exchange back to DogETH when required.
  5. As whole DogETH supply is initially locked - Dogecoin supply stays same.
  6. DogETH issuer guarantees that he won't transfer his Doge - this means that Doge virtually locked on his address until it will be exchanged back to DogETH.

Suggestion B:

  1. DogETH is mintable, burnable, ownable token. Owner is Multisig smart contract, multisig owners are selected by community.
  2. Dogecoin locker - Doge multisig address which is controlled by community selected addresses.
  3. Once anyone wants to exchange Doge to DogETH he sends Doge to locker multisig.
  4. When Doge is locked - issuers approve mint of appropriate amount of DogETH.
  5. When someone burns DogETH - Doge locker sends appropriate amount of Dogecoin.

Could you review it please and let me know if it make sense?

@alexvandesande
Copy link

We make an assumption that DogETH issuer is nice. Issuer will lock received Doge voluntarily and use it only on BarterDex to exchange back to DogETH when required.

That right there seems to throw the whole plan underwater. If we are assuming nice altruistic users, we don't need smart contracts at all, right? Just send your doge to me and I promise it will be ok. Your second proposal is also similar: it's a political peg, not very different than an exchange.

I'd note that the current front runner also uses a centralized solution in their way to unlock accounts, but it has been accepted because they are using it temporarily and have produced a compelling argument, using correct incentives, that makes sure if the node doesn't behave well, then it will be punished.

Can you see a way in which the whole trust in multisig is unnecessary long term?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants