Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: wsxdrfv on April 20, 2018, 07:07:26 AM



Title: Are there bitcoin command that add or revise account of specific address?
Post by: wsxdrfv on April 20, 2018, 07:07:26 AM
So after make new address with bitcoin-cli getnewaddress,

can I add some account (text value like "testuser1") to that specific address.

and later change it?


Title: Re: Are there bitcoin command that add or revise account of specific address?
Post by: starmyc on April 20, 2018, 08:32:49 AM
Even if this feature will soon be deprecated, It is still possible using the setaccount method:

Code:
$ bitcoin-cli help setaccount
setaccount "address" "account"

DEPRECATED. Sets the account associated with the given address.

Arguments:
1. "address"         (string, required) The bitcoin address to be associated with an account.
2. "account"         (string, required) The account to assign the address to.

Examples:
> bitcoin-cli setaccount "1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX" "tabby"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "setaccount", "params": ["1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX", "tabby"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

Example:

Code:
$ bitcoin-cli getnewaddress "acc1"
35ro3v9uR3xQoBEx8bbQgjB1V3qMSPoSBP

$ bitcoin-cli getaccount "35ro3v9uR3xQoBEx8bbQgjB1V3qMSPoSBP"
acc1

$ bitcoin-cli setaccount "35ro3v9uR3xQoBEx8bbQgjB1V3qMSPoSBP" "acc2"

$ bitcoin-cli getaccount "35ro3v9uR3xQoBEx8bbQgjB1V3qMSPoSBP"
acc2

If you need this kind of feature, I would recommend using your own software handling all this with your custom features.


Title: Re: Are there bitcoin command that add or revise account of specific address?
Post by: wsxdrfv on April 22, 2018, 03:55:58 AM

Code:
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "setaccount", "params": ["1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX", "tabby"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
If you need this kind of feature, I would recommend using your own software handling all this with your custom features.
Thanks.
What is this curl? How to use and when to use?

And why I need my own software? I feel this is enough for even exchange, isn't it?



Title: Re: Are there bitcoin command that add or revise account of specific address?
Post by: starmyc on April 22, 2018, 04:58:07 AM
What is this curl? How to use and when to use?

It is part of the help message.


Title: Re: Are there bitcoin command that add or revise account of specific address?
Post by: Sir mikolo on April 23, 2018, 01:59:36 PM
tthis is only working when the address was linked to an account? edit: or do i have to complete syncing the chain? atm listaddressgroupings returns an emty array even though I called getnewaddress several times


Title: Re: Are there bitcoin command that add or revise account of specific address?
Post by: starmyc on April 23, 2018, 04:20:25 PM
tthis is only working when the address was linked to an account? edit: or do i have to complete syncing the chain? atm listaddressgroupings returns an emty array even though I called getnewaddress several times

Quote
$ bitcoin-cli help listaddressgroupings
listaddressgroupings

Lists groups of addresses which have had their common ownership
made public by common use as inputs or as the resulting change
in past transactions

The addresses must be part of inputs of transactions or of change in existing transactions. Creating addresses are not sufficient. You can read more about it on this stackexchange thread (https://bitcoin.stackexchange.com/questions/25473/what-does-the-listaddressgroupings-rpc-method-do):

Quote
As you probably know, when you make a purchase, the bitcoind or bitcoin-qt client (which both use bitcoin-core) return your change by default to a new address. Well, if decide to use that address for another transaction, you have created a chain of "connectable" transactions. If you're not careful, there are various other ways that you can create connected transactions (like always using the same receiving address). However, if you already generate a new address to receive Bitcoins, this isn't a problem.

There are already numerous programs available that have the ability to scan the blockchain and list such connected transaction chains, which are definite proof that the addresses in question are or have been in the same wallet.

listaddressgroupings is a method that allow users to have the same ability to discern which groups of their addresses are connected on the public blockchain. It allows users to use the (relatively) new coin control functionality with greater awareness of potential privacy-revealing issues.