Author Topic: Atomic Cross Chain Trading  (Read 6913 times)

0 Members and 1 Guest are viewing this topic.

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
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: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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 »

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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

Offline emski

  • Hero Member
  • *****
  • Posts: 1282
    • View Profile
    • http://lnkd.in/nPbhxG
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: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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?