BIP 0020: Difference between revisions
Strip all high-level unit and exponent stuff |
Replace real addresses with example address |
||
Line 47: | Line 47: | ||
Just the address: | Just the address: | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L | ||
Address with name: | Address with name: | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?label=Luke-Jr | ||
Request to send 20.30 BTC to Luke-Jr: | Request to send 20.30 BTC to "Luke-Jr": | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=2030000000&label=Luke-Jr | ||
Request to send 400 TBC | Request to send 400 TBC: | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=26214400 | ||
Request to send 4000 TBC | Request to send 4000 TBC: | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=1073741824 | ||
Request to send 5 uBTC: | Request to send 5 uBTC: | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=500 | ||
Request to send 50 BTC with message: | Request to send 50 BTC with message: | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=5000000000&label=Luke-Jr&message=Donation%20for%20project%20xyz | ||
Characters must be URI encoded properly. | Characters must be URI encoded properly. | ||
Line 86: | Line 86: | ||
In my opinion, the most basic idea of the URI scheme (as this is a currency) is to facilitate payment. So the URIs should represent first and foremost payments. If it represents something else, this needs to be specified. Thus | In my opinion, the most basic idea of the URI scheme (as this is a currency) is to facilitate payment. So the URIs should represent first and foremost payments. If it represents something else, this needs to be specified. Thus | ||
<code> | <code> | ||
bitcoin: | bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L | ||
</code> | </code> | ||
represents a '''payment''' to me using my bitcoin address, not my bitcoin address itself. So after parsing the URI (via link/qr/whatever) the application should open a transaction window with the address filled in. You then need to add an amount and confirm the payment. | represents a '''payment''' to me using my bitcoin address, not my bitcoin address itself. So after parsing the URI (via link/qr/whatever) the application should open a transaction window with the address filled in. You then need to add an amount and confirm the payment. |
Revision as of 00:33, 20 April 2011
This is about creating a URI scheme for bitcoin. Previous discussion was in this forum thread. x-btc specification is at x-btc.
RFC 3986
the following is taken from wikipedia
Internet standard STD 66 (also RFC 3986) defines the generic syntax to be used in all URI schemes. Every URI is defined as consisting of four parts, as follows:
<scheme name> : <hierarchical part> [ ? <query> ] [ # <fragment> ]
The scheme name consists of a letter followed by any combination of letters, digits, and the plus ("+"), period ("."), or hyphen ("-") characters; and is terminated by a colon (":").
The hierarchical part of the URI is intended to hold identification information hierarchical in nature. Usually this part begins with a double forward slash ("//"), followed by an authority part and an optional path.
- The authority part holds an optional user information part terminated with "@" (e.g.
username:password@
), a hostname (i.e. domain name or IP address), and an optional port number preceded by a colon ":".
- The path part is a sequence of segments (conceptually similar to directories, though not necessarily representing them) separated by a forward slash ("/"). Each segment can contain parameters separated from it using a semicolon (";"), though this is rarely used in practice.
The query is an optional part separated with a question mark, which contains additional identification information which is not hierarchical in nature. The query string syntax is not generically defined, but is commonly organized as a sequence of <key>=<value>
pairs separated by a semicolon[1][2][3] or separated by an ampersand, for example:
Semicolon:key1=value1;key2=value2;key3=value3
Ampersand:key1=value1&key2=value2&key3=value3
The fragment is an optional part separated from the front parts by a hash ("#"). It holds additional identifying information that provides direction to a secondary resource, e.g. a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an id
attribute of a specific element and web browsers will make sure this element is visible.
Proposed specification
[] means optional, <> are placeholders
bitcoin:<address>[?][amount=<size>][&][label=<label>][&][message=<message>]
Query Keys
- label: Label for that address (e.g. name of receiver)
- address: bitcoin address
- message: optional message that is shown to the user after scanning the QR code
- size: amount of base bitcoin units (cuBTCents/TBCᵇ-- NOT full DecimalBitCoins/BTC nor TonalBitCoins/TBC)
Examples
Just the address:
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L
Address with name:
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?label=Luke-Jr
Request to send 20.30 BTC to "Luke-Jr":
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=2030000000&label=Luke-Jr
Request to send 400 TBC:
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=26214400
Request to send 4000 TBC:
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=1073741824
Request to send 5 uBTC:
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=500
Request to send 50 BTC with message:
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L?amount=5000000000&label=Luke-Jr&message=Donation%20for%20project%20xyz
Characters must be URI encoded properly.
BNF syntax
bitcoinurn = "bitcoin:" bitcoinaddress [ ";version=" bitcoinversion ] [ "?" bitcoinparams ] bitcoinaddress = FIXME :) bitcoinversion = "1.0" bitcoinparams = *bitcoinparam bitcoinparam = amountparam | labelparam | messageparam amountparam = "amount=" amount amount = digits labelparam = "label=" *uchar messageparam = "label=" *uchar
Requirements
Payment identifiers, not person identifiers
In my opinion, the most basic idea of the URI scheme (as this is a currency) is to facilitate payment. So the URIs should represent first and foremost payments. If it represents something else, this needs to be specified. Thus
bitcoin:1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L
represents a payment to me using my bitcoin address, not my bitcoin address itself. So after parsing the URI (via link/qr/whatever) the application should open a transaction window with the address filled in. You then need to add an amount and confirm the payment.
If your application is smart, it will also have a button "just store the address". But the point I am trying to make is that the default use of the URI should be for payment, nor for exchanging addresses.
Accessibility
Imported from the forum: I like the simplicity of bitcoin:xxxxxxxxxxxxx and very much approve of its accessibility. Should someone from the outside happen to see such a URI, the protocol name already gives a description. A quick google search should then do the rest. x-btc sounds much more cryptic; the chance that someone googles that out of curiosity are much slimmer. Also, very likely, what s/he will find are mostly technical specifications. Not a good introduction to bitcoin.
For the same reason I am for using '&' as a delimiter for key-value pairs. People know it from URLs. Make it easy for people to understand what is going on.
Keep it simple
Don't explicitly write down information that can be inferred. Don't mark the address as an address. If there is no address, this does lose much of its utility. We could, however, specify 'address' as a reserved word, so that
bitcoin:address?amount=5000000000
would initiate a transaction with the amount filled in, but with a blank address. I am not convinced that there is a use case, though.
Use-cases
Before the URI scheme is finalised one should think long and hard about use cases. in what circumstances will which people use this, and for what?
- an online shop has a 'buy this' link, which uses the URI scheme.
- PROBLEM: click on the link opens the application; how does the merchant notice this?
- POSSIBLE SOLUTION: javascript can detect the click.
- POSSIBLE SOLUTION: the checkout site checks its bitcoin account for payment via HTTP request.
- PROBLEM: the time problem (~10 minutes) is very apparent here; nobody wants to wait 10 minutes for the transaction to be confirmed.
- PROBLEM: click on the link opens the application; how does the merchant notice this?
- a person only has an online client, no actual application
- PROBLEM: how to redirect the URI so that the online client gets a notice?
- POSSIBLE SOLUTION: Small application and/or browser plugins to redirect the handler call to the designated online wallet.
- PROBLEM: how to redirect the URI so that the online client gets a notice?
Backwards compatibility
We want URIs generated in 2011 to still work in 2036. Think about extensibility. Of course we can make only educated guesses (and nothing more!) about the future, but don't act as if there is none. This should be the best we can do, but it should not be seen as set in stone. Make it possible for later generations to improve our work, to mend our errors, without breaking the URIs created now. Version incompatibility is the easiest thing to drive users crazy: "I just upgraded to this shiny new version. What? It doesn't support the old format? AAAAAAARRRGH!"
References
- ↑ RFC 1866 section 8.2.1 : by Tim Berners-Lee in 1995 encourages CGI authors to support ';' in addition to '&'.
- ↑ HTML 4.01 Specification: Implementation, and Design Notes: "CGI implementors support the use of ";" in place of "&" to save authors the trouble of escaping "&" characters in this manner."
- ↑ Hypertext Markup Language - 2.0 "CGI implementors are encouraged to support the use of ';' in place of '&' "