SN-1297 已核对来源,附原文与上下文。
我们需要有人写示例代码,最好是 Python 或 Java,展示用 JSON-RPC 接口创建账户系统的推荐方式。大多数卖东西的网站都需要类似的东西。一直跟进这里 JSON-RPC 主题的人应该对它该怎么工作有概念。
We need someone to write sample code, preferably Python or Java, showing the recommended way to use the JSON-RPC interface to create an account system. Most sites that sell things will need something like this. Someone who's kept up on the JSON-RPC threads here should have some idea how it should work.
用户登录自己的账户后,你展示他能汇入资金的比特币地址。展示之前,先检查这个地址是否已被用过,用过就换新的(getnewaddress
When a user is logged in to their account, you show the bitcoin address they can send to to add funds. Before showing it, you check if it's been used, if it has then you replace it with a new one (getnewaddress
用 getreceivedbylabel
You use getreceivedbylabel
如果你要求多于 0 个确认,最好同时展示当前余额(0 确认)和可用余额(1 个或以上确认),这样用户能立刻看到付款已被接收。不是所有网站都要等确认,所以「当前 + 可用」双余额应该是可选的。卖数字商品的网站大多 0 确认就够。
If you're requiring more than 0 confirmations, it's nice if you show the current balance (0 confirmations) and the available balance (1 or more confirmations), so they can immediately see that their payment is acknowledged. Not all sites need to wait for confirmations, so the dual current & available should be optional. Most sites selling digital goods are fine to accept 0 confirmations.
一个合适的示例应用是个简单的银行网站:具备以上功能,外加向比特币地址付款的选项。示例代码应该尽可能简单,只带让它成为可用网站的最少东西。
A nice sample app for this would be a simple bank site, which would have the above, plus the option to send a payment to a bitcoin address. The sample code should be the simplest possible with the minimum extra stuff to make it a working site.
vekja.net 就是这类网站的一个例子。
vekja.net is an example of a site like this.