原始文献 / 论坛帖 / Re: URI-scheme for bitcoin
Re: URI-scheme for bitcoin
Bitcointalk · 2010-05-16 22:37:21 UTC
引用 Karmicads(May 01, 2010, 06:06:53 AM)(https://bitcointalk.org/index.php?topic=55.msg1038#msg1038):
freenet 的 URI 长这样:
http://127.0.0.1:8888/USK@oshw3DxmJUt7q4ThF4dCez5IXbc9hCGcv0VuwLRCmeQ,ckeXv20F1gBzkqssB4RXHZ2nB1YRT8Pb8KYZk8wj-bs,AQACAAE/occamsrazor/6/f.pdf
就是,我们完全可以照着做,比如:
http://127.0.0.1:8330/?to=<bitcoinaddress>;amount=<amount>
Bitcoin 可以在本地 loopback 上监听 8330 端口,就像 JSON-RPC 监听 8332 一样。然后给出一个 HTTP 应答。
引用 DataWraith(May 02, 2010, 11:13:09 AM)(https://bitcointalk.org/index.php?topic=55.msg1045#msg1045):
我觉得 bitcoin 链接应该更像 mailto: 而不是 magnet:。
我觉得可以做到。
虽然让 Bitcoin 在 HTTP 应答里直接把活干了、给用户呈现 HTML 界面在技术上可行,但作为用户,我会犯嘀咕:到底是某个网站在骗我,还是我真的在跟自己的 Bitcoin 服务器说话。
HTTP 应答可以只是一段 HTML,带一段相当于后退按钮的 JavaScript,把页面送回去。然后 Bitcoin 弹出 Send Bitcoins 对话框,收款比特币地址和金额都已经填好。效果就跟 mailto: 链接弹出新邮件、收件人已填好一样。
127.0.0.1 loopback 本机上的任意用户都能访问,没有按用户隔离,但没关系,因为它只承担预填对话框字段的便利功能。你还是得亲手按 Send。得确保 Send 按钮不是默认选中的,免得你在敲空格或回车时它突然跳到前台。
英文原文
Quote from: Karmicads on May 01, 2010, 06:06:53 AM(https://bitcointalk.org/index.php?topic=55.msg1038#msg1038):
> A freenet URI is like this:
>
> http://127.0.0.1:8888/USK@oshw3DxmJUt7q4ThF4dCez5IXbc9hCGcv0VuwLRCmeQ,ckeXv20F1gBzkqssB4RXHZ2nB1YRT8Pb8KYZk8wj-bs,AQACAAE/occamsrazor/6/f.pdf
>
There you go, we could easily do it the same way, like:
http://127.0.0.1:8330/?to=<bitcoinaddress>;amount=<amount>
Bitcoin can answer port 8330 on local loopback just as it does for JSON-RPC on 8332. It would give an HTTP answer.
Quote from: DataWraith on May 02, 2010, 11:13:09 AM(https://bitcointalk.org/index.php?topic=55.msg1045#msg1045):
> A bitcoin-link should be more like mailto: than magnet: IMHO.
>
I think we can do that.
Although it would be possible for Bitcoin to take care of business in the HTTP response by presenting HTML UI to the user, as a user I would wonder if some website is trying to trick me or if I'm really talking to my own Bitcoin server.
The HTTP response could simply be HTML with the JavaScript equivalent of the back button, sending it back to the page. Bitcoin then pops up the Send Bitcoins dialog with the destination bitcoin address and amount already filled in. It would work just like a mailto: link that pops up a new email with the address filled in.
127.0.0.1 loopback is accessible by any user on the machine, it doesn't have per-user separation, but it's OK because it would only serve the convenience function of pre-filling the fields in a dialog. You'd still have to press Send. We'd have to make sure the Send button is not selected so it couldn't jump into the foreground while you're typing a space or enter.
