Click or drag to resize

How to work with RPC - Wallet

This "How to" describes the flow of usage wallet in Bitcoin Rhodium node. It is based on following parts:

You can find more API RPC-JSON in full documentation.

GenerateNewWallet

Node can work with 10000+ wallets.

Call example with and without base64 encoded password:

Default call
Specification: GenerateNewWallet

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"generatenewwallet", "params":["walletname","**yourplainwalletpassword**"]}]'

Full Base64 alternative
Specification: GenerateNewWalletBase64

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"generatenewwalletbase64", "params":["walletname","bXlwYXNzd29yZDE1K0JBU0U2NA=="]}]'

Example of a result:

C#
{
  "result": {
    "isValidChecksum": true,
    "wordList": {
      "name": "english",
      "space": " ",
      "wordCount": 2048
    },
    "indices": [
      821,
      1498,
      345,
      867,
      31,
      946,
      886,
      301,
      1555,
      428,
      683,
      369
    ],
    "words": [
      "grit",
      "robust",
      "clinic",
      "hockey",
      "advance",
      "iron",
      "human",
      "certain",
      "second",
      "culture",
      "fever",
      "comfort"
    ]
  },
  "id": 1,
  "error": null
}
GetNewAddress

Get new address for your wallet.

Specification: GetNewAddress

Call example:

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"getnewaddress", "params":["walletname"] }]'

Example of a result:

C#
{
  "result": "TSThvRAiSwwp4gMLKqw5j9XubeRdG9Lm8W",
  "error": null,
  "id": 0
}
ValidateAddress

Validate your address.

Specification: ValidateAddress

Call example:

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"validateaddress", "params":["TQgjBozrWtNCjCkPZwEDkXgCu7iDo4uraa"]}]'

Example of a result:

C#
{
  "result": {
    "isvalid": true,
    "address": "TQgjBozrWtNCjCkPZwEDkXgCu7iDo4uraa",
    "scriptPubKey": "76a914a16c034cffcf8ef2b45c7e81d96f61e1b2a953de88ac",
    "ismine": false,
    "iswatchonly": false,
    "isscript": false
  },
  "error": null,
  "id": 0
}
GetWalletInfo

Get information about your wallet.

Specification: GetWalletInfo

Call example:

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"getwallet", "params":["walletname"] }]'

Example of a result:

C#
{
  "result": {
    "index": 0,
    "name": "account 0",
    "hdPath": "m/44'/1'/0'",
    "extPubKey": "xpub6C3K5nNMoRqXwF3fLVNfd3m2e75TUWuJMCRYynPf1tXUhwRDGN7CF7ytHtjqBtjroxdD2g4pcJsbsWt29Mxv9vYchWMWAgLTdhjC6Ze6q3q",
    "creationTime": "1545299325",
    "externalAddresses": [
      {
        "index": 0,
        "scriptPubKey": "76a914c1f0675fe7e5499b28c953f53561712eab48737588ac",
        "pubkey": "21032e553e64c574fbef43aaecc82b38e4474c44b4a8534eca4c1cdf581d094ac9bbac",
        "address": "TTefQdb3Bx2Raafo7KBUmgw3QDqh7NkPGN",
        "hdPath": "m/44'/1'/0'/0/0",
        "transactions": [
          {
            "id": "8297fabbef9891febdf79fae7e553e5d8c0a6ca0ecac7a15b917751438058078",
            "amount": 5000000000,
            "index": 0,
            "blockHeight": 130,
            "blockHash": "672ee14dd652aa4e7bc2d51dd6067735c1ef56e67058bb37e2f6a134737f4b6d",
            "creationTime": "1544460716",
            "merkleProof": "0300000003fec9414f0351573ec9645190db819163bfe6ff53591efcd24d032a915389ab4d78800538147517b9157aaceca06c0a8c5d3e557eae9ff7bdfe9198efbbfa97826df786f6459e119d747cbcbd2814b1aa0246c54e58ed595c64b03f2ab6635c0a010b",
            "scriptPubKey": "76a914c1f0675fe7e5499b28c953f53561712eab48737588ac",
            "isPropagated": true
          },
          {
            "id": "7749fa85e0d6795c91766a8307376bc93357bdfb1915f56486b029fc6ae84e59",
            "amount": 100000000000,
            "index": 1,
            "blockHeight": 148,
            "blockHash": "493f8bdb401c13d5bef3037d9a66c62f194a55ea8baf3e8f68eccdf2609e56c0",
            "creationTime": "1544461969",
            "merkleProof": "0300000003cd551dc871a8dc58885332481dfa0d7c2f09c109a8b62feb282e088f739e9b29594ee86afc29b08664f51519fbbd5733c96b3707836a76915c79d6e085fa4977dc7ea4660b67eed0f9626ba617d595e408142dc4cfaa2dfbc39b0ced4640e20f010b",
            "scriptPubKey": "76a914c1f0675fe7e5499b28c953f53561712eab48737588ac",
            "isPropagated": true
          },
          {
            "id": "a58aeb2617a71e97bd1b34dda2c74a587fd4bbb482657e04cf03bf05869883ca",
            "amount": 1199900000,
            "index": 0,
            "blockHeight": 153,
            "blockHash": "94352c9c38148b9cff9f8f55b79aa5048ac88c591d0490934d1fb2de86d45de8",
            "creationTime": "1544462800",
            "scriptPubKey": "76a914c1f0675fe7e5499b28c953f53561712eab48737588ac",
            "isPropagated": true,
            "spendingDetails": {
              "transactionId": "ef87058a16d2a0fd171b4263f87159daf21af1f510e6cfc23bdb8f6bb678b8e3",
              "payments": [
                {
                  "destinationScriptPubKey": "76a914860b6f1a04728f164de985472e821d05ab154ac088ac",
                  "destinationAddress": "TNByFDF21Yf9V3uUd2A5JTjdc5ZNrciBHG",
                  "amount": 1000000000
                }
              ],
              "blockHeight": 167,
              "creationTime": "1544547040"
            }
          }
        ]
      },
      {
        "index": 1,
        "scriptPubKey": "76a9148a904d3dbc15aaa8345d7f53331d2005ac0a080b88ac",
        "pubkey": "2102b04027b241a07b93d0b425cca8671a2f9f73bb078c261d43708b578706c5506cac",
        "address": "TNbs7nqWtT5kvzXgfEJZMx8hvPnb9Td8Pu",
        "hdPath": "m/44'/1'/0'/0/1",
        "transactions": []
      },
        ...
    ],
    "internalAddresses": [
      {

      //FOR INTERNAL USAGE
    }
    ]
  },
  "id": 1,
  "error": null
}
GetBlockCount

Get block count from block chain.

Specification: GetBlockCount

Call example:

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"getblockcount", "params": [] }]'

Example of a result:

C#
{
  "result": 1042,
  "error": null,
  "id": 0
}
SendToAddress

Send coins to selected address.

Specification: SendToAddress

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"sendtoaddress", "params":["walletname","**yourplainwalletpassword**", "TS8jH5oC8PCF8KBKYTLoKsPzY4YC3vT4wv", 1]}]'

Full Base64 alternative
Specification: SendToAddressBase64

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"sendtoaddress", "params":["walletname","bXlwYXNzd29yZDE1K0JBU0U2NA==", "TS8jH5oC8PCF8KBKYTLoKsPzY4YC3vT4wv", 1]}]'

Example of a result:

C#
{
    "result": "255dcd945570c3481eb9bef9350fc33a5b5adc7f8f4cf942f0c60b872893663f",
    "error": null,
    "id": 0
}
RestoreFromSeed

Restore your wallet from seed and password.

Last param is the time of creation and have to be greater than 1539810400. Call example with and without base64 encoded password:

Default call
Specification: Restore

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' H 'cache-control: no-cache' -d '[{"method":"restorefromseed", "params":["**yourplainwalletpassword**","walletname","firm water beef fury cranch sight drink problem lizard picnic strong clever", 1539810400]}]'

Full Base64 alternative
Specification: RestoreBase64

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' H 'cache-control: no-cache' -d '[{"method":"restorefromseedbase64", "params":["bXlwYXNzd29yZDE1K0JBU0U2NA==","walletname","firm water beef fury cranch sight drink problem lizard picnic strong clever", 1539810400]}]'

Example of a result:

C#
{
  "result": {
    "name": "testname",
    "encryptedSeed": "6PYNUTC1oYAwpEqcxrYxjbXCuZfnb1CzAu7K3QSbvdUUTrnABSHN7khy7Q",
    "chainCode": "84bc490bc6639b29b4484748c23e2c842d5f799c547bc1fe6a8e8c4f72e43962",
    "creationTime": "1539721963",
    "blockLocator": null,
    "network": "BRhodiumTest",
    "accountsRoot": [
      {
        "coinType": 1,
        "accounts": [
          {
            "index": 0,
            "name": "account 0",
            "hdPath": "m/44'/1'/0'",
            "extPubKey": "xpub6D38vhFvHtDHpdomuDX8qiWLrKYhCkAA7D7inw11GjzPmiG3kHjVnXTqobVghs5ZE7DrK4UGHhpnqsbx99MW5jTN2daKu6Ed1z3eiVND6xm",
            "creationTime": "1545299571",
            "externalAddresses": [
              {
                "index": 0,
                "scriptPubKey": "76a914bd9723774dccd6fe91150f5e52321964b500935688ac",
                "pubkey": "2102daf98493272ee0439591574a2628bda4b6e160c26811d486e8f8939360d56b28ac",
                "address": "TTFfmc2ds2usS8Et9CWkpDJwMuxFdCyAqr",
                "hdPath": "m/44'/1'/0'/0/0",
                "transactions": []
              },
              ...
            ],
            "internalAddresses": [
                //FOR INTERNAL USAGE
            ]
          }
        ]
      }
    ]
  },
  "error": null,
  "id": 0
}
RescanBlockchain

Function to load transaction from old blocks.

Specification: RescanBlockChain

Call example:

C#
curl -X POST http://127.0.0.1:16661/ -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method":"rescanblockchain", "params":["1","167"]}]'

Example of a result:

C#
{
  "result": {
    "start_height": 1,
    "stop_height": 167
  },
  "error": null,
  "id": 0
}
GetTransaction/GetTransactionByWallet

Return information about specified transaction in block chain base on your local wallet.

If you have more then one wallet you need to use gettransactionbywallet.

Specification: GetTransaction

Call example:

C#
curl -X POST http://127.0.0.1:16661 -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method" : "gettransaction","params" : ["a58aeb2617a71e97bd1b34dda2c74a587fd4bbb482657e04cf03bf05869883ca"]}]'

If you have more wallets you have to call gettransactionbywallet with definition of wallet.

C#
curl -X POST http://127.0.0.1:16661 -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method" : "gettransactionbywallet","params" : ["**yourwalletname**","a58aeb2617a71e97bd1b34dda2c74a587fd4bbb482657e04cf03bf05869883ca"]}]'

Example of a result:

C#
{
   "result":{
      "amount":2.4625000,
      "confirmations":1,
      "generated":false,
      "blockHash":"4fa1a7534f3075eb8e028e60506fe9a96b5045268b3edcb533021533092b63e3",
      "blockIndex":2,
      "blockTime":1546974131,
      "txId":"d5e0dee43245dc194f7bd315bda19689adde9edc54229767af7d347e60a0c45e",
      "normTxId":"d5e0dee43245dc194f7bd315bda19689adde9edc54229767af7d347e60a0c45e",
      "time":1546974617,
      "timeReceived":1546974617,
      "fee":-0.0001356,
      "details":[
         {
            "account":"account 0",
            "address":"TRbPDkwa8a73TS2FwGJv9ZhmTgnjtdPSkm",
            "category":"send",
            "amount":-2.5,
            "fee":-0.0001356
         },
         {
            "account":"account 0",
            "address":"TBJLKYSU4t8L46GJ8DEYKdSHvR3xek6NiB",
            "category":"receive",
            "amount":0.0373644
         }
      ],
      "hex":"01000000018f72b3fb4bb72e860a15ac30bcebc91bf094cea6d42c3483636fb38be5c86b7c000000006a4730440220617cdc627f10adf2ac990e4c38f11387fc1d951d2a518dc174e0ddc151139c9e0220669b20eaac7fc193df4fc430cf30f2073ff5fbe511f93036bc0dc802ed4aa6f301210202ca1d15f7ad59c7bd84ba9bcc82be89e0bc629201dea7cb4578db422ea594e6ffffffff0278033900000000001976a9140e96236d8d1a0ae3c7184709e5a0437201e7b03588ac107aad0e000000001976a914d9bf2945d33a4a16b54cb0b70bb4e225ecef58a988ac00000000"
   },
   "error":null,
   "id":0
}
ListTransactions

Return list of last send/received transactions in your local wallet.

Specification: ListTransactions

Call example:

C#
curl -X POST http://127.0.0.1:16661 -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method" : "listtransactions","params" : ["**walletname**"]}]'

Example of a result:

C#
{
   "result":[
      {
         "hex":"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2602ac0707062f503253482f04ed85385c00ed245688000000000c2f4d696e696e67436f72652f000000000180b2e60e000000001976a914ab616448c7c216ba684bb9af5154c5edc4ca9fbd88ac00000000",
         "txid":"6fc4fd0ab858de3a77e3a40ffa3dea3195f2190b3de51247984cb3e9e65ac249",
         "size":123,
         "version":1,
         "locktime":0,
         "vin":[
            {
               "coinbase":"02ac0707062f503253482f04ed85385c00ed245688000000000c2f4d696e696e67436f72652f",
               "sequence":0
            }
         ],
         "vout":[
            {
               "value":2.50000000,
               "n":0,
               "scriptPubKey":{
                  "asm":"OP_DUP OP_HASH160 ab616448c7c216ba684bb9af5154c5edc4ca9fbd OP_EQUALVERIFY OP_CHECKSIG",
                  "hex":"76a914ab616448c7c216ba684bb9af5154c5edc4ca9fbd88ac",
                  "reqSigs":1,
                  "type":"pubkeyhash",
                  "addresses":[
                     "TRbPDkwa8a73TS2FwGJv9ZhmTgnjtdPSkm"
                  ]
               }
            }
         ],
         "blockhash":"e61d5577060de8fc080c39507d7db6145b8bded0505ceb3ae08169c2c823a6f0",
         "confirmations":1,
         "time":1547208173,
         "blocktime":1547208173,
         "category":"immature",
         "amount":2.5,
         "fee":2.5,
         "blockindex":1,
         "timereceived":1547219969,
         "address":"TRbPDkwa8a73TS2FwGJv9ZhmTgnjtdPSkm",
         "blockheight":1964
      },
      {
...
      }
   ],
   "error":null,
   "id":0
}
ListReceivedByAddress

List balances by receiving address.

Specification: ListReceivedByAddress

Call example:

C#
curl -X POST http://127.0.0.1:16661 -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method" : "listreceivedbyaddress","params" : ["**walletname**"]}]'

Example of a result:

C#
{
   "result":[
      {
         "address":"TTFfmc2ds2usS8Et9CWkpDJwMuxFdCyAqr",
         "amount":55.0,
         "confirmations":762,
         "txids":[
            "3afdf140ece5abb17786118ae3011193e1a6c2c9c7e5035e4597d7427ac3ebb6"
         ]
      },
      {
         "address":"TRbPDkwa8a73TS2FwGJv9ZhmTgnjtdPSkm",
         "amount":122.99999998,
         "confirmations":1,
         "txids":[
            "61613d6d6b477dd6aa03e2c9ebd894f586ffd157276c519465df4dbeb348b615",
            "47739a81cf6d9fe24203441f4e57f34e79657884c3dd00cf4a9fb0999d40e490",
            "82f59de992e6e37608838fc12d12369c85f6274b321992f75f6ae120dc1721ef",
            "8c122c06f22d9cc5675452aad9551f2524731daa0a9e290f05c7a624d43c5bbe",
     ...
         ]
      },

      ...
   ],
   "error":null,
   "id":0
}
ListReceivedByAddress

Get all transactions in blocks since block [blockhash], or all transactions if omitted.

Specification: ListSinceBlockResponse

Call example:

C#
curl -X POST http://127.0.0.1:16661 -H 'Authorization: Basic **yourbase64password**' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '[{"method" : "listsinceblock","params" : ["**walletname**", "**blockhash**", 100]}]'

Example of a result:

C#
{
   "result":[{
       "hex": null,
       "txid": "d825529a2be784e508b4e5027adb6195cc383cc06c6c549950a8988bb1fb4f1f",
       "size": 115,
       "version": 2,
       "locktime": 0,
       "vout": 0,
       "blockhash": "42ef6c15928be2efe2a6c442b4bdca67c6b1906c418be601dc222728fdd8b17b",
       "confirmations": 516,
       "time": 1557251657,
       "blocktime": 1557251657,
       "category": "generate",
       "amount": 2.5,
       "blockheight": 10482,
       "timereceived": 1561796322,
       "address": "TRP11aRj4Sw6pHTiFzkSYESJhwsa18ziBn"
       },
       {
       "hex": null,
       "txid": "9f05f6868c769f2ca7322dc0f2c589f918748698b210b3bfa96e41094a776cfc",
       "size": 115,
       "version": 2,
       "locktime": 0,
       "vout": 0,
       "blockhash": "2cb43e5d47352da2406550e98a3ac5dd35ba0de34eb8d630723f9952dca2cea9",
       "confirmations": 515,
       "time": 1557254850,
       "blocktime": 1557254850,
       "category": "generate",
       "amount": 2.5,
       "blockheight": 10483,
       "timereceived": 1561796322,
       "address": "TRP11aRj4Sw6pHTiFzkSYESJhwsa18ziBn"
       }, ...
   ],
   "error":null,
   "id":0
}