原始文献 / 论坛帖 / Re: removing bitcoin addresses
Re: removing bitcoin addresses
Bitcointalk · 2010-05-16 23:34:40 UTC
SheriffWoody:
你生成的 Bitcoin 地址会永远保留。比特币地址必须保留,才能证明发到它名下的东西的所有权。如果你能删掉一个比特币地址,而有人往它发了钱,钱就丢了。它们也就 500 字节左右。
sirius-m:
几千个自己的地址完全不是问题。如果你已经生成了 50000 BTC,那你已经有 1000 个自己的地址了,每 50 个生成币对应一个。它们是隐藏的,UI 里看不到。
加一小段代码、让同一个 IP 一直拿到同一个地址会是个好主意。我在 C++ 里就是这么做的,让同一个 key(也就是比特币地址)一直发给同一个 IP,直到他们用了它:
// 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);
如果不方便知道什么时候收到了,就每 20 分钟清空一次缓存的 key。
我想给 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.
