-
Notifications
You must be signed in to change notification settings - Fork 3
API Documentation
Michael Saunders edited this page May 5, 2019
·
3 revisions
The available nano-shell functions are listed below.
- account_balance_rpc
- account_create
- account_info_rpc
- account_key_rpc
- account_representative_rpc
- accounts_create_rpc
- active_difficulty_active
- active_difficulty_rpc
- active_difficulty_threshold
- allow_unsafe_commands
- available_supply
- available_supply_rpc
- block_count_rpc
- block_info_account_balance
- block_info_amount
- block_info_amount_mnano
- block_info_previous_hash
- block_info_rpc
- bootstrap_lazy_rpc
- bootstrap_status_rpc
- broadcast_block
- changerep_block
- check_dependencies
- __create_changerep_block_privkey
- __create_changerep_block_wallet
- __create_open_block_privkey
- __create_open_block_wallet
- __create_receive_block_privkey
- __create_receive_block_wallet
- __create_send_block_privkey
- __create_send_block_wallet
- debug
- determine_network
- deterministic_keys_rpc
- deterministic_keys_rpc_text
- error
- __find_dependency
- generate_spam_and_broadcast
- generate_spam_and_broadcast_until_stopped
- generate_spam_sends_to_file
- __generate_spam_send_to_file
- generate_work
- get_account_pending
- get_account_public_key
- get_account_representative
- get_balance_from_account
- get_frontier_hash_from_account
- get_nano_functions_md5sum
- get_nano_version_major
- get_nano_version_minor
- get_pending_exists
- is_decimal
- is_integer
- is_local_and_remote_block_counts_similar
- is_node_up
- is_version_equal_or_greater
- key_expand_rpc
- mnano_to_raw
- nano_shell_help
- __nano_shell_help_detail
- __nano_shell_help_parameters
- nano_version_number
- open_block
- password_change_rpc
- password_enter_rpc
- peers_rpc
- pending_exists_rpc
- print_warning
- process_rpc
- raw_to_mnano
- receive_block
- remote_block_count
- remote_block_count_mynanoninja
- remote_block_count_nanocrawler
- remote_block_count_nanomeltingice
- remote_block_count_nanonodeninja
- search_pending
- search_pending_rpc
- send_block
- show_errors
- stats_counters_rpc
- stop_node_rpc
- strip_block
- trim
- unregex
- update_nano_functions
- version_rpc
- wallet_balances_rpc
- wallet_change_seed
- wallet_change_seed_text_rpc
- wallet_contains
- wallet_contains_rpc
- wallet_create
- wallet_create_rpc
- wallet_export_rpc
- wallet_frontiers_rpc
- work_generate_rpc
- work_peer_add
- work_peer_add_rpc
- work_peer_clear_all
- work_peer_list
- work_peers_clear_rpc
- work_peers_rpc
- work_validate_rpc
===========================================================
Function Name: account_balance_rpc
-----------------------------------------------------------
Description: Query the account balance information for the given nano account
Returns JSON result directly from node, no parsing/formatting applied.
-----------------------------------------------------------
RPC call(s) used: account_balance:account
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: account_create
-----------------------------------------------------------
Description: Create a single account in given wallet.
Note: enables work generation by default.
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
-----------------------------------------------------------
RPC call(s) used: accounts_create:wallet:count:work
-----------------------------------------------------------
Returns: JSON from node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to create the account within
===========================================================
===========================================================
Function Name: account_info_rpc
-----------------------------------------------------------
Description: Query the account information for the given nano account
Returns JSON result directly from node, no parsing/formatting applied.
-----------------------------------------------------------
RPC call(s) used: account_info:account
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: account_key_rpc
-----------------------------------------------------------
Description: Query the given accounts public key information
Returns JSON result directly from node, no parsing/formatting applied.
-----------------------------------------------------------
RPC call(s) used: account_key:account
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: account_representative_rpc
-----------------------------------------------------------
Description: Query the given accounts representative information
Returns JSON result directly from node, no parsing/formatting applied.
-----------------------------------------------------------
RPC call(s) used: account_representative:account
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: accounts_create_rpc
-----------------------------------------------------------
Description: Adds given number of new accounts to wallet.
This is generated in a deterministic way based on the
seed associated with your wallet.
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
-----------------------------------------------------------
RPC call(s) used: accounts_create:wallet:count:work
-----------------------------------------------------------
Returns: JSON from node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to create the accounts within
(2) Parameter is MANDATORY
(2) Valid values: <$count>
(2) Description:
The number of new accounts to generate. Default is 0
(3) Parameter is OPTIONAL
(3) Valid values: <$workgen_boolean>
(3) Description:
Set to true to enable work generation by default after
creating accounts. Default is false.
===========================================================
===========================================================
Function Name: active_difficulty_active
-----------------------------------------------------------
Description: Returns the network's current active PoW difficulty
-----------------------------------------------------------
RPC call(s) used: active_difficulty
-----------------------------------------------------------
Returns: Hex value for network's current detected difficulty.
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: active_difficulty_rpc
-----------------------------------------------------------
Description: Returns the network's current active PoW difficulty
and the node's configured threshold difficulty
Note: Undocumented RPC feature beginning at V19.0RC1
This RPC call name may change so is not guaranteed to work.
-----------------------------------------------------------
RPC call(s) used: active_difficulty
-----------------------------------------------------------
Returns: JSON from the node RPC.
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: active_difficulty_threshold
-----------------------------------------------------------
Description: Returns the node's configured threshold difficulty
-----------------------------------------------------------
RPC call(s) used: active_difficulty
-----------------------------------------------------------
Returns: Hex value for lowest difficulty threshold configured for the node.
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: allow_unsafe_commands
-----------------------------------------------------------
Description: Many of the functions in this script require a special environment
variable to be set before they will function.
Outputs '1' if NANO_UNSAFE_COMMANDS environment variable equals 1, otherwise outputs '0'
If you wish to use commands that could cause loss of funds due to misuse
then run 'export NANO_UNSAFE_COMMANDS=1' to enable these functions.
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: available_supply
-----------------------------------------------------------
Description: Show the total circulating supply on the nano network
-----------------------------------------------------------
RPC call(s) used: available_supply
-----------------------------------------------------------
Returns: Number
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: available_supply_rpc
-----------------------------------------------------------
Description: Show the total circulating supply on the nano network
-----------------------------------------------------------
RPC call(s) used: available_supply
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: block_count_rpc
-----------------------------------------------------------
Description: Show the checked (valid or processed) and unchecked (invalid or queued) total blocks known to the node
-----------------------------------------------------------
RPC call(s) used: block_count
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: block_info_account_balance
-----------------------------------------------------------
Description: Get the balance of the account that published block
with the given hash
after the balance would be added to the account
-----------------------------------------------------------
RPC call(s) used: block:hash
-----------------------------------------------------------
Returns: Number (account balance)
Also returns C style function return code
RETVAL is 1 if error (block not found)
or 0 if success (block found)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to
===========================================================
===========================================================
Function Name: block_info_amount
-----------------------------------------------------------
Description: Determines the balance being transferred in the
given block hash
-----------------------------------------------------------
RPC call(s) used: block:hash
-----------------------------------------------------------
Returns: Number (block balance in raw)
Also returns C style function return code
RETVAL is 1 if error (block not found)
or 0 if success (block found)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to query
===========================================================
===========================================================
Function Name: block_info_amount_mnano
-----------------------------------------------------------
Description: Determines the balance being transferred in the
given block hash
-----------------------------------------------------------
RPC call(s) used: block:hash
-----------------------------------------------------------
Returns: Number (block balance in MNano)
Also returns C style function return code
RETVAL is 1 if error (block not found)
or 0 if success (block found)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to query
===========================================================
===========================================================
Function Name: block_info_previous_hash
-----------------------------------------------------------
Description: Get the block hash immediately before the given one
-----------------------------------------------------------
RPC call(s) used: block:hash
-----------------------------------------------------------
Returns: Hash
Also returns C style function return code
RETVAL is 1 if error (block not found)
or 0 if success (block found)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to retrieve the predecessor for
===========================================================
===========================================================
Function Name: block_info_rpc
-----------------------------------------------------------
Description: Get full block information for the given block hash
-----------------------------------------------------------
RPC call(s) used: block:hash
-----------------------------------------------------------
Returns: JSON from the node RPC
Also returns C style function return code
Return code is 1 if error (block not found)
or 0 if success (block found)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to retrieve detail about
===========================================================
===========================================================
Function Name: bootstrap_lazy_rpc
-----------------------------------------------------------
Description: Initiates a lazy bootstrapping attempt
-----------------------------------------------------------
RPC call(s) used: bootstrap_lazy
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: bootstrap_status_rpc
-----------------------------------------------------------
Description: Shows bootstrap status
(unstable RPC call - may not be
available in future version)
-----------------------------------------------------------
RPC call(s) used: bootstrap_status
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
None
===========================================================
===========================================================
Function Name: broadcast_block
-----------------------------------------------------------
Description: Broadcast the given JSON block to the network
-----------------------------------------------------------
RPC call(s) used: process:block
-----------------------------------------------------------
Returns: Text (block hash) or empty on failure
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$json_block>
(1) Description:
The JSON block to broadcast.
(2) Parameter is OPTIONAL
(2) Valid values: <$subtype>
(2) Description:
Specify the block sub-type to prevent accidental
sends instead of a receive when using state blocks.
===========================================================
===========================================================
Function Name: changerep_block
-----------------------------------------------------------
Description: Create and broadcast a change
representative block
(state) on the nano network
-----------------------------------------------------------
Returns: Text (block hash) of the broadcast change block
-----------------------------------------------------------
Parameters:
Group (1):
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$account>
(2) Description:
The nano account to change the representative of.
(3) Parameter is MANDATORY
(3) Valid values: <$representative_account>
(3) Description:
The representative account to set for
$account
(4) Parameter is OPTIONAL
(4) Valid values: <$work_signature> (node V19+ only)
(4) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
Group (2):
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID of the sending account
(2) Parameter is MANDATORY
(2) Valid values: <$account>
(2) Description:
The nano account within $wallet_uuid to change the representative of.
(3) Parameter is MANDATORY
(3) Valid values: <$representative_account>
(3) Description:
The representative account to set for
$account
(4) Parameter is OPTIONAL
(4) Valid values: <$work_signature> (node V19+ only)
(4) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
===========================================================
===========================================================
Function Name: check_dependencies
-----------------------------------------------------------
Description: Checks if dependencies required by nano-shell can be found
If not, will echo to stderr a message indicating which dependency
Could not be found, and returns a unique error code
-----------------------------------------------------------
Returns: Text to stderr if dependency missing and return code (0 is success)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: __create_changerep_block_privkey
-----------------------------------------------------------
Description: (Internal function)
Creates a change representative block (state)
for <$dest_account_address>
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
-----------------------------------------------------------
RPC call(s) used: account_info:account
account_representative:account
block_create:type:key:account:link:previous:balance:representative
-----------------------------------------------------------
Returns: JSON from node RPC (change representative block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key for the <$dest_account_address>
(2) Parameter is MANDATORY
(2) Valid values: <$dest_account_address>
(2) Description:
The nano account address to change
the <$representative> for.
(3) Parameter is MANDATORY
(3) Valid values: <$representative>
(3) Description:
The representative to set
for <$dest_account_address>
(4) Parameter is OPTIONAL
(4) Valid values: <$work_value>
(4) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: __create_changerep_block_wallet
-----------------------------------------------------------
Description: (Internal function)
Creates a change representative block (state)
for <$account>
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
Note: wallet must be unlocked before attempting this.
-----------------------------------------------------------
RPC call(s) used: account_info:account
account_representative:account
block_create:type:key:account:link:previous:balance:representative
-----------------------------------------------------------
Returns: JSON from node RPC (change representative block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The sender's wallet UUID associated with $source_account_address
(2) Parameter is MANDATORY
(2) Valid values: <$account>
(2) Description:
The nano account address in <$wallet_uuid> to change
the representative to <$representative>.
(3) Parameter is MANDATORY
(3) Valid values: <$representative>
(3) Description:
The representative to set
for <$account>
(4) Parameter is OPTIONAL
(4) Valid values: <$work_value>
(4) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: __create_open_block_privkey
-----------------------------------------------------------
Description: (Internal function)
Creates an open block (state)
to pocket funds from an existing SOURCE block
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
-----------------------------------------------------------
RPC call(s) used: account_info:account
block:hash
block_create:type:key:representative:source:destination:previous:balance
-----------------------------------------------------------
Returns: JSON from node RPC (open block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The source block hash to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account to receive
the funds into (and open the account)
(4) Parameter is MANDATORY
(4) Valid values: <$representative_account>
(4) Description:
The representative to set for the
newly opened $dest_account_address
(5) Parameter is OPTIONAL
(5) Valid values: <$work_value>
(5) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: __create_open_block_wallet
-----------------------------------------------------------
Description: (Internal function)
Creates an open block (state)
to pocket funds from an existing SOURCE block
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
-----------------------------------------------------------
RPC call(s) used: account_info:account
block:hash
block_create:type:wallet:account:representative:source:destination:previous:balance
-----------------------------------------------------------
Returns: JSON from node RPC (open block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID containing the nano address to open
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The source block hash to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account to receive
the funds into (and open the account)
(4) Parameter is MANDATORY
(4) Valid values: <$representative_account>
(4) Description:
The representative to set for the
newly opened $dest_account_address
(5) Parameter is OPTIONAL
(5) Valid values: <$work_value>
(5) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: __create_receive_block_privkey
-----------------------------------------------------------
Description: (Internal function)
Creates a receive block (state)
to pocket funds found in <$source_block_hash>
to <$dest_account_address>
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
-----------------------------------------------------------
RPC call(s) used: account_info:account
account_representative:account
block:hash
block_create:type:key:representative:source:destination:previous:balance
-----------------------------------------------------------
Returns: JSON from node RPC (receive block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the sender
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The existing block hash on the network that
contains the funds to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account to receive the funds
(4) Parameter is OPTIONAL
(4) Valid values: <$representative>
(4) Description:
The representative for <$dest_account_address>
(5) Parameter is OPTIONAL
(5) Valid values: <$work_value>
(5) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: __create_receive_block_wallet
-----------------------------------------------------------
Description: (Internal function)
Creates a receive block (state)
to pocket funds found in <$source_block_hash>
to <$account>
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
Note: wallet must be unlocked before attempting this.
-----------------------------------------------------------
RPC call(s) used: account_info:account
account_representative:account
block:hash
block_create:type:key:representative:source:destination:previous:balance
-----------------------------------------------------------
Returns: JSON from node RPC (receive block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The sender's wallet UUID associated with $source_account_address
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The existing block hash on the network that
contains the funds to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$account>
(3) Description:
The destination account to receive the funds
(4) Parameter is OPTIONAL
(4) Valid values: <$representative>
(4) Description:
The representative for <$account>
(5) Parameter is OPTIONAL
(5) Valid values: <$work_value>
(5) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: __create_send_block_privkey
-----------------------------------------------------------
Description: (Internal function)
Creates a send block (state)
to transfer <$amount_raw> from
<$source_account_address> to a <$dest_account_address>
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
-----------------------------------------------------------
RPC call(s) used: account_info:account
block:hash
account_representative:account
block_create:type:key:account:destination:previous:balance:representative
-----------------------------------------------------------
Returns: JSON from node RPC (send block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the sender
(2) Parameter is MANDATORY
(2) Valid values: <$source_account_address>
(2) Description:
The account that is sending the funds
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account to receive the funds
(4) Parameter is MANDATORY
(4) Valid values: <$amount_raw>
(4) Description:
The amount of nano (RAW) to send
(5) Parameter is OPTIONAL
(5) Valid values: <$work_value>
(5) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: __create_send_block_wallet
-----------------------------------------------------------
Description: (Internal function)
Creates a send block (state)
to transfer <$amount_raw> from
<$source_account_address> to a <$dest_account_address>
but does not broadcast it to the network
Stores resulting block hash in variable $BLOCK_HASH
Note: wallet must be unlocked before attempting this.
-----------------------------------------------------------
RPC call(s) used: account_info:account
block:hash
account_representative:account
block_create:type:key:account:destination:previous:balance:representative
-----------------------------------------------------------
Returns: JSON from node RPC (send block)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The sender's wallet UUID associated with $source_account_address
(2) Parameter is MANDATORY
(2) Valid values: <$source_account_address>
(2) Description:
The account that is sending the funds
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account to receive the funds
(4) Parameter is MANDATORY
(4) Valid values: <$amount_raw>
(4) Description:
The amount of nano (RAW) to send
(5) Parameter is OPTIONAL
(5) Valid values: <$work_value>
(5) Description:
Avoid doing a Proof of Work calculation and
instead use the supplied pre-generated work value
for this block.
===========================================================
===========================================================
Function Name: debug
-----------------------------------------------------------
Description: If debug flag is enabled, will output logging and stdout where used.
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: determine_network
-----------------------------------------------------------
Description: Determines the network the node is operating
within. It does this by looking for particular
block hashes.
(Note: swallows node RPC errors if any)
-----------------------------------------------------------
RPC call(s) used: block:hash
-----------------------------------------------------------
Returns: Text (PROD,BETA,OTHER)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: deterministic_keys_rpc
-----------------------------------------------------------
Description: For the given seed (in file) output the
number of keys specified by index.
This shows the first X number of accounts
and their public/private keys on the seed.
WARNING: Do not use this function on a shared server
your seed could be exposed.
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
-----------------------------------------------------------
RPC call(s) used: deterministic_key:seed:index
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$seed_file>
(1) Description:
The file containing your plaintext seed. The
file should consist of a single line with
your seed in plaintext.
(2) Parameter is MANDATORY
(2) Valid values: <$index>
(2) Description:
The number of accounts to show
===========================================================
===========================================================
Function Name: deterministic_keys_rpc_text
-----------------------------------------------------------
Description: For the given seed (in text) output the
number of keys specified by index.
This shows the first X number of accounts
and their public/private keys on the seed.
WARNING: Do not use this function on a shared server
your seed could be exposed.
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
-----------------------------------------------------------
RPC call(s) used: deterministic_key:seed:index
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$seed>
(1) Description:
The seed as text.
(2) Parameter is MANDATORY
(2) Valid values: <$index>
(2) Description:
The number of accounts to show
===========================================================
===========================================================
Function Name: error
-----------------------------------------------------------
Description: Prints error messages
-----------------------------------------------------------
Returns: Text to stderr
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: __find_dependency
-----------------------------------------------------------
Description: (Internal function)
Try to find $PROG on our $PATH, otherwise attempt to find
it in a few common places before giving up...
Will echo the pathfile of $PROG if found, or empty+non-zero return code
-----------------------------------------------------------
Returns: Text (path to binary executable if found) and return code (0 is success)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: generate_spam_and_broadcast
-----------------------------------------------------------
Description: This function generates a given number
of blocks, and then immediately sends them.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$account_address>
(2) Description:
The sending account address
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account address
to receive the spam sends.
(4) Parameter is MANDATORY
(4) Valid values: <$blocks_to_create_in_batch>
(4) Description:
The number of blocks to generate per batch
e.g. if set to 5, it will pre-generate 5 blocks
then send all 5.
Note: can be specified in environment variable
named BLOCKS_TO_CREATE for backwards compatibility.
(5) Parameter is OPTIONAL
(5) Valid values: <$work_difficulty>
(5) Description:
The work difficulty to use (dynPoW) for the spam
Can be either a 16 character hexadecimal string
Or use inbuilt values from nano-shell:
weak, normal, strong, very_strong
===========================================================
===========================================================
Function Name: generate_spam_and_broadcast_until_stopped
-----------------------------------------------------------
Description: This function will loop until interrupted
or until a failure occurs.
It loops running the 'generate_spam_and_broadcast' function.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$account_address>
(2) Description:
The sending account address
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account address
to receive the spam sends.
(4) Parameter is OPTIONAL
(4) Valid values: <$blocks_to_create_in_batch>
(4) Description:
The number of blocks to generate per batch
e.g. if set to 5, it will pre-generate 5 blocks
then will send all 5, and will then repeat.
If not specified, will attempt to use
the value set in the environment variable
named BLOCKS_TO_CREATE, otherwise defaults to 1
(5) Parameter is OPTIONAL
(5) Valid values: <$work_difficulty>
(5) Description:
The work difficulty to use (dynPoW) for the spam
Can be either a 16 character hexadecimal string
Or use inbuilt values from nano-shell:
weak, normal, strong, very_strong
===========================================================
===========================================================
Function Name: generate_spam_sends_to_file
-----------------------------------------------------------
Description: This function generates a given number
of blocks and writes them to a file
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$account_address>
(2) Description:
The sending account address
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account address
(4) Parameter is OPTIONAL
(4) Valid values: <$work_difficulty>
(4) Description:
The work difficulty to use (dynPoW) for the spam
Can be either a 16 character hexadecimal string
Or use inbuilt values from nano-shell:
weak, normal, strong, very_strong
(5) Parameter is OPTIONAL
(5) Valid values: <$blocks_to_create_in_batch>
(5) Description:
The number of blocks to generate per batch
e.g. if set to 5, it will generate 5 blocks
This parameter can also be specified in environment variable
named BLOCKS_TO_CREATE for backwards compatibility.
If not specified, will default to 1
(6) Parameter is OPTIONAL
(6) Valid values: <$block_store_file>
(6) Description:
The file that will contain the blocks generated
If this file already exists and the associated
$block_store_file.hash file also exists
then nano-shell will resume generating blocks
from the last block+hash generated in the file.
This parameter can also be specified in environment variable
named BLOCK_STORE for backwards compatibility.
If not specified, will default to your $TMPDIR
in a file named 'block_store_temp.XXXXX'
===========================================================
===========================================================
Function Name: __generate_spam_send_to_file
-----------------------------------------------------------
Description: (Internal function)
This function generates a given number
of blocks and writes them to a file
This function expects particular environment variables
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$account_address>
(2) Description:
The sending account address
(3) Parameter is MANDATORY
(3) Valid values: <$dest_account_address>
(3) Description:
The destination account address
(4) Parameter is OPTIONAL
(4) Valid values: <$work_difficulty>
(4) Description:
The work difficulty (dynPoW)
===========================================================
===========================================================
Function Name: generate_work
-----------------------------------------------------------
Description: Generate the PoW for the given block hash
-----------------------------------------------------------
RPC call(s) used: work_generate:hash:use_peers
-----------------------------------------------------------
Returns: Text (the work signature)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to generate work for.
(2) Parameter is OPTIONAL
(2) Valid values: <$use_peers>
(2) Description:
Can be set to 0 (false) to prevent farming
off the work generation to any work peers
(3) Parameter is OPTIONAL
(3) Valid values: <$difficulty_descriptive_text_or_hex>
(3) Description:
Set the PoW difficulty (V19+ only)
You can either specify the value in hexadecimal
as per the normal node RPC
OR you can use a built-in value from nano-shell, one of:
weak, normal, strong, very_strong
Defaults to ffffffc000000000 or 'normal'
===========================================================
===========================================================
Function Name: get_account_pending
-----------------------------------------------------------
Description: Query the pending (unpocketed) blocks raw value for the given nano account
-----------------------------------------------------------
RPC call(s) used: account_info:account
-----------------------------------------------------------
Returns: Number
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: get_account_public_key
-----------------------------------------------------------
Description: Show the public key for the given nano account
-----------------------------------------------------------
RPC call(s) used: account_key:account
-----------------------------------------------------------
Returns: Public key
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: get_account_representative
-----------------------------------------------------------
Description: Query who the representative is for the given nano account
-----------------------------------------------------------
RPC call(s) used: account_representative:account
-----------------------------------------------------------
Returns: Nano address
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: get_balance_from_account
-----------------------------------------------------------
Description: Query the balance for the given nano account
but return only the balance of the account
-----------------------------------------------------------
RPC call(s) used: account_info:account
-----------------------------------------------------------
Returns: Number
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: get_frontier_hash_from_account
-----------------------------------------------------------
Description: Query the frontier hash for the given nano account
(e.g. the head block/the most recent transaction known)
-----------------------------------------------------------
RPC call(s) used: account_info:account
-----------------------------------------------------------
Returns: Hash
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$nano_address>
(1) Description:
The nano account address to query
===========================================================
===========================================================
Function Name: get_nano_functions_md5sum
-----------------------------------------------------------
Description: Get the calculated md5sum of nano-shell
excluding variables:
NANO_FUNCTIONS_HASH, NODEHOST DEBUG
-----------------------------------------------------------
Returns: md5sum of nano-shell
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: get_nano_version_major
-----------------------------------------------------------
Description: Get the major version of the node
e.g. if you run node v16.3
it will return 16
(Note: swallows errors from the node RPC)
-----------------------------------------------------------
Returns: Number (major version of node)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: get_nano_version_minor
-----------------------------------------------------------
Description: Get the minor version of the node
e.g. if you run node v16.3
it will return 3
(Note: swallows errors from the node RPC)
-----------------------------------------------------------
Returns: Number (minor version of node)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: get_pending_exists
-----------------------------------------------------------
Description: Determine if block with given hash is pending
-----------------------------------------------------------
RPC call(s) used: pending_exists:hash
-----------------------------------------------------------
Returns: Boolean as number (1 true, 0 false)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to check
===========================================================
===========================================================
Function Name: is_decimal
-----------------------------------------------------------
Description: Check if input satisfies criteria
to be a decimal (also works with integer).
Thanks to user 'pixelbeat' in StackOverflow thread:
https://stackoverflow.com/questions/806906/how-do-i-test-if-a-variable-is-a-number-in-bash
-----------------------------------------------------------
Returns: Boolean as string (true) if decimal
or false if not.
Also function return codes are C-style
RETVAL is 1 if error (NaN)
or 0 if success (is decimal)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$input>
(1) Description:
The input string to check.
===========================================================
===========================================================
Function Name: is_integer
-----------------------------------------------------------
Description: Check if input satisfies criteria
to be an integer.
-----------------------------------------------------------
Returns: Boolean as string (true) if integer
or false if not.
Also function return codes are C-style
RETVAL is 1 if error (NaN)
or 0 if success (is integer)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$input>
(1) Description:
The input string to check.
===========================================================
===========================================================
Function Name: is_local_and_remote_block_counts_similar
-----------------------------------------------------------
Description: Query public APIs to obtain average block count
and then compare the result to our local block count.
Sites: Nano Crawler, Nano Node Ninja, Nano Watch
Note: This call may break if the given site(s) change the format used
Note: to display blocks.
-----------------------------------------------------------
RPC call(s) used: (non nano-node, remote calls to community run block explorers)
block_count
-----------------------------------------------------------
Returns: Boolean as number (0 false, 1 true)
-----------------------------------------------------------
Parameters:
(1) Parameter is OPTIONAL
(1) Valid values: <$within_amount_blocks>
(1) Description:
Check if local block count from our node is within the number of blocks
specified by this parameter (positive or negative).
If no value specified, defaults to 0.01% of remote_block_count average.
===========================================================
===========================================================
Function Name: is_node_up
-----------------------------------------------------------
Description: Checks if the node is running by executing a block_count RPC call
Will echo 'Node is running' and returns 0 if UP
Otherwise outputs an error message and returns 0 if DOWN
(Note: swallows node RPC errors if any)
-----------------------------------------------------------
RPC call(s) used: block_count
-----------------------------------------------------------
Returns: Text and return code (0 is UP, 1 is DOWN)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: is_version_equal_or_greater
-----------------------------------------------------------
Description: Checks if the node version of greater or equal
to the given major and minor version parameters
(Note: swallows errors from the node RPC)
-----------------------------------------------------------
Returns: Boolean as string (true or false)
Also uses C-style function return
code, e.g. 0 if true, 1 if false.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$major_number>
(1) Description:
The major version to compare
(2) Parameter is MANDATORY
(2) Valid values: <$minor_number>
(2) Description:
The minor version to compare
===========================================================
===========================================================
Function Name: key_expand_rpc
-----------------------------------------------------------
Description: Shows associated public key and account with given private key
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
-----------------------------------------------------------
RPC call(s) used: key_expand
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key to view account and public key.
===========================================================
===========================================================
Function Name: mnano_to_raw
-----------------------------------------------------------
Description: Converts from NANO (MNano) amounts into raw
-----------------------------------------------------------
Returns: Number (raw amount)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$mnano_amount_number>
(1) Description:
The MNano amount to convert into raw
===========================================================
===========================================================
Function Name: nano_shell_help
-----------------------------------------------------------
Description: Provides help for functions provided by nano-shell.
If you provide no arguments to this function, it will return a summary list of all available functions
Otherwise, you can provide one (1) optional argument.
-----------------------------------------------------------
Returns: Text
-----------------------------------------------------------
Parameters:
(1) Parameter is OPTIONAL
(1) Valid values: <list,$function_name>
(1) Description:
Specify a particular function_name to retrieve detailed help on using that function_name.
If nothing is specified, this will default to showing a summary list of all available functions.
===========================================================
===========================================================
Function Name: __nano_shell_help_detail
-----------------------------------------------------------
Description: (Internal function)
Gets the comments preceeding a function name for parsing by the help
functions.
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: __nano_shell_help_parameters
-----------------------------------------------------------
Description: (Internal function)
Provides parsing of help documentation for function parameters
where function comments match expected format.
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: nano_version_number
-----------------------------------------------------------
Description: Query the node version
Parses the result to only show version string as Major.Minor
-----------------------------------------------------------
RPC call(s) used: version
-----------------------------------------------------------
Returns: Decimal version number (major.minor)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: open_block
-----------------------------------------------------------
Description: Create and broadcast an open block
(state) on the nano network
-----------------------------------------------------------
RPC call(s) used: account_info:account
block:hash
block_create:type:key:representative:source:destination:previous:balance
or block_create:type:wallet:account:representative:source:destination:previous:balance
-----------------------------------------------------------
Returns: Text (block hash) of the broadcast open block
if successful.
-----------------------------------------------------------
Parameters:
Group (1):
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The source block hash to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$destaccount>
(3) Description:
The destination account to receive
the funds into (and open the account)
(4) Parameter is MANDATORY
(4) Valid values: <$representative_account>
(4) Description:
The representative to set for the
$destaccount
(5) Parameter is OPTIONAL
(5) Valid values: <$work_signature> (node V19+ only)
(5) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
Group (2):
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet id for <$destaccount> that will receive the funds
and we will create an open block for.
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The source block hash to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$destaccount>
(3) Description:
The destination account to receive
the funds into (and open the account)
(4) Parameter is MANDATORY
(4) Valid values: <$representative_account>
(4) Description:
The representative to set for the
$destaccount
(5) Parameter is OPTIONAL
(5) Valid values: <$work_signature> (node V19+ only)
(5) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
===========================================================
===========================================================
Function Name: password_change_rpc
-----------------------------------------------------------
Description: Change the password for the wallet to password
for given wallet UUID
-----------------------------------------------------------
RPC call(s) used: password_change:wallet:password
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to alter the password
(2) Parameter is MANDATORY
(2) Valid values: <$password_as_text>
(2) Description:
The password to set for $wallet_uuid
===========================================================
===========================================================
Function Name: password_enter_rpc
-----------------------------------------------------------
Description: Unlock the wallet with the password
for given wallet UUID
-----------------------------------------------------------
RPC call(s) used: password_enter:wallet:password
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to unlock
(2) Parameter is MANDATORY
(2) Valid values: <$password_as_text>
(2) Description:
The password to use to unlock $wallet_uuid
===========================================================
===========================================================
Function Name: peers_rpc
-----------------------------------------------------------
Description: Query the nodes known peers
Returns JSON result directly from node, no parsing/formatting applied.
-----------------------------------------------------------
RPC call(s) used: peers
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: pending_exists_rpc
-----------------------------------------------------------
Description: Determine if block with given hash is pending
-----------------------------------------------------------
RPC call(s) used: pending_exists:hash
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to check
===========================================================
===========================================================
Function Name: print_warning
-----------------------------------------------------------
Description: Prints a warning if using this script on the mainnet.
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: process_rpc
-----------------------------------------------------------
Description: Broadcast the given JSON block to the network
-----------------------------------------------------------
RPC call(s) used: process:block
-----------------------------------------------------------
Returns: JSON from the node RPC.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$json_block>
(1) Description:
The JSON block to broadcast.
(2) Parameter is OPTIONAL
(2) Valid values: <$subtype> (node V18+ only)
(2) Description:
Specify the block sub-type to prevent accidental
sends instead of a receive when using state blocks.
===========================================================
===========================================================
Function Name: raw_to_mnano
-----------------------------------------------------------
Description: Converts from nano raw amounts into
MNano (standard measurement unit in 2018)
-----------------------------------------------------------
Returns: Number (MNano to six decimal places only)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$raw_nano_amount_number>
(1) Description:
The raw nano amount to convert into MNano
===========================================================
===========================================================
Function Name: receive_block
-----------------------------------------------------------
Description: Create and broadcast a receive block
(state) on the nano network
Note: to determine whether the first argument is either <$private_key>
Note: or <$wallet_uuid> the first two parameters are ALWAYS sent to
Note: the wallet_contains node RPC.
-----------------------------------------------------------
Returns: Text (block hash) of the broadcast receive block
if successful.
-----------------------------------------------------------
Parameters:
Group (1):
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The block hash to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$destaccount>
(3) Description:
The account to receive the funds
(4) Parameter is OPTIONAL
(4) Valid values: <$work_signature> (node V19+ only)
(4) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
Group (2):
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID of the sending account
(2) Parameter is MANDATORY
(2) Valid values: <$source_block_hash>
(2) Description:
The block hash to pocket
(3) Parameter is MANDATORY
(3) Valid values: <$destaccount>
(3) Description:
The account to receive the funds
(4) Parameter is OPTIONAL
(4) Valid values: <$work_signature> (node V19+ only)
(4) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
===========================================================
===========================================================
Function Name: remote_block_count
-----------------------------------------------------------
Description: Query the public APIs at three different sites and averages the result
Sites: Nano Crawler, My Nano Ninja
Note: This call may break if the given site(s) change the format used
Note: to display blocks, or if they are offline.
-----------------------------------------------------------
RPC call(s) used: (non nano-node, remote calls to community run block explorers)
-----------------------------------------------------------
Returns: Number (processed blocks average from remote APIs)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: remote_block_count_mynanoninja
-----------------------------------------------------------
Description: Query the public API at the given site to retrieve a block count
Note: This call may break if the given site changes the format used
Note: to display blocks.
Note: Only works with the LIVE (PROD) nano network - no BETA API known.
-----------------------------------------------------------
RPC call(s) used: (non nano-node, remote call to /api/blockcount)
-----------------------------------------------------------
Returns: Number (processed blocks)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: remote_block_count_nanocrawler
-----------------------------------------------------------
Description: Query the public API at the given site to retrieve a block count
Note: This call may break if the given site changes the format used
Note: to display blocks.
Query the public API at the given site to retrieve a block count
Note: This call may break if the given site changes the format used
Note: to display blocks.
-----------------------------------------------------------
RPC call(s) used: (non nano-node, remote call to /block_count)
(non nano-node, remote call to /block_count)
-----------------------------------------------------------
DEPRECATED FUNCTION: Use remote_block_count_mynanoninja instead.
-----------------------------------------------------------
Returns: Number (processed blocks)
Number (processed blocks)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: remote_block_count_nanomeltingice
-----------------------------------------------------------
Description: Query the public API at the given site to retrieve a block count
Note: This call may break if the given site changes the format used
Note: to display blocks.
-----------------------------------------------------------
RPC call(s) used: (non nano-node, remote call to /block_count)
-----------------------------------------------------------
DEPRECATED FUNCTION: Use remote_block_count_nanocrawler instead.
-----------------------------------------------------------
Returns: Number (processed blocks)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: remote_block_count_nanonodeninja
-----------------------------------------------------------
Description: Query the public API at the given site to retrieve a block count
Note: This call may break if the given site changes the format used
Note: to display blocks.
-----------------------------------------------------------
RPC call(s) used: (non nano-node, remote call to /block_count)
-----------------------------------------------------------
DEPRECATED FUNCTION: Use remote_block_count_mynanoninja instead.
-----------------------------------------------------------
Returns: Number (processed blocks)
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: search_pending
-----------------------------------------------------------
Description: Tells the node to search for any pending blocks for
any account within the given wallet
-----------------------------------------------------------
RPC call(s) used: search_pending:wallet
-----------------------------------------------------------
Returns: Boolean as number (1 true, 0 false) indicating if searching has started
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet to scan
===========================================================
===========================================================
Function Name: search_pending_rpc
-----------------------------------------------------------
Description: Tells the node to search for any pending blocks for
any account within the given wallet
-----------------------------------------------------------
RPC call(s) used: search_pending:wallet
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet to scan
===========================================================
===========================================================
Function Name: send_block
-----------------------------------------------------------
Description: Create and broadcast a send block
(state) on the nano network
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
Note: to determine whether the first argument is either <$private_key>
Note: or <$wallet_uuid> the first two parameters are ALWAYS sent to
Note: the wallet_contains node RPC.
-----------------------------------------------------------
RPC call(s) used: wallet_contains:walletuuid:account
account_info:account
block:hash
account_representative:account
block_create:type:key:account:destination:previous:balance:representative
or block_create:type:wallet_uuid:account:destination:previous:balance:representative
-----------------------------------------------------------
Returns: Text (block hash) of the broadcast send block
if successful.
-----------------------------------------------------------
Parameters:
Group (1):
(1) Parameter is MANDATORY
(1) Valid values: <$private_key>
(1) Description:
The private key of the broadcasting account
(2) Parameter is MANDATORY
(2) Valid values: <$account>
(2) Description:
The broadcasting account (sender)
(3) Parameter is MANDATORY
(3) Valid values: <$destaccount>
(3) Description:
The destination account to send
the funds to
(4) Parameter is MANDATORY
(4) Valid values: <$balance_MNano>
(4) Description:
The NANO (MNano) amount to send
to the $destaccount
(5) Parameter is OPTIONAL
(5) Valid values: <$work_signature> (node V19+ only)
(5) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
Group (2):
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID of the sending account
(2) Parameter is MANDATORY
(2) Valid values: <$account>
(2) Description:
The broadcasting account (sender)
(3) Parameter is MANDATORY
(3) Valid values: <$destaccount>
(3) Description:
The destination account to send
the funds to
(4) Parameter is MANDATORY
(4) Valid values: <$balance_MNano>
(4) Description:
The NANO (MNano) amount to send
to the $destaccount
(5) Parameter is OPTIONAL
(5) Valid values: <$work_signature> (node V19+ only)
(5) Description:
The pre-computed work value to use for signing
this block. This will avoid calculating new work
and will use the value provided in this parameter.
See 'generate_work' function for getting this value
-----------------------------------------------------------
===========================================================
===========================================================
Function Name: show_errors
-----------------------------------------------------------
Description: Grep's stdin and if 'error' is found, will
output the string to stderr, and give off a non-zero (1)
return code.
This is used by many internal wrapper functions so we
do not swallow the node RPC error messages.
WARNING: THIS WILL BLOCK ON WAITING FOR STDIN.
-----------------------------------------------------------
Returns: The input, but outputs any string containing 'error' to stderr
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: stats_counters_rpc
-----------------------------------------------------------
Description: Query the node statistics, type: counters
Returns JSON result directly from node, no parsing/formatting applied.
-----------------------------------------------------------
RPC call(s) used: stats:counters
-----------------------------------------------------------
Returns: JSON from node RPC
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: stop_node_rpc
-----------------------------------------------------------
Description: Shuts down the nano node
-----------------------------------------------------------
RPC call(s) used: stop
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: strip_block
-----------------------------------------------------------
Description: Parses resulting blocks and strips out leading
colon-space-quote and trailing quote from string
-----------------------------------------------------------
Returns: Block with stripped characters ready for
broadcasting or other use.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$JSON_block_result_from_node_RPC>
(1) Description:
Block result from node RPC for stripping.
===========================================================
===========================================================
Function Name: trim
-----------------------------------------------------------
Description: Simple trim (POSIX compliant)
to remove leading and trailing whitespace.
Thanks to stackoverflow comment:
https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable
-----------------------------------------------------------
Returns: The input trimmed
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: unregex
-----------------------------------------------------------
Description: Escapes any special characters in given input
Thanks to: http://stackoverflow.com/a/2705678/120999
-----------------------------------------------------------
Returns: The input string with special characters escaped
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$string_input>
(1) Description:
The string to parse and escape.
===========================================================
===========================================================
Function Name: update_nano_functions
-----------------------------------------------------------
Description: Update nano-shell to the latest version
This will only succeed if no (or minimal)
changes have been made to the script itself.
nano-shell checks this by calculating an MD5SUM
of the file (with certain variables excluded)
and comparing it to the internal MD5SUM variable
If they don't match, it will download the new
version of nano-shell, but leave it alongside
the old script with the same filename and
the extension '.new' added to it.
-----------------------------------------------------------
Returns: Status message indicating whether this was
a success or the failure reason.
-----------------------------------------------------------
Parameters:
(1) Parameter is OPTIONAL
(1) Valid values: <master,testing,bleeding>
(1) Description:
You can specify which branch to pull the
release from. It defaults to 'master'
but you can pull the 'testing' version
or even 'bleeding' but this is not recommended
===========================================================
===========================================================
Function Name: version_rpc
-----------------------------------------------------------
Description: Query the node version and max compatible protocol version
Returns JSON result directly from node, no parsing/formatting applied.
-----------------------------------------------------------
RPC call(s) used: version
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: wallet_balances_rpc
-----------------------------------------------------------
Description: Show all known pending and received balances on all accounts
for given wallet UUID
-----------------------------------------------------------
RPC call(s) used: wallet_balances:wallet
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to check
===========================================================
===========================================================
Function Name: wallet_change_seed
-----------------------------------------------------------
Description: Change the seed associated with the given wallet UUID
into the given seed, sourced from a file.
WARNING: Do not use this function on a shared server
your seed could be exposed.
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
-----------------------------------------------------------
RPC call(s) used: wallet_change_seed:wallet:seed
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID you wish to associate with the seed
(2) Parameter is MANDATORY
(2) Valid values: <$seed_file>
(2) Description:
The file containing your plaintext seed. The
file should consist of a single line with
your seed in plaintext.
===========================================================
===========================================================
Function Name: wallet_change_seed_text_rpc
-----------------------------------------------------------
Description: Change the seed associated with the given wallet UUID
into the given seed.
WARNING: Do not use this function on a shared server
your seed could be exposed.
Requires environment variable 'NANO_UNSAFE_COMMANDS' to be set to 1
-----------------------------------------------------------
RPC call(s) used: wallet_change_seed:wallet:seed
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID you wish to associate with the seed
(2) Parameter is MANDATORY
(2) Valid values: <$seed>
(2) Description:
The seed in plaintext.
===========================================================
===========================================================
Function Name: wallet_contains
-----------------------------------------------------------
Description: Does this particular wallet UUID contain the given nano account
-----------------------------------------------------------
RPC call(s) used: wallet_contains:wallet:account
-----------------------------------------------------------
Returns: Boolean as number (1 true, 0 false)
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to check for the given nano account
(2) Parameter is MANDATORY
(2) Valid values: <$nano_address>
(2) Description:
The nano account address
===========================================================
===========================================================
Function Name: wallet_contains_rpc
-----------------------------------------------------------
Description: Does this particular wallet UUID contain the given nano account
-----------------------------------------------------------
RPC call(s) used: wallet_contains:wallet:account
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to check for the given nano account
(2) Parameter is MANDATORY
(2) Valid values: <$nano_address>
(2) Description:
The nano account address
===========================================================
===========================================================
Function Name: wallet_create
-----------------------------------------------------------
Description: Creates a new random wallet
-----------------------------------------------------------
RPC call(s) used: wallet_create
-----------------------------------------------------------
Returns: Wallet UUID
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: wallet_create_rpc
-----------------------------------------------------------
Description: Creates a new random wallet
-----------------------------------------------------------
RPC call(s) used: wallet_create
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: wallet_export_rpc
-----------------------------------------------------------
Description: Returns a JSON representation of given wallet
-----------------------------------------------------------
RPC call(s) used: wallet_export:wallet
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to export
===========================================================
===========================================================
Function Name: wallet_frontiers_rpc
-----------------------------------------------------------
Description: Show all known frontier (head blocks) hash
paired with account numbers for given wallet UUID
-----------------------------------------------------------
RPC call(s) used: wallet_frontiers:wallet
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$wallet_uuid>
(1) Description:
The wallet UUID to check for frontier-account pairs
===========================================================
===========================================================
Function Name: work_generate_rpc
-----------------------------------------------------------
Description: Generate the PoW for the given block hash
-----------------------------------------------------------
RPC call(s) used: work_generate:hash:use_peers:difficulty
-----------------------------------------------------------
Returns: JSON from the node RPC.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$hash>
(1) Description:
The block hash to generate work for.
(2) Parameter is OPTIONAL
(2) Valid values: <$use_peers>
(2) Description:
Can be set to 0 or false to prevent farming
off the work generation to any work peers
Defaults to 1 or true
(3) Parameter is OPTIONAL
(3) Valid values: <$difficulty_descriptive_text_or_hex>
(3) Description:
Set the PoW difficulty (V19+ only)
You can either specify the value in hexadecimal
as per the normal node RPC
OR you can use a built-in value from nano-shell, one of:
weak, normal, strong, very_strong
Defaults to ffffffc000000000 or 'normal'
===========================================================
===========================================================
Function Name: work_peer_add
-----------------------------------------------------------
Description: Add a work peer to farm out the PoW
operations on the node.
-----------------------------------------------------------
RPC call(s) used: work_peer_add:address:port
-----------------------------------------------------------
Returns: Text (success) or empty on failure.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$work_peer_address>
(1) Description:
The work peer IP/host address
(2) Parameter is MANDATORY
(2) Valid values: <$work_peer_port>
(2) Description:
The work peer port number
===========================================================
===========================================================
Function Name: work_peer_add_rpc
-----------------------------------------------------------
Description: Add a work peer to farm out the PoW
operations on the node.
-----------------------------------------------------------
RPC call(s) used: work_peer_add:address:port
-----------------------------------------------------------
Returns: JSON from the node RPC.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$work_peer_address>
(1) Description:
The work peer IP/host address
(2) Parameter is MANDATORY
(2) Valid values: <$work_peer_port>
(2) Description:
The work peer port number
===========================================================
===========================================================
Function Name: work_peer_clear_all
-----------------------------------------------------------
Description: Clear the list of all work peers
configured on the node.
-----------------------------------------------------------
RPC call(s) used: work_peers_clear
-----------------------------------------------------------
Returns: Text (success) or empty on failure.
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: work_peer_list
-----------------------------------------------------------
Description: List all associated work peers. These
are peers that help perform PoW operations
(if configured)
-----------------------------------------------------------
RPC call(s) used: work_peers
-----------------------------------------------------------
DEPRECATED FUNCTION: Just wraps work_peers_rpc. May be removed in future version
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: work_peers_clear_rpc
-----------------------------------------------------------
Description: Clear the list of all work peers
configured on the node.
-----------------------------------------------------------
RPC call(s) used: work_peers_clear
-----------------------------------------------------------
Returns: JSON from the node RPC.
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: work_peers_rpc
-----------------------------------------------------------
Description: List all associated work peers. These
are peers that help perform PoW operations
(if configured)
-----------------------------------------------------------
RPC call(s) used: work_peers
-----------------------------------------------------------
Returns: JSON from the node RPC
-----------------------------------------------------------
Parameters:
===========================================================
===========================================================
Function Name: work_validate_rpc
-----------------------------------------------------------
Description: Validate the work associated with the given block hash
V19RC2+ will also show the work difficulty value.
-----------------------------------------------------------
RPC call(s) used: work_validate:work:hash:difficulty
-----------------------------------------------------------
Returns: JSON from the node RPC.
-----------------------------------------------------------
Parameters:
(1) Parameter is MANDATORY
(1) Valid values: <$work_value>
(1) Description:
The work signature hash to validate
(2) Parameter is MANDATORY
(2) Valid values: <$block_hash>
(2) Description:
The block hash to verify the work signature on
(3) Parameter is OPTIONAL
(3) Valid values: <$difficulty> (node V19+ only)
(3) Description:
The hexadecimal difficulty string to use as part of the
work validation. Optional param (if standard difficulty).
===========================================================