Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: Atomic Cross Chain Trading  (Read 1550 times)

0 Members and 1 Guest are viewing this topic.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12242
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Atomic Cross Chain Trading
« on: October 18, 2014, 12:33:15 PM »

For those that did not attend the latest dev hangout, BM briefly explained how cross-chain trading would work.
However, he also stated that ACCT is very low in priority as they see more value from developing escrow ... (imho they are right)

Anyway, I'd like to also let you know how ACCT works.

Let's assume we have Alice wanting to trade 1 bitUSD on BTSX chain for 1 bitUSD
on the DNS chain. Bob wants to do the same .. but the other way round.

Alice goes first (could also be Bob) .. and generates a random passphrase. Let's say

Passphrase: AlIcETraDesWithBoB1USD

Alice generates the hash of the passphrase and gets something like

hash(Passphrase): afb39ca02949c0ae4a6a44e8eef5242fd81bd93072d82ebff145743c1910c098

Alice uses a new kind of transaction (not so new.. it's already in the blockchain and called withdraw_password_type) ..
that transaction goes towards bob and has the following rules

- the transaction is going TO bob
- it has a expiration of .. say 24h .. after that only alice can claim the transaction again
- bob can claim (within 24h) .. ONLY if he knows the password

Alice broadcasts this transaction in the BTSX chain and thus "transfers" the
funds to bob .. who will only be able to claim the shares if alice tells the password!

In the meantime, Bob creates a new transaction in the DNS chain. That
transaction goes to the account name of alice, and uses the exact same hash of
the passphrase (bob see that passphrase from alice's transaction in the btsx
chain) .. and he set's a expiration of less then 24h ..

So, if alice wants to have her shares in the DNS chain, she needs to reveal the
password in order to claim the withdraw_password_type-transaction in DNS.
By doing so, Bob sees the passphrase and can take his shares in the BTSX chain,
beacuse it uses the same passphrase.

Tada .. everything worked out .. everybody happy :)

Remarks:

- It is crucial to have the the second transaction (bob does not know the
passphrase) .. expire WAY earlier than the first transaction to ensure that
alice cannot reclaim an EXPIRED ACCT transaction

- It is crucial (as usual) that the passphrase is chosen securely, and randomly!!

Anything I forgot to describe? Anything unclear?
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline emski

  • Hero Member
  • *****
  • Posts: 1283
    • View Profile
    • http://lnkd.in/nPbhxG
Re: Atomic Cross Chain Trading
« Reply #1 on: October 18, 2014, 12:42:18 PM »
This would work for BTSX and DNS.
What about BTSX and BTC ?
What if Bob just wants to mess with Alice by blocking the funds for 24hours ?
« Last Edit: October 18, 2014, 12:45:49 PM by emski »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12242
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Atomic Cross Chain Trading
« Reply #2 on: October 18, 2014, 12:47:30 PM »
This would work for BTSX and DNS.
What about BTSX and BTC ?
If you can build a script that
a) expires after x hours and
b) can be claimed a multisig (one key from the owner, the other key from the passprhase)
then you should be able to build this for btc to .. yes
not with with a) though

Quote
What if Bob just wants to mess with Alice blocks the funds for 24hours ?
If you'r passphrase is random and long enough it shouldn't be an issue .. will it?
and surely .. you can just a shorter time intervall .. ie 10 minutes ..
however .. the second party should always use a SHORTER time

// edit: .. lol shorter than 10 minutes is no good with BTC ..
actually .. all this might not work well with btc .. due to the "uncertain time" of the next block
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12242
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Atomic Cross Chain Trading
« Reply #3 on: October 18, 2014, 12:56:29 PM »
you could do a double spend in bitcoin ..

a) one transaction with nlocktime going back to your own address
b) one transaction with something like op_check_hash ... for the trade

however .. you would need to have both in the blockchain ...
which the miners should not be allowed to do ..

//edit:
https://en.bitcoin.it/wiki/Atomic_cross-chain_trading
« Last Edit: October 18, 2014, 12:59:13 PM by xeroc »
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline emski

  • Hero Member
  • *****
  • Posts: 1283
    • View Profile
    • http://lnkd.in/nPbhxG
Re: Atomic Cross Chain Trading
« Reply #4 on: October 18, 2014, 01:05:04 PM »
I was just going to write about the double spend option in BTC. Miners will not include both transactions. Only the first one.

Have you seen this thread:
https://bitsharestalk.org/index.php?topic=9075.0 ?

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12242
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Atomic Cross Chain Trading
« Reply #5 on: October 18, 2014, 01:13:22 PM »
I was just going to write about the double spend option in BTC. Miners will not include both transactions. Only the first one.
Thought so ..
If I find some time I will read through:
https://en.bitcoin.it/wiki/Atomic_cross-chain_trading
But it contains exchanging of signed and unsigned transactions .. (ugly, not user friendly)

Quote
Have you seen this thread:
https://bitsharestalk.org/index.php?topic=9075.0 ?
Thx, I will read through it ..
However, from what I can see .. the delegates are involved and you are trading BTSX<->BTC on two chains ..
maybe we should start out with something easier and go for bitBTC <-> BTC first ... not having an exchange ratio
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline emski

  • Hero Member
  • *****
  • Posts: 1283
    • View Profile
    • http://lnkd.in/nPbhxG
Re: Atomic Cross Chain Trading
« Reply #6 on: October 18, 2014, 01:16:03 PM »
I was just going to write about the double spend option in BTC. Miners will not include both transactions. Only the first one.
Thought so ..
If I find some time I will read through:
https://en.bitcoin.it/wiki/Atomic_cross-chain_trading
But it contains exchanging of signed and unsigned transactions .. (ugly, not user friendly)

Quote
Have you seen this thread:
https://bitsharestalk.org/index.php?topic=9075.0 ?
Thx, I will read through it ..
However, from what I can see .. the delegates are involved and you are trading BTSX<->BTC on two chains ..
maybe we should start out with something easier and go for bitBTC <-> BTC first ... not having an exchange ratio

bitBTC <-> BTC or BTSX <-> BTC doesn't matter. That should be the same. And the ratio -> you still should have some kind of ratio even for BTC <-> bitBTC .

Update: Infact there is no incentive for anyone holding BTC to exchange that for bitBTC even at 1:1 unless he wants to trade against other assets on BTSX blockchain. And BTSX is better suited for that.
« Last Edit: October 18, 2014, 01:18:40 PM by emski »

Offline CoinHoarder

  • Hero Member
  • *****
  • Posts: 638
  • In Cryptocoins I Trust
    • View Profile
Re: Atomic Cross Chain Trading
« Reply #7 on: October 18, 2014, 02:54:10 PM »
Why is this a low priority? You've now seen people's reactions that bitUSD will be implemented in Bitshares Vote.. BTSX is down 5% since that announcement was made and it could get much worse. One usually big time Bitshares supporter stated he dumped his BTSX because of it..

IMO it is important to keep bitUSD in BTSX but utilize it in Bitshares vote using atomic cross chain transactions. This way BTSX DAC shareholders don't feel robbed of their biggest feature. It is important that each DAC retain its value by not implementing DAC-specific features in each DAC, but still link them together for the same functionality.
« Last Edit: October 18, 2014, 02:59:13 PM by CoinHoarder »
https://www.decentralized.tech/
Cryptocurrency Social Network
Market Data, Portfolios, Information, Links, Reviews, Forums, and Technologies

Offline bytemaster

Re: Atomic Cross Chain Trading
« Reply #8 on: October 18, 2014, 03:02:13 PM »
You don't understand the issues involved.  Acct is not viable for anything but real time trades of bit usd between two chains
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12242
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Atomic Cross Chain Trading
« Reply #9 on: October 18, 2014, 03:14:39 PM »
So,it's technically impossible to spend BTSX-BitUSD on vote directly?
These are TWO different chains .. there is no such thing as a BTSX-bitUSD in the vote chain ..
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline jsidhu

  • Hero Member
  • *****
  • Posts: 1337
    • View Profile
Re: Atomic Cross Chain Trading
« Reply #10 on: October 18, 2014, 04:34:04 PM »
Is this wat BM mentioned was going to be Turing complete so for example if you have an AUCTION Dac you can encode rules in the script to function as a auction with buy it now as a turing complete implementation using ACCT (auctions are represented in bitUSD)
Hired by blockchain | Developer
delegate: dev.sidhujag

Offline theoretical

Re: Atomic Cross Chain Trading
« Reply #11 on: October 18, 2014, 09:11:19 PM »
For those that did not attend the latest dev hangout, BM briefly explained how cross-chain trading would work.

Is this explanation somewhere online?

Anything I forgot to describe? Anything unclear?

The form of AXCT you describe requires both chains to implement the withdraw_password_type operation.  Thus it is only practical between two BitShares Toolkit chains.  A potential AXCT implementation would have more value if it supported coins such as BTC, LTC, DOGE, etc. (without requiring a hardfork in those non-BitShares Toolkit chains).

Another minor nitpick:  The described protocol is not truly atomic.  If Bob is offline between Alice revealing the password and the expiry of Alice's transaction, Alice may end up with both BTSX and DNS.  You can reduce (but not eliminate) this possibility by lengthening the time Bob would need to be offline for this to happen.

I have proposed a protocol which fixes the above deficiencies.  (emski independently developed an identical protocol.)  However my / our protocol imposes an additional requirement:  It requires a way for the network to "know" whether the delivery of the "foreign" currency occurred.  I.e. we (the BTSX network) need to know what happened on the foreign chain (the BTC network).

One way to satisfy this requirement is having delegates to monitor the foreign chain.  This is less than ideal:  (1) Supporting N altcoins would require the delegates to run N different clients; (2) You have the political problem of choosing which altcoins to support, (3) Fully auditing delegates' good behavior also requires N foreign clients, so you have the problem of either (4) Less thorough delegate auditing, or (5) Running N different clients on all nodes.

I've come up with a less centralized way to meet the requirement without too much burden; a way to make the network "know" what happened on the foreign chain.  However, I haven't written it up yet.  I think AXCT between BTSX and BTC would have some value.  It would make it easier to leverage existing BTC infrastructure.  For example, it would be fairly simple for a third party to use AXCT to build a translation app which allows using BitUSD to pay a specified number of Bitcoins to a specified Bitcoin address, e.g. paying a BitPay invoice [1] [2].

Also, if we have AXCT for DOGE <-> BTSX and BTSX <-> BTC, then essentially we can allow users to trade DOGE <-> BTC without trusting any fiduciary.  Making the "MtGox problem" a thing of the past.

In addition, I suspect a working, live implementation would get us a lot of attention; basically free marketing.

[1] With AXCT support for BitUSD -> BTC, this app would not require any fiduciary trust from the user.  Without AXCT, this app is still possible, but either the app must have API access to the user's account at bter or a similar fiduciary exchange, or the app maintainers must have fiduciary control of user funds.

[2] This app would provide value by (from the user's point of view) enabling every merchant who accepts BTC to also accept BitUSD, without any action on the part of the merchant.
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

Offline Shentist

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 1605
    • View Profile
    • metaexchange
  • BTS: shentist
Re: Atomic Cross Chain Trading
« Reply #12 on: October 18, 2014, 09:51:08 PM »
@drltc

i read you are a C++ coder?
do you think you can programm it?
i am interested to fund it if so.

maybe we could team up with emski to give it a shot?

Offline jsidhu

  • Hero Member
  • *****
  • Posts: 1337
    • View Profile
Re: Atomic Cross Chain Trading
« Reply #13 on: October 18, 2014, 10:19:23 PM »
For those that did not attend the latest dev hangout, BM briefly explained how cross-chain trading would work.

Is this explanation somewhere online?

Anything I forgot to describe? Anything unclear?

The form of AXCT you describe requires both chains to implement the withdraw_password_type operation.  Thus it is only practical between two BitShares Toolkit chains.  A potential AXCT implementation would have more value if it supported coins such as BTC, LTC, DOGE, etc. (without requiring a hardfork in those non-BitShares Toolkit chains).

Another minor nitpick:  The described protocol is not truly atomic.  If Bob is offline between Alice revealing the password and the expiry of Alice's transaction, Alice may end up with both BTSX and DNS.  You can reduce (but not eliminate) this possibility by lengthening the time Bob would need to be offline for this to happen.

I have proposed a protocol which fixes the above deficiencies.  (emski independently developed an identical protocol.)  However my / our protocol imposes an additional requirement:  It requires a way for the network to "know" whether the delivery of the "foreign" currency occurred.  I.e. we (the BTSX network) need to know what happened on the foreign chain (the BTC network).

One way to satisfy this requirement is having delegates to monitor the foreign chain.  This is less than ideal:  (1) Supporting N altcoins would require the delegates to run N different clients; (2) You have the political problem of choosing which altcoins to support, (3) Fully auditing delegates' good behavior also requires N foreign clients, so you have the problem of either (4) Less thorough delegate auditing, or (5) Running N different clients on all nodes.

I've come up with a less centralized way to meet the requirement without too much burden; a way to make the network "know" what happened on the foreign chain.  However, I haven't written it up yet.  I think AXCT between BTSX and BTC would have some value.  It would make it easier to leverage existing BTC infrastructure.  For example, it would be fairly simple for a third party to use AXCT to build a translation app which allows using BitUSD to pay a specified number of Bitcoins to a specified Bitcoin address, e.g. paying a BitPay invoice [1] [2].

Also, if we have AXCT for DOGE <-> BTSX and BTSX <-> BTC, then essentially we can allow users to trade DOGE <-> BTC without trusting any fiduciary.  Making the "MtGox problem" a thing of the past.

In addition, I suspect a working, live implementation would get us a lot of attention; basically free marketing.

[1] With AXCT support for BitUSD -> BTC, this app would not require any fiduciary trust from the user.  Without AXCT, this app is still possible, but either the app must have API access to the user's account at bter or a similar fiduciary exchange, or the app maintainers must have fiduciary control of user funds.

[2] This app would provide value by (from the user's point of view) enabling every merchant who accepts BTC to also accept BitUSD, without any action on the part of the merchant.

This sounds like an approach using oracles or n of m signers... I suggest to look at Automated Transactions or AT (http://ciyam.org/at)

atomic cross-chain transfers(network based) are possible across any block chain that implements the API.. also it is turing complete using a load/store style machine.
Hired by blockchain | Developer
delegate: dev.sidhujag

Offline bernard

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Atomic Cross Chain Trading
« Reply #14 on: January 02, 2015, 02:49:05 AM »
Looks like the same design crispweed over on BTT came up with (and implemented) back in May: https://bitcointalk.org/index.php?topic=628547.0

So is this "withdraw_password_type" tx already in BitShares and working? Theoretically we could do a BTSX to SwapBill trade as a test?

 

Google+