Difference between revisions of "BIP 0021"
|Line 1:||Line 1:|
Title: URI Scheme
Title: URI Scheme
Type: Standards Track
Type: Standards Track
Revision as of 23:48, 29 January 2012
BIP: 21 Title: URI Scheme Author: Matt Corallo Status: Draft Type: Standards Track Created: 29-01-2011
This BIP is a modification of an earlier BIP 0020 by Luke Dashjr and Nils Schneider. The alternative payment amounts has been removed.
- 1 Abstract
- 2 Motivation
- 3 Specification
- 4 Rationale
- 5 Forward compatibility
- 6 Appendix
- 7 Reference Implementations
This BIP proposes a URI scheme for making Bitcoin payments.
The purpose of this URI scheme is to enable users to easily make payments by simply clicking links on webpages or scanning QR Codes.
General rules for handling (important!)
Bitcoin clients MUST NOT act on URIs without getting the user's authorization. They SHOULD require the user to manually approve each payment individually, though in some cases they MAY allow the user to automatically make this decision.
Operating system integration
Graphical bitcoin clients SHOULD register themselves as the handler for the "bitcoin:" URI scheme by default, if no other handler is already registered. If there is already a registered handler, they MAY prompt the user to change it once when they first run the client.
(See also a simpler representation of syntax)
bitcoinurn = "bitcoin:" bitcoinaddress [ ";version=" bitcoinversion ] [ "?" bitcoinparams ] bitcoinaddress = base58 *base58 bitcoinversion = "1.0" bitcoinparams = *bitcoinparam bitcoinparam = amountparam | labelparam | messageparam | sendparam | otherparam amountparam = "amount=" *digit [ "." *digit ] labelparam = "label=" *pchar messageparam = "message=" *pchar sendparam = "send=" *pchar otherparam = pchar *pchar "=" *pchar
- label: Label for that address (e.g. name of receiver)
- address: bitcoin address
- message: message that shown to the user after scanning the QR code
- size: amount of base bitcoin units (see below)
- send: used to send bitcoin, rather than to request them
- (others): optional, for future extensions
If an amount is provided, it must be specified in decimal BTC. I.e. amount=50.00 is treated as 50 BTC.
Bitcoin clients MAY display the amount in any format that is not intended to deceive the user. They SHOULD choose a format that is foremost least confusing, and only after that most reasonable given the amount requested. For example, so long as the majority of users work in BTC units, values should always be displayed in BTC by default, even if mBTC or TBC would otherwise be a more logical interpretation of the amount.
Payment identifiers, not person identifiers
Current best practices are that a unique address should be used for every transaction. Therefore, a URI scheme should not represent an exchange of personal information, but a one-time payment.
Accessibility (URI scheme name)
Should someone from the outside happen to see such a URI, the URI scheme name already gives a description. A quick search should then do the rest to help them find the resources needed to make their payment. Other proposed names sound much more cryptic; the chance that someone googles that out of curiosity are much slimmer. Also, very likely, what he will find are mostly technical specifications - not the best introduction to bitcoin.
We want URIs generated in 2011 to still work in 2036: think about extensibility. Of course we can make only educated guesses 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.
This section is non-normative and does not cover all possible syntax. Please see the BNF grammar above for the normative syntax.
[foo] means optional, <bar> are placeholders
Just the address:
Address with name:
Request 20.30 BTC to "Luke-Jr":
Request 50 BTC with message:
Send 1 BTC:
Characters must be URI encoded properly.
Sending money via private key
To send a payment to someone else first construct a new keypair. You may want to use a mini private key format, or you may also use a full private key for more security depending on the amount being sent and how long you expect to pass before a claim. Now create and publish a transaction with an output of the amount you wish to send. Use this script in that output:
Construct an address from the public key. Encode the URI as below:
bitcoin:<address>?send=<base 58 encoded private key>
You may optionally include amount or message fields as well. In a wallet to claim money sent this way search for an incoming transaction with the output script form above, where <address> matches the public key in the script. When you find the transaction create a claim transaction with an input script of this form:
This claims the money you were sent. Until your claim transaction has confirmed the sender may take their money back.
- Bitcoin-Qt supports all valid Bitcoin URIs, with Windows and KDE integration as of commit 70f55355e29c8e45b607e782c5d76609d23cc858.