TODAKit CLI



The TODA CLI is designed to allow hands-on exploration, debugging, and development of TODA files for power users and application engineers. It strives to follow the POSIX philosophy of defaulting to standard input/output streams, with flags to provide other backends and input or storage facilities. The CLI is being rapidly expanded to become the default development console of the TODA ecosystem, suitable for use within system operations, cron jobs, and other batch processes.

Setup

  1. 1. Run
    npm install
  2. 2. Run
    npm install
    in the
    togo
    and
    toda
    directories
  3. 3. TODAkit CLI can be run using
    toda COMMAND
    when added to your PATH (or
    ./toda
    in its directory otherwise)

Quickstart

Run
toda create NULL | toda history
to generate a simple file pipe its TODA-formatted output to the history tool.

$ toda create NULL | ./toda history
twist		4146cba7b11a637e876bd8bc5de1a68fd6cf16b59b46d8cbde2405d41728a833ae
tether		00
reqs		00
sats		41dd929f6a579a7c95e6ae6b8d3367dbb53b7425818e94b02edbb8ed1abd2ff7f5
rigging		00
shield		00
prev		00
cargo		00
    
Adding
--json
to the
history
command will format results in JSON:
$ toda create --require 4166278f9f242a9752255237a46117248f8f716ecc554735e40c3638474d8dc057 --rigging 411c3436751e30e42043b29c4aa9f969d681b03c3273322a798aa68af152450124 --shield 417eeb707d0ac1b74e84ccd029024484f118985636727c5b3aab95e97f80fbab73 --tether 41bddef16b2f8862c1913e5a607d18fdc24b616af0ace55c63f41868d0a2414972 NULL | ./toda history --json
[
    {
        twist: '4182e6cf32a36d87d25b75eb38f507654321940a0e2512326c80d5a286d5b10083',
        tether: '41bddef16b2f8862c1913e5a607d18fdc24b616af0ace55c63f41868d0a2414972',
        reqs: '4166278f9f242a9752255237a46117248f8f716ecc554735e40c3638474d8dc057',
        sats: '412ab9e0a410685a2ae80917dccd1d2be3e642e345963d07dd1736a00857378d90',
        rigging: '411c3436751e30e42043b29c4aa9f969d681b03c3273322a798aa68af152450124',
        shield: '417eeb707d0ac1b74e84ccd029024484f118985636727c5b3aab95e97f80fbab73',
        prev: '00',
        cargo: '00'
    }
]

Keys

A secp256r1 keypair is generated upon first use and stored PEM-encoded in
~/.toda/secure/secp256r1
and
~/.toda/secure/secp256r1.pub
with permissions of 0600. Flags will provide additional flexibility around multi-key and multi-signature key management.

Storage

Default storage for the CLI is the TODA flat-file disk backend, in
~/.toda/store
. This is suitable for development, however production services will require one of the indexed stores available from TODAQ.

Usage

$ toda COMMAND [--version, -v] [-i] [-h] [--out FILENAME] [--verbose] [--test] [--json] [--help]


Options to all CLI commands

-v, --version

Display the current version.

-i

Override the default identity file to use

-h

Display sizes in a human-readable format

--out FILENAME

Specifies the output file path. Defaults to
~/.toda/store/HASH.toda`


--verbose

Display additional logging output

--test

Dry Run. Doesn't create the file, just outputs raw bytes to the console

--json

Specifies the output format should be json

--help

Display the help text

Commands

append

$ toda append [--require REQ_SPEC] [--rigging RIG_SPEC] [--shield SHIELD_SPEC] [--tether TETHER_SPEC] --prev PREV_TWIST {CARGO_SOURCE|NULL}

Creates a new
*.toda
file with the specified PREV and outputs the file bytes. Defaults to
~/.toda/store/HASH.toda
.

eg.
$ toda append --tether 413c3208685e11c907e307feefb399ec4d7dc68c2f --prev 41fc9f5eb249400705724d97f2041a0e887f0ee5d9 NULL

create

$ toda create [--require REQ_SPEC] [--rigging RIG_SPEC] [--shield SHIELD_SPEC] [--tether TETHER_SPEC] {CARGO_SOURCE|NULL}

Creates a new
*.toda
file with the specified hashes and outputs the file bytes. Defaults to
~/.toda/store/HASH.toda
.

eg.
$ toda create --tether 41015b9c3a0ff856f29358110b78c2189f65f60114 NULL

history

$ toda history FILE_SOURCE

Displays the details of this file and each of its PREV twists.

eg.
$ toda history ~/.toda/store/4146cba7b11a637e876bd8bc5de1a68fd6cf16b59b46d8cbde2405d41728a833ae.toda
twist		4146cba7b11a637e876bd8bc5de1a68fd6cf16b59b46d8cbde2405d41728a833ae
tether		00
reqs		00
sats		41dd929f6a579a7c95e6ae6b8d3367dbb53b7425818e94b02edbb8ed1abd2ff7f5
rigging		00
shield		00
prev		00
cargo		4100b15ce7d42877f0d861a1c44def21a2bb4f17336ae47d317734fd1e4614d4e1
    
$ toda history --json <~/.toda/store/4146cba7b11a637e876bd8bc5de1a68fd6cf16b59b46d8cbde2405d41728a833ae.toda
[
    {
        twist: “4146cba7b11a637e876bd8bc5de1a68fd6cf16b59b46d8cbde2405d41728a833ae”,
        tether: “00”,
        reqs: "00",
        sats: "41dd929f6a579a7c95e6ae6b8d3367dbb53b7425818e94b02edbb8ed1abd2ff7f5",
        rigging: "00",
        shield: "00",
        prec: "00",
        cargo: “4100b15ce7d42877f0d861a1c44def21a2bb4f17336ae47d317734fd1e4614d4e1”
    }
]
    

inspect

$ toda inspect HASH FILE_SOURCE [--json]

Displays the details of the packet associated with the specified hash in the file.

eg.
$ toda inspect --json 4166278f9f242a9752255237a46117248f8f716ecc554735e40c3638474d8dc057 <~/.toda/store/41e6a26e2e37b721941cf450c96c95da2b91dbf9800faf50c6b3e660ab35078d9c.toda
type		Pair Trie Packet
length		91872
content		41004da6b978acf8b17cdbe6baf7ef5c344c0ad503840665bb43a8918551ea5fee	416f349e24a69b7149a0f1f211a7800378f18f5085c61021f3ad3ed0d42a97d786
		4100b15ce7d42877f0d861a1c44def21a2bb4f17336ae47d317734fd1e4614d4e1	4101a1d46d534c43e8cfbd12266d5c7bc6000b37b14cb4f545961187d78df106c2
		41010da7af1c64ee241fbe21abff6bfbe2b41222c777daabdf4e591828ea17809e	412f9d3ca7f218221aec6eec33910e7c9a08cacf121d8e5832b0caeefef9bc365b
		4101614f420c0eedd7cc586aeda7c11f9c2409a7eb293b86f94602f0d28b7431d9	41024b2518f40f6d028af922012968dfd465b3af0c494bd0c38468a0b53aa9c12b
		41025d1e84cd7babce6322408515df1bc9c83f9faf960f42347e9cac965bd45bed	41762698a158430360c367aef9d7d9fd650d8e8eca6896e076043d2845b98fcd9b
		4109bb088fe1a2a276dba9f8012afd7679b130643cea7ac0982118a488e1320287	415a7d59f442ccb93812edb651a5900cd9e18a068285cd8ab1d2dc6e79cd4c8260
		410a698aa0695b79a015ba470e5e2254e043e1bbbc4148409d9bb559d05291ffce	416489c2e43b221739e833a9e1ae3bb73c7d2121c6549f23d3f6d967c1faab2162
		410caf22673aca34f0a7efaae69c94261cb07ed91adfda3a6bdfd2e4b13ced290c	4116f092437c2ae06391e2105a439646ddff4ed0e411e5ff6d7d77583dc368a038
		...
		(and 166 more)
    
$ toda inspect --json 411c3436751e30e42043b29c4aa9f969d681b03c3273322a798aa68af152450124 <~/.toda/store/41e6a26e2e37b721941cf450c96c95da2b91dbf9800faf50c6b3e660ab35078d9c.toda
{
  type: 'Hash Packet',
  length: 99,
  content: [
    '4123eb127b3caf920d3dd72f834b35b73e5b8bda870b0d7147838d182b5a9dd789',
    '410a5d17d3b19f82f8340d3977609aa9e86b4ad8b9bd71bd9eced9271f1d5b2e4a',
    '41d0b00c77c1f851ea4553a62e87f4c740357e1e6fe14b60dcabfbd3acf1d34018'
  ]
}
    

list

$ toda list [DIRECTORY]

Lists all twists found in
*.toda
files in the specified directory. Defaults to
~/.toda/source


eg.
$ toda list [DIRECTORY]
41403074e3b2c72cc00962aa87b614cdcb532ea2cb4841fd1a5afd33f80e0cc84c
4147699aee17b44e582d22f73047345fefd9b00ee298611f2d1d2e11cfcf19d1e8