Skip to content

Tutorial

Jun Yan edited this page Jun 26, 2019 · 1 revision

Summary

This page includes a tutorial on how to interact with the OneLedger Chronos testnet.

Main Instructions

OneLedger is a full blockchain that supports cross-chain functionality and smart contracts. For instructions on how to set up, start and stop a node please see our OneLedger Chronos Setup Instructions.

Create an Account

Create a new local account for the node. The public and private keys are automatically generated by the node and are stored locally there.

$ olclient update --account {LocalAccountName}

List Accounts

List all of the accounts on a given node, and all of the global identities that have been properly registered with the chain.

$ olclient list

Request Tokens

Send an email request to chronos@oneledger.io to ask for tokens. An automated faucet will be added later

Register an Identity

Register an identity globally on the chain. These identities should like to an account, so that any transactions against them can be processed properly.

$ olclient register --identity {GlobalIdentity} --account {LocalAccountName} --node {MyNodeName} --fee 0.1

Send Tokens

An account or an identity can send tokens to another account or identity on the chain. For the party it can be account name, identity name or account key (in hex). For the counterparty it can be a global identity or the account key (in hex). The request must be sent to a node that has access to the local account for signing.

$ olclient send --party {id|account} --counterparty {id|account} --amount {amount} --currency OLT --fee 0.1

Check the Logs

For health checks it may be necessary to check the log files. There are 3 basics for files for any given node:

  • General olfullnode logging information
  • Tendermint consensus logging
  • OLVM smart contract execution logging
$ cd $OLROOT
$ more olfullnode.log
$ more consensus.log
$ more olvm.log

Install a Script

Smart contracts can be installed globally on the chain. Once installed, they can be executed by any account.

$ olclient install --owner {OwnerName} --name {ScriptName} --version {v0.0.1} --fee 0.1

Execute a Script

To execute a smart contract on the blockchain.

$ olclient execute --owner {OwnerName} --name {Test} --version {v0.0.1} --fee 0.1 --gas 100

Perform a Swap

Issue a swap between two parties and two chains. For this to work, both parties need to have both respective chain nodes setup. Both parties have to issue the same swap, with the same parameters so that the chain will match them and start the processing.

$ olclient swap --party {PartyName} --counterparty {CounterPartyName} --nonce 28 --amount 10.0 --currency {BTC} --exchange 30.2 --excurrency {ETH} --fee 0.1 --gas 100
You can’t perform that action at this time.