elective-stereophonic
elective-stereophonic
Atomic currency exchange singapore
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Stable Nxt Client: Nxt 1.12.2

Author Topic: Atomic currency exchange  (Read 4519 times)

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Atomic currency exchange
« on: April 17, 2014, 07:43:52 pm »

What do u think of such the workflow for atomic currency exchange:

1. Alice sends transaction "Exchange my currency A (amount B) for someone's currency C (amount D).
2. Someone accepts the offer by sending a special transaction that transfers A from Alice in exchange for C.

Alice can specify an account that allowed to do step 2. All other accounts will be rejected in this case.
Also Alice sets an expiration time for the offer.
Logged

martismartis

  • Hero Member
  • *****
  • Karma: +73/-10
  • Offline Offline
  • Posts: 1238
    • View Profile
Re: Atomic currency exchange
« Reply #1 on: April 17, 2014, 07:55:53 pm »

Can we name it decentralized escrow?
Logged

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Atomic currency exchange
« Reply #2 on: April 17, 2014, 07:59:28 pm »

What do u think of such the workflow for atomic currency exchange:

1. Alice sends transaction "Exchange my currency A (amount B) for someone's currency C (amount D).
2. Someone accepts the offer by sending a special transaction that transfers A from Alice in exchange for C.

Alice can specify an account that allowed to do step 2. All other accounts will be rejected in this case.
Also Alice sets an expiration time for the offer.
This sounds really good!

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

bitcoinpaul

  • Hero Member
  • *****
  • Karma: +590/-590
  • Offline Offline
  • Posts: 3097
  • Karmageddon
    • View Profile
Re: Atomic currency exchange
« Reply #3 on: April 17, 2014, 08:00:17 pm »

Is this between different coins (monetary system) in Nxt?
Logged
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Atomic currency exchange
« Reply #4 on: April 17, 2014, 08:56:21 pm »

Is this between different coins (monetary system) in Nxt?

Yes. Or between NXT and subcurrencies.
Logged

bitcoinpaul

  • Hero Member
  • *****
  • Karma: +590/-590
  • Offline Offline
  • Posts: 3097
  • Karmageddon
    • View Profile
Re: Atomic currency exchange
« Reply #5 on: April 17, 2014, 08:59:28 pm »

I missed subcurrencies. What's that?
Logged
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

ChuckOne

  • Hero Member
  • *****
  • Karma: +293/-17
  • Offline Offline
  • Posts: 3450
  • ☕ NXT-4BTE-8Y4K-CDS2-6TB82
    • View Profile
Re: Atomic currency exchange
« Reply #6 on: April 17, 2014, 09:50:19 pm »

I missed subcurrencies. What's that?

Just a name for the coins that are backuped by Nxt. Do you have a better name? I would rather have a better one. Subcurrency sounds sooo sub.
Logged

ChuckOne

  • Hero Member
  • *****
  • Karma: +293/-17
  • Offline Offline
  • Posts: 3450
  • ☕ NXT-4BTE-8Y4K-CDS2-6TB82
    • View Profile
Re: Atomic currency exchange
« Reply #7 on: April 17, 2014, 09:51:19 pm »

What do u think of such the workflow for atomic currency exchange:

1. Alice sends transaction "Exchange my currency A (amount B) for someone's currency C (amount D).
2. Someone accepts the offer by sending a special transaction that transfers A from Alice in exchange for C.

Alice can specify an account that allowed to do step 2. All other accounts will be rejected in this case.
Also Alice sets an expiration time for the offer.

Sounds like phasing.
Logged

CryptoScalper

  • Full Member
  • ***
  • Karma: +10/-24
  • Offline Offline
  • Posts: 192
  • Banned!
  • I DO NOT CONSENT
    • View Profile
Re: Atomic currency exchange
« Reply #8 on: April 18, 2014, 08:02:33 am »

Just a name for the coins that are backuped by Nxt. Do you have a better name? I would rather have a better one. Subcurrency sounds sooo sub.

Hey...  I'm sure you've heard of the Greenback...  we should call them NXTback!!!    :D
Logged
"A world with the money can not be perfect." - BCNext

bob_ggg

  • Jr. Member
  • **
  • Karma: +9/-0
  • Offline Offline
  • Posts: 90
    • View Profile
Re: Atomic currency exchange
« Reply #9 on: April 18, 2014, 11:03:06 am »

What do u think of such the workflow for atomic currency exchange:

1. Alice sends transaction "Exchange my currency A (amount B) for someone's currency C (amount D).
2. Someone accepts the offer by sending a special transaction that transfers A from Alice in exchange for C.

Alice can specify an account that allowed to do step 2. All other accounts will be rejected in this case.
Also Alice sets an expiration time for the offer.
You might want to add the typical "all or none" or "partial order fill accepted"
Logged

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Atomic currency exchange
« Reply #10 on: April 18, 2014, 11:18:23 am »

You might want to add the typical "all or none" or "partial order fill accepted"

Good idea.
Logged

gs02xzz

  • Hero Member
  • *****
  • Karma: +56/-12
  • Offline Offline
  • Posts: 1101
    • View Profile
Re: Atomic currency exchange
« Reply #11 on: April 18, 2014, 02:35:52 pm »

Great idea!

Don't forget there is a 5M Nxt bounty for this type project from the biggest Nxt whale - https://bitcointalk.org/index.php?topic=498898.0
Logged
Nxt Mission is to commercialize the crypto technology and build new commerce and society.

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Atomic currency exchange
« Reply #12 on: April 18, 2014, 02:36:34 pm »

Great idea!

Don't forget there is a 5M Nxt bounty for this type project from the biggest Nxt whale - https://bitcointalk.org/index.php?topic=498898.0

The bounty is for connecting Bitcoin and Nxt. I'm talking about currencies running on top of Nxt.
Logged

gs02xzz

  • Hero Member
  • *****
  • Karma: +56/-12
  • Offline Offline
  • Posts: 1101
    • View Profile
Re: Atomic currency exchange
« Reply #13 on: April 18, 2014, 02:48:58 pm »

The bounty is for connecting Bitcoin and Nxt. I'm talking about currencies running on top of Nxt.

Thanks for clarify it. I guess we still need a topic for the Cross Chain Transactions somewhere else.
Logged
Nxt Mission is to commercialize the crypto technology and build new commerce and society.

allwelder

  • Hero Member
  • *****
  • Karma: +196/-13
  • Offline Offline
  • Posts: 1867
  • NxtChina.org
    • View Profile
    • NxtChina.org
Re: Atomic currency exchange
« Reply #14 on: April 24, 2014, 02:42:02 am »

What do u think of such the workflow for atomic currency exchange:

1. Alice sends transaction "Exchange my currency A (amount B) for someone's currency C (amount D).
2. Someone accepts the offer by sending a special transaction that transfers A from Alice in exchange for C.

Alice can specify an account that allowed to do step 2. All other accounts will be rejected in this case.
Also Alice sets an expiration time for the offer.
Currencies are based on AE or something other?
Logged
NxtChina |Weibo |Twitter Donation welcomed:NXT-APL9-66GU-K8LY-B3JJJ

Come-from-Beyond

  • Hero Member
  • *****
  • Karma: +794/-671
  • Offline Offline
  • Posts: 4013
    • View Profile
Re: Atomic currency exchange
« Reply #15 on: April 24, 2014, 06:15:33 am »

Currencies are based on AE or something other?

Other.
Logged

2Kool4Skewl

  • Hero Member
  • *****
  • Karma: +396/-246
  • Offline Offline
  • Posts: 1897
  • Banned!
  • Because I'm a Genius
    • View Profile
Re: Atomic currency exchange
« Reply #16 on: April 25, 2014, 03:49:55 am »

What do u think of such the workflow for atomic currency exchange:

1. Alice sends transaction "Exchange my currency A (amount B) for someone's currency C (amount D).
2. Someone accepts the offer by sending a special transaction that transfers A from Alice in exchange for C.

Alice can specify an account that allowed to do step 2. All other accounts will be rejected in this case.
Also Alice sets an expiration time for the offer.
Currencies are based on AE or something other?

Currencies are based on AE or something other?

Other.

I believe they will be run on parallel chains.
Logged
We are the descendants of Bitcoin.  We are the continuation of the cause it started, but that perished with its centralization.
An economic system is a manifestation of an ideology.  What was lost, we shall reclaim.
"The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Atomic currency exchange
« Reply #17 on: May 06, 2014, 06:30:04 pm »

Great idea!

Don't forget there is a 5M Nxt bounty for this type project from the biggest Nxt whale - https://bitcointalk.org/index.php?topic=498898.0
I believe I have a solution for this that can be implemented now. In fact I already have it coded and just need to debug it.

NXTsubatomic cross chain transactions create synchronized and overlapped micropayment channels https://en.bitcoin.it/wiki/Contracts#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party. This allows both parties to incrementally receive their portion in a trustless way, except for the chance that you end up short 1 micropayment, currently 1%. The percentage can be reduced, but that increases the time to complete the exchange. Currently, once the payments get going, 1% gets exchanged each second.

NXTatomic swaps implements escrow of any NXT txA for any NXT txB, eg. txX can be sending NXT or NXT assets (or any other transaction). It uses a process similar to what is described in https://nxtforum.org/nrs-releases/nrs-v0-9-9/msg10942/#msg10942
NXTatomic swap creates a linked pair of transactions, either both happen or neither happen, other than the edge case when the party that holds the trigger transaction waits until the deadline and only his tx gets through. since that is against his interest, I am ignoring this possibility.

I have a third case, which has no name yet, where I create a hybrid NXTsubatomic/NXTatomic by creating a micropayment channel equivalent for NXT. This allows direct exchange of BTC <-> NXT in a trustless way.

My concern is with https://bitcointalk.org/index.php?topic=515370.0, it isnt exactly the same, but I dont fully understand malleability and so I worry that the same sort of thing could mess up the micropayments.

My understanding is that after the funding transaction is confirmed, then receiving a signed tx using the outputs of the funding tx is as good as receiving payment. Since the funding tx went into a multisig acct that you are a signer of, you can be assured that there are no other transactions that can take precedence.

To setup a BTC <-> NXT exchange, bob wants to send nancy 1 BTC in exchange for 20,000 NXT.

bob creates an unbroadcast funding tx into a 2:2 multisig acct to get its txid. He uses that txid to create a refund tx back to himself that isnt valid for 24hrs and sends the rawtransaction to nancy. she signs it and sends it back to bob who then broadcasts the funding tx. Bob also creates any NXT tx just to create a fullhash that can be used by nancy and sends the raw data to her.

Nancy uses the NXT fullhash to create a referenced tx that pays bob 200NXT and sends it to bob. bob verifies nancy's tx decodes properly and sends nancy the signed tx bytes for .01 BTC

As each side receives the micropayment, they create a new micropayment that is 1% more, until 100% is done

Bob then broadcasts his NXT tx and nancy's 100% payment to him, they get confirmed in the following two blocks
nancy broadcasts the 100% payment to her, this invalidates the refund tx since it uses the same utxo of the funding tx

My big question is if there are any points in the above sequence where one side is more than 1% out of pocket.

Hmmmm. Now that I write this, I think nancy can empty her NXT acct so the transactions she is sending to bob will fail when it gets submitted. I will need to change the process a bit so that bob needs to broadcast the tx's he is getting from nancy to make sure it gets accepted by the network. It wont confirm until the trigger tx is broadcast but bob will have assurance that nancy cant drain the acct. The practical considerations are that currently it will cost 100NXT in tx fees and require 10000 NXT in reserves for the duration.

Ok, so with the modification that bob is verifying with the NXT network that nancy's tx's are accepted, do you see any flaws?

James

There is another way to implement BTC <-> NXT in a single pair of transactions, but it requires creating nonstandard bitcoin tx,which is only accepted by one mining pool and could take hours or even a day to get confirmed, it also appears vulnerable to malleability, so I chose the micropayments method instead.
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer
 

elective-stereophonic
elective-stereophonic
assembly
assembly