Console

Synopsis

Uplink provides a console interface (in addition to the RPC interface) that can be used to issue transactions and inspect the state of the ledger. The console runs as a separate process, so an Uplink node must (currently) be running on the same machine as the console program.

Running the Console

After booting an Uplink node as described here. run the following command to start an interactive console to the ledger:

$ uplink console

Console Commands

Available Commands:
discover:
force discovery of new peers
listPeers:
list peers
reconnect:
reconnect
ping:
ping all peers
pingPeer <node>:
ping a specific peer eg. pingPeer 127.0.1.1
addPeer <node>:
discover a peer eg. addPeer 143.245.35.1
listAccounts:
print all acccounts
listAssets:
print all assets
listContracts:
print all contracts
createAccount <private key path>:
create account eg. createAccount key.priv
createAsset <name> <supply> <ref (optional)> <type>:
create an asset eg. createAsset “USD” 1000 USD Discrete
createContract <fcl source path>:
create contract eg. createContract examples/zcb.s
transferAsset <asset address> <recipient address> <amount>:
transfer asset holdings
circulateAsset <address> <amount>:
circulate asset holdings
callContract:
call contract
transaction <path of json transaction header>:
submit a transaction eg. transaction tests/testTxHeader.json
help:
display this message
setAccount <optional path to account dir to use:
set active account transactions are submitted from eg setAccount or setAccount alice
quit:
exit the console

Console CLI

Usage: uplink console [-h|--hostname HOST] [-p|--port PORT]
  Connect to a node and issue transactions.

  Available options:
    -h,--help                Show this help text
    -h,--hostname HOST       Specify hostname
    -p,--port PORT           Override the port on which the node should
                             listen for P2P. Default 8001

Example Usage

>>> createAsset "USD" 1000 Discrete
Would you like to use an existing account (y/n) ? y
Please provide the directory containing the account you wish to use: config/validators/auth0
Active account: F8XUEiSUDKRhG6Srfft7zB4n8KWEZ6G3YnRg3F5MetVU
{
    "signature": "AE05ODcyMzAxMDMzNDMxNTEwOTEyMzMwNTc5Njg1NDYyNDQzNjA0NTgwNDY0NTUyMzY0NjYxMDU3MDg1MjYyMDA4MjYxMDE2OTU4NjYzMjoATTkzMTU1MjU2MTg1MzYxMjE1MDM0NTQwODc5ODI4Njg0ODE4MzI2NjI5NjA5NjgyMzg0NjQyMTgyODEwMzQyNDYyMDg0NjM1MzU5MzYx",
    "origin": "F8XUEiSUDKRhG6Srfft7zB4n8KWEZ6G3YnRg3F5MetVU",
    "header": {
        "tag": "TxAsset",
        "contents": {
            "tag": "CreateAsset",
            "contents": {
                "supply": 1000,
                "reference": null,
                "assetAddr": "55PnSRWWGC94Xktz5aizUv1bEiiUYVPhNfyqNCmdKSrK",
                "assetName": "\"USD\"",
                "assetType": {
                    "tag": "Discrete",
                    "contents": null
                }
            }
        }
    },
    "timestamp": 1513353446383367
}
Continue? (y/n) : y
Transaction submitted
Success
>>> circulateAsset 55PnSRWWGC94Xktz5aizUv1bEiiUYVPhNfyqNCmdKSrK 1000
{
    "signature": "AE0zMTQ2MjM4MDIyNjY2MzE0MDMwNjc2MTgzMzQ2MzQ0MzQ3NTM2NjcyNDY4MTE1MTMyNDg0OTQ1ODE0NDYxMDA0MjQwMjY2NzA1OTIzMToATTY0OTMwMDQ5NTYwMTc3MTg2MzQ1MjkyNDcxMjU1NDk2NDc5MjEzODc0MDM3MTg4MTUzMzU3NTgwMjM0NzY5OTkxMTQwNzMxMzYwMzQ0",
    "origin": "F8XUEiSUDKRhG6Srfft7zB4n8KWEZ6G3YnRg3F5MetVU",
    "header": {
        "tag": "TxAsset",
        "contents": {
            "tag": "Circulate",
            "contents": {
                "amount": 1000,
                "assetAddr": "55PnSRWWGC94Xktz5aizUv1bEiiUYVPhNfyqNCmdKSrK"
            }
        }
    },
    "timestamp": 1513353486118991
}
Continue? (y/n) : y
Transaction submitted
Success
>>> transferAsset 55PnSRWWGC94Xktz5aizUv1bEiiUYVPhNfyqNCmdKSrK H8L7BGsbLZVkCytBC35SA6FesTP1Y1b8neydvVQ4FY7h 500
{
    "signature": "AE0zMzY0NjEwNTQ3NTAwNTIzNTE5MTE2Njg2Mzk2MTc5ODc2NDc3OTg1MzkyOTI1NTkxMDE0MDI1OTk2OTEyNzg4OTkwNjkxNzAzODczNDoATTEyMjE1MzMxNjEyMTkxMjYwNjM3NjE1ODE4NTQzNzQzODEyMDg4ODAwNjY0ODAwMjAyNDI1NDY4NTM4NjM3NTQ3MTA3NjYxNjc0MjM4",
    "origin": "F8XUEiSUDKRhG6Srfft7zB4n8KWEZ6G3YnRg3F5MetVU",
    "header": {
        "tag": "TxAsset",
        "contents": {
            "tag": "Transfer",
            "contents": {
                "toAddr": "H8L7BGsbLZVkCytBC35SA6FesTP1Y1b8neydvVQ4FY7h",
                "assetAddr": "55PnSRWWGC94Xktz5aizUv1bEiiUYVPhNfyqNCmdKSrK",
                "balance": 500
            }
        }
    },
    "timestamp": 1513353543214594
}
Continue? (y/n) : y
Transaction submitted
Success
>>> listAssets
[
    {
        "holdings": {
            "H8L7BGsbLZVkCytBC35SA6FesTP1Y1b8neydvVQ4FY7h": 500,
            "F8XUEiSUDKRhG6Srfft7zB4n8KWEZ6G3YnRg3F5MetVU": 500
        },
        "issuedOn": 1513353446383367,
        "supply": 0,
        "reference": null,
        "address": "55PnSRWWGC94Xktz5aizUv1bEiiUYVPhNfyqNCmdKSrK",
        "name": "\"USD\"",
        "assetType": {
            "tag": "Discrete",
            "contents": null
        },
        "issuer": "F8XUEiSUDKRhG6Srfft7zB4n8KWEZ6G3YnRg3F5MetVU"
    }
]