cql

command
v0.0.0-...-020e20f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

This doc introduces the usage of CQL command line client cql. cql is a command line interface for batch scripting used for creating, querying, updating, and deleting the SQLChain and database adhere to the SQLChain.

Generating Default Config File

You need to provide a config and a master key for initialization. The master key is used to encrypt/decrypt local key pair. If you generate a config file with cql generate config, you can find the config file in the directory ~/.cql.

$ cql generate config
Enter master key(press Enter for default: ""):
⏎
Private key file: private.key
Public key's hex: 03bc9e90e3301a2f5ae52bfa1f9e033cde81b6b6e7188b11831562bf5847bff4c0

The ~/.cql/private.key is your encrypted private key file, and the pubkey hex is your public key's hex.

Generate Wallet Address from existing Key

$ cql wallet
Enter master key(default: ""):
⏎
wallet address: 4jXvNvPHKNPU8Sncz5u5F5WSGcgXmzC1g8RuAXTCJzLsbF9Dsf9
$ cql generate -config ~/.cql/config.yaml wallet
Enter master key(default: ""):
⏎
wallet address: 4jXvNvPHKNPU8Sncz5u5F5WSGcgXmzC1g8RuAXTCJzLsbF9Dsf9

You can generate your wallet address for test net according to your private key(default ~/.cql/private).

Check balance

Use cql to check your wallet balance:

$ cql wallet -balance all
INFO[0000] 
### Public Key ###
0388954cf083bb6bb2b9c7248849b57c76326296fcc0d69764fc61eedb5b8d820c
### Public Key ###
  caller="privatekeystore.go:116 crypto/kms.InitLocalKeyPair"
INFO[0000] stable coin balance is: 100                   caller="main.go:246 main.main"
INFO[0000] covenant coin balance is: 0                   caller="main.go:247 main.main"

Here, I got "stable coin balance is: 100".

Initialize a CQL cql

After you prepare your master key and config file, CQL cql can be initialized by: You can get a database id when create a new SQL Chain:

# if a non-default password applied on master key, use `-password` to pass it
$ cql create '{"node":1}'
INFO[0000]
### Public Key ###
039bc931161383c994ab9b81e95ddc1494b0efeb1cb735bb91e1043a1d6b98ebfd
### Public Key ###
  caller="privatekeystore.go:116 crypto/kms.InitLocalKeyPair"
INFO[0000] the newly created database is: cql://0e9103318821b027f35b96c4fd5562683543276b72c488966d616bfe0fe4d213  caller="main.go:297 main.main"

Here, create '{"node":1}' refers that there is only one node in SQL Chain.

$ cql console -dsn cql://address

address is database id.

Show the complete usage of cql:

$ cql help

Use the cql

Free to use the cql now:

co:address=> show tables;

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL