Command Line Interface

bigchaindb.commands.bigchaindb

Implementation of the bigchaindb command, the command-line interface (CLI) for BigchainDB Server.

bigchaindb.commands.bigchaindb.run_show_config(args)[source]

Show the current configuration

bigchaindb.commands.bigchaindb.run_configure(args)[source]

Run a script to configure the current node.

bigchaindb.commands.bigchaindb.run_election(args)[source]

Initiate and manage elections

bigchaindb.commands.bigchaindb.run_election_new_upsert_validator(args, bigchain)[source]

Initiates an election to add/update/remove a validator to an existing BigchainDB network

Parameters:
  • args – dict args = { ‘public_key’: the public key of the proposed peer, (str) ‘power’: the proposed validator power for the new peer, (str) ‘node_id’: the node_id of the new peer (str) ‘sk’: the path to the private key of the node calling the election (str) }
  • bigchain – an instance of BigchainDB
Returns:

election_id or False in case of failure

bigchaindb.commands.bigchaindb.run_election_new_chain_migration(args, bigchain)[source]

Initiates an election to halt block production

Parameters:
  • args – dict args = { ‘sk’: the path to the private key of the node calling the election (str) }
  • bigchain – an instance of BigchainDB
Returns:

election_id or False in case of failure

bigchaindb.commands.bigchaindb.run_election_approve(args, bigchain)[source]

Approve an election

Parameters:
  • args – dict args = { ‘election_id’: the election_id of the election (str) ‘sk’: the path to the private key of the signer (str) }
  • bigchain – an instance of BigchainDB
Returns:

success log message or False in case of error

bigchaindb.commands.bigchaindb.run_election_show(args, bigchain)[source]

Retrieves information about an election

Parameters:
  • args – dict args = { ‘election_id’: the transaction_id for an election (str) }
  • bigchain – an instance of BigchainDB
bigchaindb.commands.bigchaindb.run_init(args)[source]

Initialize the database

bigchaindb.commands.bigchaindb.run_drop(args)[source]

Drop the database

bigchaindb.commands.bigchaindb.run_start(args)[source]

Start the processes to run the node

bigchaindb.commands.bigchaindb.run_tendermint_version(args)[source]

Show the supported Tendermint version(s)

bigchaindb.commands.utils

Utility functions and basic common arguments for argparse.ArgumentParser.

bigchaindb.commands.utils.configure_bigchaindb(command)[source]

Decorator to be used by command line functions, such that the configuration of bigchaindb is performed before the execution of the command.

Parameters:command – The command to decorate.
Returns:The command wrapper function.
bigchaindb.commands.utils.input_on_stderr(prompt='', default=None, convert=None)[source]

Output a string to stderr and wait for input.

Parameters:
  • prompt (str) – the message to display.
  • default – the default value to return if the user leaves the field empty
  • convert (callable) – a callable to be used to convert the value the user inserted. If None, the type of default will be used.
bigchaindb.commands.utils.start(parser, argv, scope)[source]

Utility function to execute a subcommand.

The function will look up in the scope if there is a function called run_<parser.args.command> and will run it using parser.args as first positional argument.

Parameters:
  • parser – an ArgumentParser instance.
  • argv – the list of command line arguments without the script name.
  • scope (dict) – map containing (eventually) the functions to be called.
Raises:

NotImplementedError – if scope doesn’t contain a function called run_<parser.args.command>.