cordite-cli
v0.5.4
Published
a command line tool for accessing a Corda node running cordite cordapps or braid
Downloads
29
Maintainers
Readme
Cordite CLI
Contents
Simple installation
npm install -g cordite-cli
Build
To build from a clean clone:
npm install
npm run build
Binaries will be placed in the respective folders under the target directory.
To clean the output:
npm run clean
Parameters
The parameters can be listed using cordite --help
.
node cordite.js --help
Cordite
Client to connect to braid-enabled Corda nodes
Options
--help print this usage guide
-u, --url string connection <protocol>://<host>:<port>
-s, --strictSSL enable or disable strict SSL checks
-c, --credentials string credentials payload
-f, --script string script file to be executed
example:
cordite https://myhost.com:8081 --credentials '{ "username": "admin", "password": "admin"}' --strictSSL
The url can be passed as the only non-flagged parameter.
Startup
Assuming you are in the directory with the binary for your OS
./cordite https://apac-test.cordite.foundation
You can also run the cordite client in a non-interactive mode by passing in a reference to a script file using the -f
flag.
cordite -f myscript.js http://localhost:8083
The script can use ES6 async/await calls.
Here's an example of a script:
console.log(notaries);
const notary = notaries.notaryService.name;
try {
await ledger.createAccount("fuzz", notary);
} catch (err) {
console.log(err.message);
}
const accounts = await ledger.listAccounts();
console.log(`accounts: ${JSON.stringify(accounts, null, 2)}`);
Shutdown
Either type .exit
or press ctrl-c
twice.
API
The CLI automatically creates top-level constants for each of the services available.
The following constants are presently available:
corda
- top-level proxy to the corda nodeledger
- the asset ledgerdao
- the service for managing decentralised autonomous organistaionsmetering
- the service responsible for metering of transactionsnetwork
- the Corda networkflows
- access to the raw Corda flows framework
You can discover what methods are available on each by typing the constant name and pressing enter.
You can also discover the documentation on a given method by invoking the docs()
method on the method!
e.g.
ledger.createAccount.docs()
Record a Demo
- Install Asciinema
- Install AsciiCast2Gif (suggest
npm install -g asciicast2gif
) - Ensure you have an up-to-date version of
screen
(e.g.brew install screen
) - Startup a server somewhere. This guide assumes you have started this using
io/cordite/SimpleStandaloneNetwork.kt
- Open a terminal window. Make sure it is going to be large enough for your demo. Resizing mid-demo is not recommended!
- Run:
asciinema rec ~/tmp/recording.json
- Either:
- Single node:
./target/osx-x64/cordite [<url>]
- Multi node:
screen -c cordite-screen.rc
- To tab between each screen-split using
ctrl-a <Tab>
- To tab between each screen-split using
- Single node:
- When done with your demo, exit from
cordite
using eitherctrl-c ctrl-c
or entering the.exit
command - Press
ctrl-d
to finish theasciinema
recording - Generate the gif using:
asciicast2gif -t solarized-light ~/tmp/recording.json ~/tmp/output.gif
- Publish your gif here:
https://gitlab.com/cordite/cordite/wikis/cli-demos
- Broadcast the gif to your network and become famous!