回复:移除比特币地址
原始发布页
打开来源页面查看 1 个交叉存档
SheriffWoody: 你生成的比特币地址会被永久保留。比特币地址必须保留,以证明对发送到该地址的任何东西的所有权。如果你能删除一个比特币地址,而后有人向它发送了资金,这些钱就会丢失。每个地址只占大约 500 字节。
sirius-m: 拥有数千个自己的地址完全不应该成为问题。如果你已经生成了 50000 BTC,那么你已经有 1000 个自己的地址,每生成 50 BTC 对应一个。这些地址是隐藏的,不会显示在用户界面中。
最好加一小段代码,对同一个 IP 始终给出同一个地址。下面是我用 C++ 实现的做法:在对方使用密钥(也就是比特币地址)之前,始终给出同一个密钥:
// Keep giving the same key to the same ip until they use it if (!mapReuseKey.count(pfrom->addr.ip)) mapReuseKey[pfrom->addr.ip] = GenerateNewKey();
……发送密钥 mapReuseKey[pfrom->addr.ip]
……稍后……
// Received something with this key mapReuseKey.erase(pfrom->addr.ip);
如果不方便知道何时收到了内容,只需每 20 分钟清除一次缓存的密钥。
我想给 getnewaddress 添加一个参数,用来指定如果地址没有收到任何东西,多少天后过期。
英文原文
展开英文原文
SheriffWoody: Bitcoin addresses you generate are kept forever. A bitcoin address must be kept to show ownership of anything sent to it. If you were able to delete a bitcoin address and someone sent to it, the money would be lost. They're only about 500 bytes.
sirius-m: Thousands of own addresses should not be any problem at all. If you've generated 50000 BTC, then you already have 1000 own addresses, one for each 50 generated. Those are hidden, they're not shown in the UI.
It would be a good idea to add a little code that keeps giving the same address to the same IP. Here's what I did in C++ to keep giving the same key (aka bitcoin address) until they use it:
// Keep giving the same key to the same ip until they use it if (!mapReuseKey.count(pfrom->addr.ip)) mapReuseKey[pfrom->addr.ip] = GenerateNewKey();
...sends the key mapReuseKey[pfrom->addr.ip]
...later...
// Received something with this key mapReuseKey.erase(pfrom->addr.ip);
If it's not convenient to know when you've received, just clear the cached keys every 20 minutes.
I want to add a parameter to getnewaddress for number of days to expire if nothing is received with the address.