Wednesday, November 27, 2019

trading on the blockchain

Bitcoin is regarded as a digital currency, to some extent, but I often find it useful to think of blockchain as a system for indelibly publishing messages.  In the case of bitcoin, these messages are largely of the form "I am taking the bitcoin I got from [provenance] and giving X of it to [bitcoin address] and Y of it to [other bitcoin address]", and as part of the system of maintaining the blockchain it is verified that the sender has bitcoin from that provenance in a quantity that is no less than X+Y.

Actually buying bitcoin involves, as do all transactions, two legs: you give someone dollars or euros or pizza, and they publish a message on the blockchain publicly relinquishing some bitcoin to you.  There are exchanges that get together people who want to trade dollars for bitcoin and people who want to trade bitcoin for dollars.  When a match is found, the dollars are conveyed in some usual dollar-conveyance manner, and a bitcoin conveyance is published on bitcoin's blockchain.  I'm starting, though, to sort of envision a system in which the blockchain itself serves as the exchange.

Consider a blockchain on which the messages took the form of "I trade W units of asset A and X units of asset B, from [provenances], for Y units of asset C and Z units of asset D."  The process of incorporating a new block of such messages into the blockchain would require verifying that the person submitting the message has at least W units of A and X of B from the stated provenances, and also verifying that the entire block gives up at least as much of every asset as it conveys.  If there is a very small set of prices that clear the market, then calculating how to put such trades together into a valid block gets computationally hard if a lot of these bids are very close to worth zero, but if there aren't too many assets, and there are a fair number of orders that give up a nonnegligible amount of value for some set of market prices, it becomes practically tractable, and certainly sufficiently tractable to reasonably incorporate into the "proof of work" that is part of bitcoin mining.

There are two big technological barriers that occur to me: the simpler one is that there has to be a way to cancel an order that doesn't get executed.  It seems to me that bitcoin must have a way to deal with this — that, if I publish "I give Sam 2 bitcoins" and it doesn't go through within a reasonable amount of time that there must be a way to withdraw it or for it to expire — but I don't know what it is.  Probably the message should include some sort of timestamp and/or expiration time, along with a hash of the message that includes the expiration.  An actual cancel may be impossible.

The other, perhaps bigger, issue, is how the assets get on the relevant blockchain in the first place.  If the only messages convey bitcoin, and all bitcoin originate at some level of indirection from bitcoin mining, then you have a fully closed system, and it's all fine.  I can really only trade things that are on the blockchain, and for this to be useful they have to be able to somehow get there.

One possibility goes back to an older idea I had, and one that I later came to be was largely Ripple's initial idea, which is essentially to let each person have an asset that they can create out of thin air, simply by being them.  I can trade "Dean's dollars" in any quantity for anything I can persuade other people to sell me; the problem is just in getting them accepted..  The provenance is just me.  Other people can then trade them as they will, once I have put them out there.  Maybe some of my friends would be willing to accept a certain amount of Dean's dollars among themselves; widespread acceptance would probably only come to a few currencies issued by a few people who are in some sense trusted (perhaps trusted to back their currency at some ratio with some basket of off-blockchain asset).  You could imagine State Street publishing a list of blockchain addresses it maintains in which it promises to keep the "currency" of each address linked to a corresponding ETF.

No comments: