Bitcoin Forum
May 08, 2024, 10:27:31 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [PATH] On How to create an decentralized exchange  (Read 1676 times)
mrvision (OP)
Sr. Member
****
Offline Offline

Activity: 527
Merit: 250



View Profile
April 13, 2013, 09:20:42 AM
 #1

There's nothing more decentralized than notes and coins... everybody has some in their pockets.  So my guess is that to make a decentralized exchange engine what you need is to create an app that, installed into a mobile, allows shops to become exchange houses.

To make this possible the idea is to reduce it to the simple: the app would only report succesfull transactions into a p2p network.
And would have the ability to calculate the (average) price from all reported transactions.

END.


 Then we can develop solutions to connect to that p2p network and exctract the price, draw charts or whatever...

With this done... you would go downstairs to a bar, and buy some bitcoins.

Remember: When you sell bitcoins, you send them to a bitcoin address, which in this case is shown by the app, that's how it tracks a succesful transaction, and reports it to the network.
1715207251
Hero Member
*
Offline Offline

Posts: 1715207251

View Profile Personal Message (Offline)

Ignore
1715207251
Reply with quote  #2

1715207251
Report to moderator
1715207251
Hero Member
*
Offline Offline

Posts: 1715207251

View Profile Personal Message (Offline)

Ignore
1715207251
Reply with quote  #2

1715207251
Report to moderator
1715207251
Hero Member
*
Offline Offline

Posts: 1715207251

View Profile Personal Message (Offline)

Ignore
1715207251
Reply with quote  #2

1715207251
Report to moderator
Unlike traditional banking where clients have only a few account numbers, with Bitcoin people can create an unlimited number of accounts (addresses). This can be used to easily track payments, and it improves anonymity.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715207251
Hero Member
*
Offline Offline

Posts: 1715207251

View Profile Personal Message (Offline)

Ignore
1715207251
Reply with quote  #2

1715207251
Report to moderator
1715207251
Hero Member
*
Offline Offline

Posts: 1715207251

View Profile Personal Message (Offline)

Ignore
1715207251
Reply with quote  #2

1715207251
Report to moderator
1715207251
Hero Member
*
Offline Offline

Posts: 1715207251

View Profile Personal Message (Offline)

Ignore
1715207251
Reply with quote  #2

1715207251
Report to moderator
alberthendriks
Member
**
Offline Offline

Activity: 86
Merit: 10


View Profile
April 13, 2013, 12:13:25 PM
 #2

Could you eloborate and give examples? I'm working in a p2p exchange project but I have no clue what you're talking about. From what I read I would say that people would voluntarily report their purchases into the app, so other people can know the price (and that's it).
qxzn
Hero Member
*****
Offline Offline

Activity: 609
Merit: 505



View Profile
April 13, 2013, 02:55:10 PM
 #3

There's nothing more decentralized than notes and coins... everybody has some in their pockets.  So my guess is that to make a decentralized exchange engine what you need is to create an app that, installed into a mobile, allows shops to become exchange houses.

To make this possible the idea is to reduce it to the simple: the app would only report succesfull transactions into a p2p network.
And would have the ability to calculate the (average) price from all reported transactions.

END.


 Then we can develop solutions to connect to that p2p network and exctract the price, draw charts or whatever...

With this done... you would go downstairs to a bar, and buy some bitcoins.

Remember: When you sell bitcoins, you send them to a bitcoin address, which in this case is shown by the app, that's how it tracks a succesful transaction, and reports it to the network.


This is a little OT, but isn't it the case that, when you do a lot of exchanging of bitcoins for cash, you're supposed to register as an MSB with FinCEN? (at least in the U.S.)
Luckybit
Hero Member
*****
Offline Offline

Activity: 714
Merit: 510



View Profile
April 15, 2013, 07:20:56 AM
 #4

There's nothing more decentralized than notes and coins... everybody has some in their pockets.  So my guess is that to make a decentralized exchange engine what you need is to create an app that, installed into a mobile, allows shops to become exchange houses.

To make this possible the idea is to reduce it to the simple: the app would only report succesfull transactions into a p2p network.
And would have the ability to calculate the (average) price from all reported transactions.

END.


 Then we can develop solutions to connect to that p2p network and exctract the price, draw charts or whatever...

With this done... you would go downstairs to a bar, and buy some bitcoins.

Remember: When you sell bitcoins, you send them to a bitcoin address, which in this case is shown by the app, that's how it tracks a succesful transaction, and reports it to the network.

http://www.247btc.com/bitcoins/134/how-i-would-manipulate-the-bitcoin-exchange-market-and-how-a-discrete-double-auction-could-stop-me/
mrvision (OP)
Sr. Member
****
Offline Offline

Activity: 527
Merit: 250



View Profile
April 15, 2013, 01:39:05 PM
 #5

Forget about websites like mtgox, bitstamp or whatever. I'm not talking about creating a website (or bunch of websites connected the ones with the others).

Rather than that, the idea is create an android app, that, being downloaded into a mobile lets you trade face 2 face in a shop.

Because the main function of an exchange is to transmit prices information, it is NOT operative to buy bitcoins in a shop to someone who uses a regular wallet, as that trade will not be reported, and the price will be lost (yes you can do it but it involves some problems). Moreover, if all regular exchanges were seized, there wouldn't be any price.

So again, the idea is to create this app, that would function in a p2p network. Once installed:
a) You would have a wallet in that app.
b) You can set the bid/ask price in the app.
c) When you install the app on your cell phone you can report your geolocation (so buyers and sellers can locate you).
d) When someone sends bitcoins to the app's bitcoin address(or when bitcoins are sent from that address), a trade is reported to the p2p network.
e) Clients calculate the price from the transactions reported @price reported.

Some security should be implemented in order to avoid manipulations, but this should be easy to think and integrate in the price calculation function.

For the record:
The German goverment closed bitcoin-24.com bank account due some hacker made transfers from stolen bank accounts to the exchange, and then, he bought bitcoins with the balance. Now all funds are seized.
A website based exchange will NEVER be decentralized, as you need the fiat side: the bank

coqui33
Full Member
***
Offline Offline

Activity: 198
Merit: 100



View Profile WWW
April 15, 2013, 02:57:49 PM
 #6

The challenge with any decentralized exchange lies in how to ensure fairness (stopping one person from scamming the other by agreeing to transfer value second and then reneging), and doing so without involving a TTP (trusted third party, such as escrow or arbitration).

Although research continues on staged back-and-forth signature revelation (Camacho 2012, Fair Exchange of Short Signatures without Trusted Third Party), the basic problem of exchange fairness without a TTP has been mathematically proved to be insoluble (Richard Cleve, "Limits on the security of coin flips when half the processors are faulty.", STOC, 364–369. ACM Press, November 1986).

So, it seems to me that the quest for an unscammable TTP-free exchange protocol must be abandoned. (Bitcoin implements an unscammable TTP-free one-way transfer protocol.) In this light, I suggest that researchers accept the unavoidable need for a TTP and, instead, pursue an exchange protocol that uses the existing network of Bitcoin nodes itself as the trusted third party.

For example, define a "two-way exchange" as a pair of linked one-way transfers. Consider a scheme whereby someone sets up a two-way exchange transaction (comprising a pair of linked one-way transfers) that is somehow stored in the block chain, but not fired off until both parties send in private hashes. Once both authorizations are confirmed, the network simultaneously fires off both of the component one-way transfers.

The fact that one of the transfers sends bitcoins while the other sends a non-bitcoin value (USD, gold coins, copyright permission, etc.) is a minor problem. The non-bitcoin transfer could easily send the combination to a safe-deposit box containing something physical, a bank code to a numbered fiat account, a GPG-signed contractual obligation, or the like.

Armed Citizens and the Law -- NRA-certified firearms instructor
mrvision (OP)
Sr. Member
****
Offline Offline

Activity: 527
Merit: 250



View Profile
April 15, 2013, 03:21:49 PM
 #7

The challenge with any decentralized exchange lies in how to ensure fairness (stopping one person from scamming the other by agreeing to transfer value second and then reneging), and doing so without involving a TTP (trusted third party, such as escrow or arbitration).

Although research continues on staged back-and-forth signature revelation (Camacho 2012, Fair Exchange of Short Signatures without Trusted Third Party), the basic problem of exchange fairness without a TTP has been mathematically proved to be insoluble (Richard Cleve, "Limits on the security of coin flips when half the processors are faulty.", STOC, 364–369. ACM Press, November 1986).

So, it seems to me that the quest for an unscammable TTP-free exchange protocol must be abandoned. (Bitcoin implements an unscammable TTP-free one-way transfer protocol.) In this light, I suggest that researchers accept the unavoidable need for a TTP and, instead, pursue an exchange protocol that uses the existing network of Bitcoin nodes itself as the trusted third party.

For example, define a "two-way exchange" as a pair of linked one-way transfers. Consider a scheme whereby someone sets up a two-way exchange transaction (comprising a pair of linked one-way transfers) that is somehow stored in the block chain, but not fired off until both parties send in private hashes. Once both authorizations are confirmed, the network simultaneously fires off both of the component one-way transfers.

The fact that one of the transfers sends bitcoins while the other sends a non-bitcoin value (USD, gold coins, copyright permission, etc.) is a minor problem. The non-bitcoin transfer could easily send the combination to a safe-deposit box containing something physical, a bank code to a numbered fiat account, a GPG-signed contractual obligation, or the like.


How much does a coffe cost?
mrvision (OP)
Sr. Member
****
Offline Offline

Activity: 527
Merit: 250



View Profile
April 16, 2013, 09:13:48 AM
 #8

I am asking the question just to think out loud.

Here, in Spain a coffee costs about 1.25€. But how do i know the price?
Because when i go to a bar, they usually ask me for 1.25€ in order to give me a coffee... I know for sure that the coffee costs are by the way, about 0.28€ so why are they setting up that price? For sure it has something to do with the demand the place has.

But, if an actor of this market exchanges a coffee for 4€ will he rise the price? Maybe a little... in his geographic area, but not globally, and only for the period it takes to empty his bar. This guy hasn't got a lot of power to create a bubble.

if we assume this is correct and aplicable to the bitcoin market, we could just replicate it. We could make this p2p client take nearby trades in order to calculate the price. This will create something similar to a grid in which if you buy all the bitcoins of your zone the price will only rise where you are, as you move away from where you are, prices would be decreasing, promoting a flow of bitcoins to your area.

Because this system is intended to work in street shops, you actually have to travel to all the exchanges (you have to buy face to face) to change the price because, to change the price, with this system, you would have to disturb all cells of the grid.

Again, i am just trying to work around the problem, but as the OP said... i think this is the path.

As you pointed. The real challenge is to ensure fairness, but IMO thats far an easier task than preventing the bank/gov being unfair with a centralized exchange.
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
April 16, 2013, 10:03:21 AM
 #9

So again, the idea is to create this app, that would function in a p2p network. Once installed:
a) You would have a wallet in that app.
b) You can set the bid/ask price in the app.
c) When you install the app on your cell phone you can report your geolocation (so buyers and sellers can locate you).
d) When someone sends bitcoins to the app's bitcoin address(or when bitcoins are sent from that address), a trade is reported to the p2p network.
e) Clients calculate the price from the transactions reported @price reported.

Again, we should split the exchange operation from the fiat <-> digital conversion operation.

Your idea is like localcoin but with much faster updates.

Your app would basically allow people register that are willing to trade fiat to/from some digital representation of the fiat.  You can then buy digital dollars for real dollars.

A person could walk around with $50 "float" in their wallet and register that they are trying to sell $50 cash for 50 digital dollars from some mint.  It would scan if there was anyone nearby willing to trade.  If not, the trade remains on the system.

The mint could operate in $10k or more transactions, so much easier for the mint.  It could operate anywhere in the world, and for large transactions like that, it would be worth it for people to collect mint coins and return them as a bloc.

The user could set areas where they are willing to be broadcast.  This would allow some privacy, rather than constantly updating your current location to the system. 

Effectively, you would say that you are available when near home or near the city center.  If you pass free wireless and are near one of your available locations, it would update, and updates remain active for say 30 mins.  It wouldn't do constant updates of your exact location, just say "near some landmark".

Your system does work for direct BTC to fiat conversions, but keeping the exchange and minting separate allows the exchange to be more sophisticated, and much more liquid.  Taking a while to confirm a dollar to digital dollar isn't as big a deal as delays when the BTC to dollar exchange rate is moving fast.

Ofc, the app could offer both system, so maybe not really a big deal.  If you set it to poll the exchange, then you get most of the benefits anyway.  Sell orders and buy orders are for people who are offline.

It has the disadvantage that there is no way to confirm orders.  The face to face nature of the transaction means that the buyer of the fiat currency is guaranteed the money.  However, the BTC buyer would have to wait for confirms.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
gollum
Sr. Member
****
Offline Offline

Activity: 434
Merit: 250


In Hashrate We Trust!


View Profile
April 16, 2013, 11:08:18 AM
 #10

We should apply the Western Union model in the bitcoin economy - If some dealer goes bankrupt Western Union is big enough to accept that loss, and the users will never see any loss, they always get the money that someone sent to them from a Western Union dealer. The only risk the clients take is if Western Union itself would go bankrupt.

In the bitcoin economy we want decentralization so we would need several companies like Western Union to compete with each other with handling fiat.
DastanX
Newbie
*
Offline Offline

Activity: 42
Merit: 0



View Profile
April 16, 2013, 12:32:09 PM
 #11

yea but how we cant do real currency to p2p?
mrvision (OP)
Sr. Member
****
Offline Offline

Activity: 527
Merit: 250



View Profile
April 16, 2013, 06:42:39 PM
 #12

I'm very sleepy but i will try to answer:

Your idea is like localcoin but with much faster updates.

Yes, and creating a ticker which localbitcoin doesn't have.
Your app would basically allow people register that are willing to trade fiat to/from some digital representation of the fiat.  You can then buy digital dollars for real dollars.
Incorrect. The app would basically allow people to register that they are willing to trade fiat to/from BITCOINS and their prices.

A person could walk around with $50 "float" in their wallet and register that they are trying to sell $50 cash for 50 digital dollars from some mint.  It would scan if there was anyone nearby willing to trade.  If not, the trade remains on the system.

The mint could operate in $10k or more transactions, so much easier for the mint.  It could operate anywhere in the world, and for large transactions like that, it would be worth it for people to collect mint coins and return them as a bloc.

I didn't understand this, probably because i don't know what a mint is, and google translator doesn't work well for that word. (i'm spanish)

The user could set areas where they are willing to be broadcast.  This would allow some privacy, rather than constantly updating your current location to the system. 
I would do it like an ask -> answer scheme. I mean, you set up your app with your prices and location, and then i want to buy.
My app asks the system: is there someone willing to sell near <location>?
Your app answers: I have 4 bitcoins, i sell them for $80 and i am here <location>
Another 100 apps answer me, so now i see in the map a lot of spots to buy.

It has the disadvantage that there is no way to confirm orders.  The face to face nature of the transaction means that the buyer of the fiat currency is guaranteed the money.  However, the BTC buyer would have to wait for confirms.
It is possible. To do this the app would create a special bitcoin address so any bitcoin comming in, and any bitcoin comming out would be trated as a trade. Of course you could use this address in other wallet (there are ways  to lock this possibility and make it inaccesible from any other wallet btw).  Because of its face to face nature, an honest buyer knows that he must take the bitcoins comming from the app, and an honest seller knows that he must send the bitcoins to the wallet. Of course, he could do trades to manipulate the price, but there are ways to defend the system, first by treating them as an anomaly and second, if this anomaly only afects nearby people.

The key issue here is: can this network be built in order to PROTECT THE PRICE (MtGox has shown being not capable)? I believe yes.
And secondly, when you want to buy another currency you don't go to an online exchange, you go to the bank or to a currency exchange, but you walk. So, i want people (and now i'm thinking of my 68 years old father), to walk to a shop and be able to buy/sell bitcoins (just as walmart does).
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
April 16, 2013, 07:10:44 PM
 #13

Well, collecting prices from OTC trades might be the smaller problem... already on localbitcoins people are getting mugged + robbed here and there. Announcing to an anonymous crowd your exact location and that you will carry larger amounts of cashor digital money that is equivalent to cash is not a smart move in my opinion.

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
mrvision (OP)
Sr. Member
****
Offline Offline

Activity: 527
Merit: 250



View Profile
April 16, 2013, 07:32:36 PM
 #14

Well, collecting prices from OTC trades might be the smaller problem... already on localbitcoins people are getting mugged + robbed here and there. Announcing to an anonymous crowd your exact location and that you will carry larger amounts of cashor digital money that is equivalent to cash is not a smart move in my opinion.

Well originally i wrote this post thinking in shops. Shops usually have large amount of money (and not always get robbed) it could be  optional to broadcast the amount, the price you are asking/bidding and/or your location.  You can broadcast prices with a non precise location (using geohashes). So everybody nearby will know that the price was broadcasted near but they would not know the exact location.

Again, the thing is to know and protect the price.
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
April 16, 2013, 07:50:03 PM
 #15

I'm not sure if that is even needed.

A coffee around here costs... well, guess what - it won't matter to you, as you are far from my country. Selling a coffee won't change anything in Spain. Logging trades between me and local coffee shops might be an interesting task but ultimately it's neither me nor the coffe shop who creates and dictates the price of coffee.

Unless your partner uses digital money that can be externally verified (or rather publicly, as all bank transactions are anyways externally visible to various agencies) like coloured coin or Ripple, you won't be able to gather any meaningful data for trades. Also volumes in street shops would anyways probably be neglectable. If a shop owner acts as "wholesale" salesman of Bitcoin, he probably anyways logs a larger trade at an established exchange, and sells the coins later for a small profit if possible. If he could make a large profit, others would probably rather also buy online and he wouldn't sell at a loss very often. I don't see a lot of benefit on logging trades there.

Also: What about fees? If the shop owner seels the coins via credit card, he has a certain fee on top of that - who pays it and how do you log it?

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
April 16, 2013, 07:54:39 PM
 #16

So, i want people (and now i'm thinking of my 68 years old father), to walk to a shop and be able to buy/sell bitcoins (just as walmart does).[/b]

What about creating scratch cards and when you scratch them, they have the QR code for unlocking a coloured coin.

Shops could sell those.  This again raises the problem of BTC having a moving price relative to fiat.  A shop won't stock a card that has variable price, it needs to have a fixed price the fiat.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
vite
Legendary
*
Offline Offline

Activity: 1018
Merit: 1000


View Profile
April 17, 2013, 12:48:39 AM
 #17

The party recieving bitcoins would sign a message to the address of the sending party essentially saying I agree to exchange X amount of btc for X amount of FIAT (core developers would have to agree on creating a weighted ticker for different currencies) then the other party would send. Reading completed tx where there is a proven transfer of funds would be published in the blockchain and that info can be used to publish data and price tickers can be shown on the client/wallets.

So the already existing networks of nodes can also be used as a method of exchange.
gollum
Sr. Member
****
Offline Offline

Activity: 434
Merit: 250


In Hashrate We Trust!


View Profile
April 17, 2013, 01:09:43 AM
 #18

So, i want people (and now i'm thinking of my 68 years old father), to walk to a shop and be able to buy/sell bitcoins (just as walmart does).[/b]

What about creating scratch cards and when you scratch them, they have the QR code for unlocking a coloured coin.

Shops could sell those.  This again raises the problem of BTC having a moving price relative to fiat.  A shop won't stock a card that has variable price, it needs to have a fixed price the fiat.

Therefore we need stable exchanges where third parties such as BitPay can hedge the currency risk of BTC/USD
MegaBrutal
Member
**
Offline Offline

Activity: 60
Merit: 10


View Profile
April 19, 2013, 11:30:49 PM
 #19

Not sure if it's applicable, but... some days ago as I was browsing the Bitcoin Wiki, I found something really interesting. The Bitcoin protocol has far more capabilities than I imagined!

Read this:
https://en.bitcoin.it/wiki/Contracts

Basically, Bitcoin transactions are not limited to the use of just transfer some BTC from an address to another. It is possible to make special transactions to use as contracts between parties. See fidelity bonds, for example. Maybe contracts could somehow be used in your p2p currency exchange system. I don't have any concrete ideas, though, but it is certainly a possibility worth to explore.

Currently, contracts, being non-standard transactions, are rejected by the main Bitcoin network (though they can be experimented with on testnet), but I don't think it's a major obstacle: if we think up an exact scheme for a new type of transaction, if it's needed, we could have it standardized by the Bitcoin client developers, if we prove it is secure and useful. But this is really the last thing.

BTC: 18nAftZTnH4LjY9fPPow1aF5tGD1JiF7ZH
LTC: LV9MiA3iPVUm8qRFYbLkARuoYwvmHwhWaC

Buy some Negro candies!
MegaBrutal
Member
**
Offline Offline

Activity: 60
Merit: 10


View Profile
April 20, 2013, 12:13:03 AM
 #20

Look here:
http://youtu.be/mD4L7xDNCmA?t=24m50s

At 24:50 - there is already a concept for a P2P currency exchange system - though if I get it correctly, it could only work well if BTC would be more adopted. Still it worth to consider. Maybe it just needs to be implemented.

BTC: 18nAftZTnH4LjY9fPPow1aF5tGD1JiF7ZH
LTC: LV9MiA3iPVUm8qRFYbLkARuoYwvmHwhWaC

Buy some Negro candies!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!