Skip to content

ARMRd JSON RPC basics

ARMROfficial edited this page May 14, 2019 · 2 revisions

The following guide covers the basics of making JSON-RPC calls with ARMRd.

parts to be covered

1. Creating a raw transaction, signing and broadcasting it to the network.

2. Checking balance

3. Sending ARMR to a public address

4. Sening ARMR to a stealth address


1. Creating a raw transaction, signing and broadcasting it to the network.


a) listunspent
First we want to get a list of unspent using an address within the wallet.
./ARMRd listunspent [misconf=1] [max_number_confirmation=99999999] '''["<wallet_address>"]'''
Example:
./ARMRd listunspent 1 99999999 '''["AVmcs9otfz9KsANrsaSx8tkN8QoYhgjd5h"]'''
Result:
[{ "txid": "12b8e7ede4992f4d30f93idj3085746951d945e39f40becebd7c290af8c2e7ad", "vout": 1, "address": "AVmcs9otfz9KsANrsaSx8tkN8QoYhgjd5h", "account": "default", "scriptPubKey": "76a9143aa28e1740a6a5a2190975b6e7f1ad67aaec9a3988ac", "amount": 0.05000000, "confirmations": 94, "spendable": true }, { "txid": "8443bc63b65d569ff9ekwm37sy3b67b9c7c6f8f386c3cdf372b260961b64ec9fc", "vout": 1, "address": "AVmcs9otfz9KsANrsaSx8tkN8QoYhgjd5h", "account": "default", "scriptPubKey": "76a9143aa28e1740a6a5a2190975b6e7f1ad67aaec9a3988ac", "amount": 0.01000000, "confirmations": 93, "spendable": true }]
b) createrawtransaction
We need to choose some blocks with sufficient amount from the result of listunspent with amount not exceeding the balance to make the transaction.
./ARMRd createrawtransaction '[{ "txid" : "<txid_of_selected_block>", "vout" : <vout> }]' '{"<recipient_address>": <amount_to_send>, "<sender_address>": <amount_change>}'

Example:
createrawtransaction '[{ "txid" : "12b8e7ede4992f4d30f93idj3085746951d945e39f40becebd7c290af8c2e7ad", "vout" : 0 }]' '{"AVmcs9otfz9KsANrsaSx8tkN8QoYhgjd5h": 0.025, "Ae4HGmnUaq6YKqwhRQ7wLaDfjPPSvG2zwX": 0.0245}'
Result:
0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000
c) signrawtransaction
signs the transaction in the serialized transaction format using private keys stored in the wallet or provided in the call.

./ARMRd signrawtransaction <hex_createrawtransaction>

Example:
./ARMRd signrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c0000000000ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000
Result:
{ "hex" : "0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000", "complete" : true }
d) sendrawtransaction
RPC validates a transaction and broadcasts it to ARMR network.
The command sendrawtransaction returns a transaction hash (txid) as it submits the transaction on ARMR network. To check the transaction hash you can go to ARMR block explorer .
./ARMRd sendrawtransaction <hex_signrawtransaction>
Example:
./ARMRd sendrawtransaction 0100000001e34ac1e2baac09c366fce1c2245536bda8f7db0f6685862aecf53ebd69f9a89c000000006a47304402203e8a16522da80cef66bacfbc0c800c6d52c4a26d1d86a54e0a1b76d661f020c9022010397f00149f2a8fb2bc5bca52f2d7a7f87e3897a273ef54b277e4af52051a06012103c9700559f690c4a9182faa8bed88ad8a0c563777ac1d3f00fd44ea6c71dc5127ffffffff02a0252600000000001976a914d90d36e98f62968d2bc9bbd68107564a156a9bcf88ac50622500000000001976a91407bdb518fa2e6089fd810235cf1100c9c13d1fd288ac00000000
Result:
ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346


2. Checking balance

./ARMRd getbalance
Result:
903.87633399

3. Sending ARMR to a public address

./ARMRd sendtoaddress <ARMRaddress> <amount> [narration] [comment] [comment-to] <amount> is a real and is rounded to the nearest 0.000001 requires wallet passphrase to be set with walletpassphrase first
Example:
./ARMRd sendtoaddress "Ae4HGmnUaq6YKqwhRQ7wLaDfjPPSvG2zwX" 290
Result:
8f53564ae39002052a5019be1f73f7a5563993908e20410982c001f91dc99a44


4. Sending ARMR to a stealth address

sendtostealthaddress <stealth_address> <amount> [narration] [comment] [comment-to] <amount> is a real and is rounded to the nearest 0.000001 requires wallet passphrase to be set with walletpassphrase first
Example:
./ARMRd sendtostealthaddress "smYikodFc55AC4rQCDUmCwG5LUezyxBus18HCkK3TWeVKvauiBDqis8NBBmZa4Ln6gAAswngxZc1Qrgh586F3FNetD396AD4wTCd6J" 130
Result:
8f53564ae39002052a5019be1f73f7a5563993908e20410982c001f91dc99a44\

To get a list of all available RPC Calls
./ARMRd help

To get help for a specific command
./ARMRd help sendtoaddress