Bitcoin-cli -regtest getaccount, listaccounts, setaccount, method not found

1

I just setup bitcoind (0.18.1) and put it in regtest mode, I am trying to work with accounts, but the account commands are not found...

setaccount

 jlroberts@mixerregtest:~$ bitcoin-cli -regtest setaccount 2NDCk4d7BYGztagf812gUdWqqPSMymdH4rS one
 error code: -32601
 error message:
 Method not found

getaccount

jlroberts@mixerregtest:~$ bitcoin-cli -regtest getaccount one
error code: -32601
error message:
Method not found

listaccounts

jlroberts@mixerregtest:~$ bitcoin-cli -regtest listaccounts
error code: -32601
error message:
Method not found

getblockchaininfo

{
  "chain": "regtest",
  "blocks": 303,
  "headers": 303,
  "bestblockhash": "77d7169d013574a1254ccf472389b40c3393f41498ddc6f84b8d078c740d3da3",
  "difficulty": 4.656542373906925e-10,
  "mediantime": 1568636861,
  "verificationprogress": 1,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000000000000000000000000260",
  "size_on_disk": 92175,
  "pruned": false,
  "softforks": [
    {
      "id": "bip34",
      "version": 2,
      "reject": {
        "status": false
      }
    },
    {
      "id": "bip66",
      "version": 3,
      "reject": {
        "status": false
      }
    },
    {
      "id": "bip65",
      "version": 4,
      "reject": {
        "status": false
      }
    }
  ],
  "bip9_softforks": {
    "csv": {
      "status": "locked_in",
      "startTime": 0,
      "timeout": 9223372036854775807,
      "since": 288
    },
    "segwit": {
      "status": "active",
      "startTime": -1,
      "timeout": 9223372036854775807,
      "since": 0
    }
  },
  "warnings": ""
}

What could I be doing wrong?

Jeffrey L. Roberts

Posted 2019-09-16T12:36:22.203

Reputation: 163

What is your bitcoin core version? also, can you try bitcoin-cli -regtest getblockchaininfo?vincenzopalazzo 2019-09-16T12:39:30.320

using the latest, 0.18.1Jeffrey L. Roberts 2019-09-16T12:42:21.577

Answers

1

I don't know the listaccounts, getaccount and setaccount commands inside the Bitcoin core 18.1.

I think you have used the wrong commands with the bitcoin 18.1, perhaps the equivalents are:

But before you use this command look the official documentation rpc framework

vincenzopalazzo

Posted 2019-09-16T12:36:22.203

Reputation: 572

ah I was using the documentation from https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Jeffrey L. Roberts 2019-09-16T12:55:48.297

1

accounts method was deprecated in v0.17 and was removed since v0.18. accounts was replaced by label and it provides more flexibility as compared to before such as setting label on any address, not just receiving address. It also irons out issues raised in the past. If you are used to using accounts to mimic separate wallets, you now have an option to use separate wallets in separate wallet files in Bitcoin Core.

So according to the commands you are looking, you will replace them by:

  1. getaccount with getaddressinfo
  2. listaccounts with listlabels
  3. setaccount with setlabel

You can see the full documentation of accounts vs labels in the v0.17 release docs.

Ugam Kamat

Posted 2019-09-16T12:36:22.203

Reputation: 5 180