The Hydra Core wallet has a rich set of commands which give comprehensive control of the wallet and blockchain transactions. There are two sets of commands that may be used with Hydra Core wallets:
Console commands are given to a wallet that is already running.
Startup commands are used when starting up a wallet.
This manual focuses on the console commands which are given to a wallet that is running and can be sent using RPC (Remote Procedure Calls) or on the command line to the hydrad server wallet or given to the Hydra-qt desktop GUI (Graphical User Interface) wallet using the Debug window Console command line (see Figure 1).
Figure 1. The hydra-qt Console
Note the warning message in red in Figure 1 and be careful using the private key commands (dumpprivkey and dumpwallet) with Mainnet wallets.
For the server wallet hydrad, console commands are given using the Command Line Interface application hydra-cli on the system command line prompt (see Figure 2).
You can always get a list of the current console commands using the help command (see Figure 3.)
Figure 3. The help command
Console Commands :hammer_and_wrench:
Console commands are given to a running Hydra Core wallet and provide additional information and control. Console commands and are required to operate the hydrad server wallet, which is a "headless" wallet with no graphical user interface.
There are 136 console commands with some good references for the 112 inherited from bitcoin. There are 13 "hidden" commands that are used by developers and won't show up in the "help" list.
Commands can have required or optional parameters and more numerous parameters are entered in JSON (JavaScript Object Notation) format with escaped double quotes ( \" ) as shown below.
Common parameters for these commands are Hydra addresses, block hashes, contract addresses, etc. Some of the commands will have an optional parameter "minconf" (minimum confirmations) which allows you to get a response for a transaction or block that has at least that number of confirmations.
The chain query bitcoin API reference http://chainquery.com/bitcoin-api explains the parameters and gives examples with responses for the commands inherited from bitcoin. The bitcoin chain query API reverence gives 67 commands, of which 2 are not in Hydra (estimatepriority, getgenerate) and two (gettransaction, walletpassphrase) have an additional parameter for Hydra. See also https://bitcoin.org/en/developer-reference#remote-procedure-calls-rpcs.
Advanced interfaces to the Hydra Core wallet (full node) can use these "console commands" as RPCs (Remote Procedure Calls) over a dedicated port connection to the node. To build an exchange hot wallet or server node for a mobile DAPP (Distributed Application) you can use RPCs, which follow these same console commands. The client node offers a JSON-RPC interface over HTTP sockets to perform various operational functions and to manage the local node.
A quick comment on "accounts". Accounts was an ill-fated way from bitcoin to track balances for what are really UTXO transaction-based values, and "accounts" are deprecated and will be phased out by version 0.18.
Here are some command groupings that are useful for various tasks:
Startup commands give additional control and recovery options when launching the wallet. For example, you can use startup commands for various kinds of blockchain recovery techniques, additional debug logging or additional controls. If you are going to use these startup commands, make sure you have a good backup of the wallet.dat file.
See the startup commands on the Hydra-qt wallet with Help - Command line options:
and on the command line itself with "Hydra -?":
Console Commands A - Z
For these console commands documented below, responses are given for default parameters (Hydraversion 0.16 - winter 2018/2019). Commands marked DEPRECATED should not be used because they will be removed and replaced in future versions of the wallet, for example, commands using "account" will be removed in version 0.18.
Using the command "help \" will give complete information about the command and relevant parameters, formatted in a way you can copy and paste (replacing the addresses, transactions IDs, etc., as required). The format below shows the command with parameters followed by the response, in some cases, parameters or responses are truncated with the term "\". Where noted, some commands only work with the regtest (Regression Test) network. Many commands will return "null" for Hydra-qt and return nothing for command line systems.
abandontransaction "txid"
Works on transactions not in the blockchain or mempool, used in testing.
abandontransaction "0cc99a30bc2064041ea4263835b4ed594ff500c56d6b14e4970aeee548e71389"
Transaction not eligible for abandonment (code -5)
abortrescan
Stops a wallet rescan triggered by a command such as importprivkey. This command can be issued by opening a 2nd command line window (where the first window is scanning), in which case the command will stop the scan and return "true".
Add a multisignature address to the wallet so you can receive and send from that address. Run the command on each machine that will be signing and backup the wallet.dat file. The address can be a Hydra address or hex-encoded public key. Use importaddress to add the multisig address on each signing wallet.
This functionality is only intended for use with non-watchonly addresses. See importaddress for watchonly p2sh address support. Use of account is DEPRECATED). See also validateaddress.
Attempts to add a node with a known IP address. This command is useful for new wallets that are having trouble making peer connections. Here are some good IP addresses to add, you can put these commands in one after another, then the wallet will try for a few minutes to make a peer connection with each. Hydrad returns nothing:
Hydra-qt returns "null" after each (see Figure 6).
addwitnessaddress "address" ( p2sh )
Hidden command. DEPRECATED. This command was a way to generate a SegWit address from an existing legacy address, usually a P2SH-P2WPKH addresses - Pay-to-Witness-Public-Key-Hash (P2WPKH) script embedded in a Pay-to-Script-Hash (P2SH) address. This command is mostly disabled in version 0.16 and will be removed in version 0.17. Instead, use the getnewaddress command with address type "p2sh-segwit" or "bech32".
Launch v 0.16 Hydrad with -deprecatedrpc=addwitnessaddress to run the command:
The destination can be a filename or path with a filename. The wallet must be fully decrypted (not just for staking only) for this command to work. Hydra-qt will returns "null", Hydrad returns nothing. On Windows:
Bumps the fee of a transaction, replacing it with a new transaction by adjusting the change. The new fee can be calculated automatically or by using various options.
address (string, optional) The sender address hex string
gasLimit (string, optional) The gas limit for executing the contract
TO COME
clearbanned
Clear all banned nodes IPs. Hydra-qt returns "null", hydrad gives no response.
clearbanned
null
combinerawtransaction ["hexstring",...]
Combine multiple partially signed raw transactions into one transaction. The combined transaction may be another partially signed transaction or a fully signed transaction. Here two raw transactions are combined:
Publish a smart contract for the given bytecode, using default gas price of 0.00000040 and gas amount of 2,500,000. Returns the transaction ID and the contract address hash.
Create a hex-encoded raw transaction sending some inputs to outputs. The transaction must then be signed and sent to the network, see signrawtransaction and sendrawtransaction. Returns a hex-encoded raw transaction. If you are sending coins make sure to create a change address so the change can be returned; any difference between the input values and output values will be taken as the transaction fee.
If you don't work out the math you could pay a VERY HIGH transaction fee!
Disconnects a peer (node) using either the IP address or node number. Hydra-qt will return "null", Hydra will return nothing.
disconnectnode "35.198.0.76:3888"
null
dumpprivkey "address"
Displays the private key for a given address in WIF (Wallet Import Format). The wallet must be unlocked (and not for "staking only") for this command to work.
Writes all the wallet private keys to a file in clear text (unencrypted) format. The wallet must be fully decrypted (not just for staking only) for this command to work. Returns the filename. Dumpwallet will save all the private keys and their addresses; it will not save watchonly addresses (which do not have private keys in the wallet). This file contains all the private keys in the wallet (1,000 or more), be very careful and do not store the dump file online.
Wallet dump created by Hydra v0.16.1.0-0806c12c4-dirty
* Created on 2018-10-31T01:56:32Z
* Best block at time of backup was 241161 (b11d5169d66d39cbcd848e2ea3f9adfcee1c22af945f100aec9e762d88609e2e),
mined on 2018-10-31T01:55:28Z
extended private masterkey:
Wallet dump created by Hydra v0.16.2.0-47a30461d-dirty
* Created on 2018-12-16T02:22:59Z
* Best block at time of backup was 148510
(ca8a9457a69882b395bf56671e3661e148d3aca4a7b6c77398804229e7fb58f4),
mined on 2018-05-06T02:45:52Z
extended private masterkey:
encryptwallet [passphrase]
Encrypts the wallet with "passphrase" for first-time encryption. After encryption, any calls that interact with private keys such as sending or signing will require passphrase entry to enable these functions. See also walletpassphrase, walletlock and walletpassphrasechange. After this command runs, the wallet will shut down.
encryptwallet [you should always use a long and strong passphrase]
(wallet exits)
echo "message"
Hidden command. Simply echo back the input arguments. This command is for testing.
The difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in Hydra-cli and the GUI. There is no server-side difference. Here we echo the parameters used to setup a multisig address.
Hidden command. Simply echo back the input arguments. This command is for testing.
The difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in Hydra-cli and the GUI. There is no server-side difference. Here we echo the parameters used to setup a multisig address.
DEPRECATED. Please use estimatesmartfee for better estimates. Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks.
estimatefee 10
estimatefee is deprecated and will be fully removed in v0.17.
estimaterawfee conf_target (threshold)
Hidden command. WARNING: This command is unstable and may disappear or change, and the results are tightly coupled to the calling parameters.
Gives fee estimates for short, medium, and long term confirmations, and gives mempool statistics for transactions with those fees. Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks.
Select and add inputs to a transaction until it has enough in value to meet its out value. Collects one or more unspent transactions as inputs, and computes and specifies the change amount. Note that inputs which were signed may need to be resigned after completion since in/outputs have been added. The inputs added will not be signed, use signrawtransaction for that.
Mine up to nblocks blocks immediately to an address in the wallet. Used with the regression test "regtest" private test blockchain. Can use generate 1 to publish waiting transactions in the next block, or generate 600 to initialize a new regtest blockchain.
Mine up to nblocks immediately to a specified address. Used with the regression test "regtest" private test blockchain. Here we generate 10 genesis blocks on regtest with 20,000 Test Hydra each, plus an initial block, and listaddressgroupings shows the result:
DEPRECATED. Returns the account name for a given address.
getaccount "H5ytvGW47jcS38NGz9cV6WtK2d3JqhQv5"
My trading Acct 101
getaccountaddress "account"
DEPRECATED. Returns the current Hydra address for an account. Use the null account "" for the default address.
getaccountaddress "My trading Acct 101"
H5ytvGW47jcS38NGz9cV6WtK2d3JqhQv5
getaccountinfo "contract address hash"
Returns information about a contract including storage (the QRC20 balance for every address) and the code. The command may take several minutes to return, depending on the size of the storage (number of token holders). Here is the INK contract.
Returns information about the blockchain. Here "blocks" equals "headers", so this wallet is synced to the latest blocks. "moneysupply" gives the total Hydra created (genesis blocks + all block rewards). "size_on_disk" gives the local storage size for blocks.