Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: etotheipi on May 02, 2012, 01:47:20 AM



Title: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 02, 2012, 01:47:20 AM
So I just went to a lot of effort to get Armory (http://bitcoinarmory.com/) to handle "bitcoin:" URLs, and getting it to register itself as the default handler for "bitcoin:" links in both Windows and Linux (or requesting permission from the user to change it if another app is set).  It was a lot of work but totally worth the effort in my opinion.  Because these clickable URL's an awesome improvement to Bitcoin on the internet!

But twice now I've purchased something online, and been met with payment sites that could trivially support them but don't!   CoinDL and Bit-pay.  This is not meant to be a complaint as much as a request:  this is super-easy to support and is awesomely useful!  

Consider CoinDL (https://www.coindl.com/), which is a service for downloading music for Bitcoins.  The user clicks on the track they want and a payment box pops up.  If they put a bitcoin URL on there, the user simply clicks on it and Bitcoin-Qt/Multibit/Armory pops up with data pre-filled in.   "Address", "Amount" both filled in, and "<Artist> - <Album>: <Track>" already included in the transaction label/comments.  Now all they do is confirm and click send!  (and probably type in an encryption passphrase).  No copy&paste necessary, at all.  Period.

Not only is it a super-smooth experience for the user, but the user ends up with a well-documented transaction history of their music purchases along with dates and prices.  The merchant is better equipped to give a meaningful tx-comment anyway:  they can trivially put the Order# and purchase information into the message field of the URL so the user ends up with all of it documented for zero effort.  Worst case the user doesn't like it and change it before they hit send...

Here is the Bitcoin URI Spec (https://en.bitcoin.it/wiki/BIP_0021) and below is a simple example of how you would include it (using my donation address, of course!)

Code:
<a href="bitcoin:1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv?amount=1.0&label=Armory%20Donation%20Address&message=Donation%20to%20Armory">Donate 1.0 BTC to the Armory Project!</a>

...which looks like:  Donate 1.0 BTC to the Armory Project! (bitcoin:1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv?amount=1.0&label=Armory%20Donation%20Address&message=Donation%20to%20Armory)

Messages and labels in the URL can be universally encoded using the percent encoding scheme (http://en.wikipedia.org/wiki/Percent-encoding).  It consists of taking the message you want to put into the URL, and replacing all spaces with "%20", all exclamation points with %21, etc.  It's all on that link.

Just do it!


EDIT: I posted a walk-thru of the technical details for supporting URLs (https://bitcointalk.org/index.php?topic=79010.0), which addresses both merchants and registering your application with the OS.  I posted what I've learned over the past two weeks, and wouldn't mind some feedback if folks have experience with the OS-registration stuff (specifically, Unity or KDE-based Linux systems, and Mac/OSX in general)


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: Littleshop on May 02, 2012, 01:59:59 AM
This would be a great improvement to bitcoin.  It has been talked about before but it seems to be one of the last easy improvements that will have a great impact on usage and adoption. 


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: Maged on May 02, 2012, 02:08:09 AM
On the plus side, this very forum already supports bitcoin URIs!

See my sig for an example :P


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: BitPay Business Solutions on May 02, 2012, 02:11:05 AM
Our QR code on every Bit-Pay invoice is the bitcoin: URI, and I can confirm it works with 3 mobile wallets.  Blockchain (iPhone), Bitcoin Wallet (Android) and BitcoinSpinner (Android).  I have paid a Bit-Pay invoice by scanning the QR code and it worked flawlessly.

We did have a clickable link as well, but none of the clients supported it, so we took it off.  Now that Armory does, we will make sure this gets added back to the site with the next update.



Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 02, 2012, 02:15:36 AM
Our QR code on every Bit-Pay invoice is the bitcoin: URI, and I can confirm it works with 3 mobile wallets.  Blockchain (iPhone), Bitcoin Wallet (Android) and BitcoinSpinner (Android).  I have paid a Bit-Pay invoice by scanning the QR code and it worked flawlessly.

We did have a clickable link as well, but none of the clients supported it, so we took it off.  Now that Armory does, we will make sure this gets added back to the site with the next update.

Glad to see I have enough street-cred to encourage alone you to re-activate the feature :)  

But, I know that Multibit also has support for it, too (with the OS registration).  I thought that Bitcoin-Qt did too, but I haven't seen it work yet...

I didn't realize the QR code used it.  Good to know!  


P.S. -- URL support was added only to the very latest version of Armory: version 0.75 (http://bitcoinarmory.com/index.php/get-armory).  Previous versions won't work.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: payb.tc on May 02, 2012, 02:50:35 AM
one small issue i see is that having the full bitcoin address as clickable, will make it harder to copy+paste if that's what is needed.

better to have the address in plain text, and then a link next to it.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 02, 2012, 02:56:37 AM
one small issue i see is that having the full bitcoin address as clickable, will make it harder to copy+paste if that's what is needed.

better to have the address in plain text, and then a link next to it.


Agreed.  It's not necessary to have it as one/only object.  But there's plenty of space on these forms/windows/boxes to add a link for convenience for us users that do have supporting clients.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: weex on May 02, 2012, 03:20:51 AM
I'm totally into doing this for CoinDL. I've just done a little survey of mobile apps and it appears almost all have Bitcoin URI support. So expect the QR code to be updated and a link as well.

Thanks etotheipi for the initiative and for highlighting an opportunity to again move toward the goal of making Bitcoin easy!


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: ThomasV on May 02, 2012, 05:26:34 AM
We did have a clickable link as well, but none of the clients supported it, so we took it off.  Now that Armory does, we will make sure this gets added back to the site with the next update.

none of the clients, really? Electrum and Multibit have been supporting bitcoin: URIs for months...


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: istar on May 02, 2012, 08:43:53 AM
I'm totally into doing this for CoinDL. I've just done a little survey of mobile apps and it appears almost all have Bitcoin URI support. So expect the QR code to be updated and a link as well.

Thanks etotheipi for the initiative and for highlighting an opportunity to again move toward the goal of making Bitcoin easy!

Great one problem with using your site from a mobile is that the QR code, does not center on the screen and becomes very tiny.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: Jan on May 02, 2012, 11:08:07 AM
...
Here is the Bitcoin URI Spec (https://en.bitcoin.it/wiki/BIP_0021) and below is a simple example of how you would include it (using my donation address, of course!)

Code:
<a href="bitcoin:1ArmoryXcfq7TnCSuZa9fQjRYwJ4bkRKfv?amount=1.0&label=Armory%20Donation%20Address&message=Donation%20to%20Armory">Donate!</a>

Just do it!
...
+1
This is an important part of making payment easy.
On a side note, the Blockchain app for iPhone uses this format "bitcoin://....". I am considering to let BitcoinSpinner accept it, but I'd prefer if we can just use the standatd. Piuk, please fix this.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: Kris on May 02, 2012, 01:31:24 PM
I have tried to implement this the best way I could think of into Laybit (http://laybit.com) as a form of fallback if the user doesn't have JavaScript enabled.

http://bitcoinmedia.com/laybit-donation-buttons/ (http://bitcoinmedia.com/laybit-donation-buttons/)

It is in fact a most awesome way for payment "links"


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: weex on May 02, 2012, 03:47:24 PM
I've updated CoinDL QR codes and added a Buy Now button that points to the URI. Looking forward to seeing many more sites accepting these links!


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 02, 2012, 04:32:06 PM
Does Bitcoin-Qt support the URLs?  I thought they did, but I haven't seen any evidence of it.  I think we should encourage the devs to step up support for it because Bitcoin-Qt is still used by most users and it's really not hard.

I recently figured out how to do it reliably and responsibly through non-admin-modifications of user-registry settings.  Much the same way that Firefox/IE/Chrome check and modify on load for "http://" links.    It seems that all they would have to do is check the registry settings for it on load and request to change it if some other app is currently set.  

Well, that's all I did in Armory, but of course everything is always easy in python :)  ("import _winreg")  


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 02, 2012, 05:30:59 PM
I've updated CoinDL QR codes and added a Buy Now button that points to the URI. Looking forward to seeing many more sites accepting these links!

Hey Weex,

That's great.  Just one recommendation.  I believe that we should use the "Label" field to mark the address, and "Message" to mark the transaction.  At least that's how I do it in Armory:  The "label=" is what shows up when you're looking through your address book, but the "message=" is what shows up when looking at your transaction history.  For the case that every tx uses a different address, I don't think it matters too much.  But it's a distinction that might be worth mentioning (notice my original example where I use both), or at least someone can correct me if they think I have it wrong.

Also, you can put spaces and other special chars in the URL using percent encoding (http://en.wikipedia.org/wiki/Percent-encoding).  Use %20 for spaces, %28 and %29 for left and right parentheses, etc.  I'll add that link to the original post.  And add a link in the Technical forums for the Registry settings I mentioned above.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: weex on May 03, 2012, 01:07:07 AM
etotheipi,

From https://en.bitcoin.it/wiki/URI_Scheme
Quote
Query Keys

    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

I take this to mean the label: should be "CoinDL" and the message: should be something like "Purchase of Alco (https://www.coindl.com/page/item/127)". Does this interpretation seem correct? Is there another more definitive standard document on this?

-weex



Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 03, 2012, 02:26:52 AM
etotheipi,

From https://en.bitcoin.it/wiki/URI_Scheme
Quote
Query Keys

    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

I take this to mean the label: should be "CoinDL" and the message: should be something like "Purchase of Alco (https://www.coindl.com/page/item/127)". Does this interpretation seem correct? Is there another more definitive standard document on this?

-weex


That's actually the wrong document (that's BIP 20), which was ultimately replaced by BIP 21 (https://en.bitcoin.it/wiki/BIP_0021).  But BIP 21 doesn't say much else beyond that.  

The issue is that Bitcoin-Qt only uses labels.  The above suggests that "Message" is only for showing when the user clicks/reads the URL, but that Bitcoin-Qt may not save that information anywhere in the wallet.  It might be better just to put all of it into the label.  This is frustrating, because it makes more sense (to me) to use it as I described it and implemented it in Armory, but it may not achieve the desired result with Bitcoin-Qt.  

How does Multibit and Electrum deal with "label=" and "message=" fields?


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: mc_lovin on May 03, 2012, 03:54:03 AM
That is awesome, bitcoin totally deserves it's own link type.  With tools like these, future newbies to the currency will be able to use bitcoin just as easy as learning email! :)


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: weex on May 03, 2012, 03:59:16 AM
On the issue of label vs label+message I think I'll stick with the label for now. It's a pretty minor aspect as far as ux goes but adjustments can be made later if users can benefit from some additional messaging.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 03, 2012, 04:06:02 AM
On the issue of label vs label+message I think I'll stick with the label for now. It's a pretty minor aspect as far as ux goes but adjustments can be made later if users can benefit from some additional messaging.

I'll pester the devs on the mailing list about it.  I think it definitely makes sense to have both, but I'm guessing they didn't do it that way. 

The label-only thing sounds good -- I would prefix the labels with "CoinDL%3A%20" ("CoinDL: ") and then put the purchase after it.  It'll show up fine in Armory like that, just a slightly sub-optimal :)

I guess I should also pester them about URL-registration, in general. 


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: SgtSpike on May 03, 2012, 05:26:41 AM
Awesome - I'm all for it!

I think websites will initially need to clarify what the link is for, and how it needs to be utilized.  On a computer without Armory installed, clicking on a bitcoin URL just opens a blank tab.  This would confuse anyone who didn't realize what it was or was supposed to do.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: jim618 on May 03, 2012, 05:58:35 AM
@etotheipi

Re: label v message

At the moment MultiBit parses both the label and message but only puts the label on the display and in the address book. I could not quite see the distinction between the two so did not want to put two fields in the Send/ Request forms one label and the other message as it would be confusing.

I have not seen the message field being used yet.


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 03, 2012, 01:18:02 PM
@etotheipi

Re: label v message

At the moment MultiBit parses both the label and message but only puts the label on the display and in the address book. I could not quite see the distinction between the two so did not want to put two fields in the Send/ Request forms one label and the other message as it would be confusing.

I have not seen the message field being used yet.

So I have been putting the "label" next to the address i.e. "1ArmoryXcfqj3f9dsjfkslWjZej  (Armory Donation Address)" and the message in the transaction comment field i.e. "Donation to receive Encryption Seminar".  But it sounds like I'm going to have to forego that in Armory...  instead put the label into the tx-comment field, and append the message to it if there is one.

Gah.  I don't like it.  But life could be worse :)


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: BitPay Business Solutions on May 03, 2012, 01:45:00 PM
none of the clients, really? Electrum and Multibit have been supporting bitcoin: URIs for months...

Thanks for letting me know, the URI will be added to our invoice page with our next site update.

We took it off because it would open a new browser tab with an error for 95% of the users, and it caused more confusion than anything.  But it is a great tool to have once the clients support it!



Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: etotheipi on May 03, 2012, 02:15:32 PM
@ Weex

Armory is choking on the URLs on CoinDL, because of the colon in the the label field:

bitcoin:16xPh78TNANC6YB1XZksWyCGqhcMFnDXZ9?amount=1.959&label=CoinDL:Alco

I don't know if Armory should be able to handle it, but ':' is on the "reserved characters" list,  So you should replace it with %3A.  

The only important feature of the percent-encoding scheme is that the following characters are reserved "%!*'();:@&=+$,/?#[] ", and should simply be replaced with their ASCII code in hex.  


Title: Re: Request: Let's support "bitcoin:" URLs!
Post by: weex on May 03, 2012, 03:55:04 PM
@ Weex

Armory is choking on the URLs on CoinDL, because of the colon in the the label field:

bitcoin:16xPh78TNANC6YB1XZksWyCGqhcMFnDXZ9?amount=1.959&label=CoinDL:Alco

I don't know if Armory should be able to handle it, but ':' is on the "reserved characters" list,  So you should replace it with %3A.  

The only important feature of the percent-encoding scheme is that the following characters are reserved "%!*'();:@&=+$,/?#[] ", and should simply be replaced with their ASCII code in hex.  


@etotheipi,

The colon is now %3A and the rest of the item name is escaped. I also made the link open in a new tab. In testing while logged into Blockchain.info, it actually didn't do what I wanted but I suppose that's due to some quirk in how their handler works on gnu/linux or in expecting something specific in the URL. You may need to do a Ctrl-F5 to refresh the javascript if you want to test it now.

-weex