Author

Topic: bitcoind - adding addresses without private key? (Read 1710 times)

legendary
Activity: 1199
Merit: 1012
Thank you, Stephen!
legendary
Activity: 2506
Merit: 1010
So it doesn't seem like adding address without a private key is useful. Or am I doing it wrong?

You aren't adding an address to the wallet though. 

Quote
setaccount changes the account associated with an existing address.
- http://en.bitcoin.it/wiki/Accounts_explained#Accounts_and_Receiving_Addresses

So the problem is that the address doesn't exist in the wallet already, right?  The only way to add it is to import the private key (and rescan), and then it is no longer a watching only wallet.

You can roll your own monitoring for a list of bitcoin addresses from activity on the blockchain using Raw Transactions (new in the Bitcoin.org client v0.7).  Armory has the concept of a watching only wallet:

 - http://bitcoinarmory.com/index.php/using-offline-wallets-in-armory
legendary
Activity: 1199
Merit: 1012
Quote
So by allowing addresses with no private key lets the bitcoind do everything except spend.

I tried to do something useful with bitcoind without private key, but failed:

Code:
$ ./bitcoind setaccount 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa satoshi
$ ./bitcoind getaddressesbyaccount satoshi
[
    "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
]
$ ./bitcoind listtransactions satoshi
[
]
$ ./bitcoind listsinceblock |grep satoshi
$
$ ./bitcoind getblockhash 0
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
$ ./bitcoind getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
{
    "hash" : "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
    "confirmations" : 203112,
    "size" : 285,
    "height" : 0,
    "version" : 1,
    "merkleroot" : "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
    "tx" : [
        "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"
    ],
    "time" : 1231006505,
    "nonce" : 2083236893,
    "bits" : "1d00ffff",
    "difficulty" : 1.00000000,
    "nextblockhash" : "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"
}
$ ./bitcoind gettransaction 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
error: {"code":-5,"message":"Invalid or non-wallet transaction id"}
$ ./bitcoind getreceivedbyaccount satoshi
0.00000000

So it doesn't seem like adding address without a private key is useful. Or am I doing it wrong?
legendary
Activity: 2506
Merit: 1010
Why doesn't the client throw out addresses that you try to add to the wallet without having the private key for them?

An ecommerce site might want to run a bitcoind instance to provide access to the API for receiving transactions but no spending is possible.  This dramatically decreases the risk should a security breach occur, as there is much less an attacker can do.

So by allowing addresses with no private key lets the bitcoind do everything except spend.
newbie
Activity: 3
Merit: 0
OK, so the blockchain isn't up to date yet:

x@x:~/.bitcoin$ bitcoind getblockcount
142994

And I can't add an obviously bad address to an account

x@x:~/.bitcoin$ bitcoind setaccount 1badbadbad invalid
error: {"code":-5,"message":"Invalid bitcoin address"}

And I can add a new one:

x@x:~/.bitcoin$ bitcoind getnewaddress
16sVKyzots4SfrEUAoaeHEtJRVjbuhMdFK
x@x:~/.bitcoin$ bitcoind setaccount 16sVKyzots4SfrEUAoaeHEtJRVjbuhMdFK test

But I can also add an address that I don't own to the accounts list (Satoshi's original genesis block, which I obviously don't have the key for):

x@x:~/.bitcoin$ bitcoind setaccount 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa test
x@x:~/.bitcoin$:bitcoind listreceivedbyaddress 0 true
[
    {
        "address" : "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
        "account" : "test",
        "amount" : 0.00000000,
        "confirmations" : 0
    }
]

Why doesn't the client throw out addresses that you try to add to the wallet without having the private key for them?
Jump to: