100%

Commands

Commands

HcNet-core can be controlled via the following commands.

Common options

Common options can be placed at any place in the command line.

  • –conf : Specify a config file to use. You can use ‘-’ and provide the config file via STDIN. default ‘HcNet-core.cfg’
  • –ll : Set the log level. It is redundant with http-command ll but we need this form if you want to change the log level during test runs.
  • –metric : Report metric METRIC on exit. Used for gathering a metric cumulatively during a test run.
  • –help : Show help message for given command.

Command line options

Command options can only by placed after command.

  • catchup < DESTINATION-LEDGER/LEDGER-COUNT>: Perform catchup from history archives without connecting to network. This option will catchup to DESTINATION-LEDGER keeping history from DESTINATION-LEDGER-LEDGER-COUNT or from the last closed ledger (whichever value is biggest).
  • check-quorum : Check quorum intersection from history to ensure there is closure over all the validators in the network.
  • convert-id : Will output the passed ID in all known forms and then exit. Useful for determining the public key that corresponds to a given private key. For example:

    $ HcNet-core convert-id

    SDQVDISRYN2JXBS7ICL7QJAEKB3HWBJFP2QECXG7GZICAHBK4UNJCWK2

  • dump-xdr : Dumps the given XDR file and then exits.
  • force-FBA : This command is used to start a network from scratch or when a network has lost quorum because of failed nodes or otherwise. It sets a flag in the database. The next time HcNet-core is run, HcNet-core will start emitting FBAmessages based on its last known ledger. Without this flag HcNet-core waits to hear a ledger close from the network before starting FBA.

    force-FBAdoesn’t change the requirements for quorum so although this node will emit FBAmessages FBAwon’t complete until there are also a quorum of other nodes also emitting FBAmessages on this same ledger. Value of force-FBAcan be reset with --reset flag.

  • fuzz : Run a single fuzz input and exit.
  • gen-fuzz : Generate a random fuzzer input file.
  • gen-seed : Generate and print a random public/private key and then exit.
  • help : Print the available command line options and then exit…
  • http-command : Send an HTTP command to an already running local instance of HcNet-core and then exit. For example:

    $ HcNet-core http-command info

  • infer-quorum : Print a potential quorum set inferred from history.
  • gen-fuzz : Load an XDR bucket file, for testing.
  • new-db : Clears the local database and resets it to the genesis ledger. If you connect to the network after that it will catch up from scratch.
  • new-hist … : Initialize the named history archives HISTORY-LABEL. HISTORY-LABEL should be one of the history archives you have specified in the HcNet-core.cfg. This will write a

    .well-known/aurora-history.json file in the archive root.

  • offline-info : Returns an output similar to --c info for an offline instance
  • print-xdr : Pretty-print a binary file containing an XDR object. If FILE-NAME is “-”, the XDR object is read from standard input.

    Option --filetype [auto|ledgerheader|meta|result|resultpair|tx|txfee]** controls type used for printing (default: auto).

    Option --base64 alters the behavior to work on base64-encoded XDR rather than raw XDR.

  • publish : Execute publish of all items remaining in publish queue without connecting to network. May not publish last checkpoint if last closed ledger is on checkpoint boundary.
  • report-last-history-checkpoint : Download and report last history checkpoint from a history archive.
  • run : Runs HcNet-core service..
  • sec-to-pub : Reads a secret key on standard input and outputs the corresponding public key. Both keys are in Hashcash’s standard base-32 ASCII format.
  • sign-transaction : Add a digital signature to a transaction envelope stored in binary format in , and send the result to standard output (which should be redirected to a file or piped through a tool such as base64). The private signing key is read from standard input, unless is “-” in which case the transaction envelope is read from standard input and the signing key is read from /dev/tty. In either event, if the signing key appears to be coming from a terminal, HcNet-core disables echo. Note that if you do not have aHc_Net_ID environment variable, then before this argument you must specify the --netid option.

    Option --base64 alters the behavior to work on base64-encoded XDR rather than raw XDR.

  • test : Run all the unit tests.
    • Suboptions specific to HcNet-core:
      • --all-versions : run with all possible protocol versions
      • --version <N> : run tests for protocol version N, can be specified multiple times (default latest)
      • --base-instance <N> run tests with instance numbers offset by N, used to run tests in parallel
    • For further info on possible options for test.
    • For example this will run just the tests tagged with [tx] using protocol versions 9 and 10 and stop after the first failure:

      HcNet-core --test -a --version 9 --version 10

      "[tx]"

  • version : Print version info and then exit.
  • write-quorum : Print a quorum set graph from history.

Operational requirements:

  • secret key management (used for signing messages on the network)
  • a database

HTTP Commands

By default HcNet-core listens for connections from localhost on port 11626. You can send commands to HcNet-core via a web browser, curl, or using the --c command line option (see above). Most commands return their results in JSON format.

  • help Prints a list of currently supported commands.
  • catchup /catchup?ledger=NNN[&mode=MODE]

    Triggers the instance to catch up to ledger NNN from history; Mode is either ‘minimal’ (the default, if omitted) or ‘complete’.

  • checkdb Triggers the instance to perform a background check of the database’s state.
  • checkpoint Triggers the instance to write an immediate history checkpoint. And uploads it to the archive
  • connect /connect?peer=NAME&port=NNN

    Triggers the instance to connect to peer NAME at port NNN.

  • dropcursor

    /dropcursor?id=XYZ

    deletes the tracking cursor with identified by id. See setcursor for more information.

  • info Returns information about the server in JSON format (sync state, connected peers, etc).
  • ll

    /ll?level=L[&partition=P]

    Adjust the log level for partition P where P is one of Bucket, Database, Fs, Herder, History, Ledger, Overlay, Process, FBA, Tx (or all if no partition is specified). Level is one of FATAL, ERROR, WARNING, INFO, DEBUG, VERBOSE, TRACE.

  • maintenance /maintenance?[queue=true]
  • Performs maintenance tasks on the instance.
    • queue performs deletion of queue data. See setcursor for more information.
  • metrics Returns a snapshot of the metrics registry (for monitoring and debugging purpose).
  • clearmetrics /clearmetrics?[domain=DOMAIN]

    Clear metrics for a specified domain. If no domain specified, clear all metrics (for testing purposes).

  • peers Returns the list of known peers in JSON format.
  • quorum /quorum?[node=NODE_ID][&compact=true]

    returns information about the quorum for node NODE_ID (this node by default). NODE_ID is either a full key (GABCD...), an alias ($name) or an abbreviated ID (@GABCD). If compact is set, only returns a summary version.

  • setcursor /setcursor?id=ID&cursor=N

    sets or creates a cursor identified by ID with value N. ID is an uppercase AlphaNum, N is an uint32 that represents the last ledger sequence number that the instance ID processed. Cursors are used by dependent services to tell HcNet-core which data can be safely deleted by the instance. The data is historical data stored in the SQL tables such as txhistory or ledgerheaders. When all consumers processed the data for ledger sequence N the data can be safely removed by the instance. The actual deletion is performed by invoking the maintenanceendpoint or on startup. See also dropcursor.

  • getcursor /getcursor?[id=ID]

    gets the cursor identified by ID. If ID is not defined then all cursors will be returned.

  • FBA /FBA?[limit=n]
  • Returns a JSON object with the internal state of the FBAengine for the last n (default 2) ledgers.

  • tx /tx?blob=Base64
  • submit a transaction to the network. blob is a base64 encoded XDR serialized ‘TransactionEnvelope’, and it returns a JSON object with the following properties status:
    • “PENDING” - transaction is being considered by consensus
    • “DUPLICATE” - transaction is already PENDING
    • “ERROR” - transaction rejected by transaction engine error: set when status is “ERROR”. Base64 encoded, XDR serialized ‘TransactionResult’
  • upgrades
    • /upgrades?mode=get

      retrieves the currently configured upgrade settings

    • /upgrades?mode=clear

      clears any upgrade settings

    • /upgrades?mode=set&upgradetime=DATETIME&[basefee=NUM]&[basereserve=NUM]&[maxtxsize=NUM]&[protocolversion=NUM]
      • upgradetime is a required date (UTC) in the form 1970-01-01T00:00:00Z. It is the time the upgrade will be scheduled for. If it is in the past, the upgrade will occur immediately.
      • fee (uint32) This is what you would prefer the base fee to be. It is in jots
      • basereserve (uint32) This is what you would prefer the base reserve to be. It is in jots.
      • maxtxsize (uint32) This defines the maximum number of transactions to include in a ledger. When too many transactions are pending, surge pricing is applied. The instance picks the top maxtxsize transactions locally to be considered in the next ledger. Where transactions are ordered by transaction fee(lower fee transactions are held for later).
      • protocolversion (uint32) defines the protocol version to upgrade to. When specified it must match one of the protocol versions supported by the node and should be greater than ledgerVersion from the current ledger

The following HTTP commands are exposed on test instances

  • generateload

    /generateload[?mode=(create|pay)&accounts=N&offset=K&txs=M&txrate=(R|auto)&batchsize=L]

  • Artificially generate load for testing; must be used withARTIFICIALLY_GENERATE_LOAD_FOR_TESTING set to true. Depending on the mode, either creates new accounts or generates payments on accounts specified (where number of accounts can be offset). Additionally, allows batching up to 100 account creations per transaction via ‘batchsize’.
  • manualclose If MANUAL_CLOSE is set to true in the .cfg file. This will cause the current ledger to close.
  • testacc /testacc?name=N
  • Returns basic information about the account identified by name. Note that N is a string used as seed, but “root” can be used as well to specify the root account used for the test instance.
  • testtx /testtx?from=F&to=T&amount=N&[create=true]
  • Injects a payment transaction (or a create transaction if “create” is specified) from the account F to the account T, sending N HCXto the account. Note that F and T are seed strings but can also be specified as “root” as shorthand for the root account for the test instance.

+
Chat Now
Welcome to HashCash Support