Announcing `libra`: a new command provided by libra-client project

The command libra is a new tool provided by latest libra-client version 0.5.x, which contains four subcommands account, transaction, wallet and ledger.

Here is some usage examples.

Leger Time Example

For example, using ‘ledger’ command to query the ledger start time and latest transaction time of testnet:

$ libra ledger time

You will get the json output like this:

{
    "start_time": "2019-10-17T06:34:50",
    "latest_time": "2019-10-17T14:02:41"
}

Wallet Example

To query the total balance of a wallet,

$ libra wallet balance <some mnemonic file of the wallet>

You will get the total balance and balance of every accounts in that wallet:

{
    "7af57a0c206fbcc846532f75f373b5d1db9333308dbc4673c5befbca5db60e2f": 123,
    "f1f48f56c4deea75f4393e832edef247547eb76e1cd498c27cc972073ec4dbde": 0,
    "total_balance": 123
}

Account Balance Example

To query the balance of some account by address,

$ libra account balance 000000000000000000000000000000000000000000000000000000000a550c18

You will get the balance of that address:

{
    "balance": 24075309756646968
}

The output of libra command is the standard json format. So, it can be integrated to any programming language easily.

More instructions can be found here:

2 Likes

Additional notes, libra will be installed using following command:

$ python3 -m pip install libra-client

And you can integrate libra with other command line tools. For Example, search the address of libra association and query it’s balance.

$ libra a config | jq .association_address | libra a balance

Hello,
trying to install libra-client, but the system message is:
ERROR: Could not find a version that satisfies the requirement libra-client (from versions: none)
ERROR: No matching distribution found for libra-client

Whats, wrong?
Python 3.5.2 and 3.6.9, pip 19.3 are installed.
Thanks in advance

Can you please provide details of the error messages?

Paste to this post, or feed back to the github issue. Python 3.6.9 and pip 19.3 should be able to work. Maybe you used some pip proxy which has bugs, for example:

python3 -m pip install venv
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting venv
ERROR: Could not find a version that satisfies the requirement venv (from versions: none)

Following command should fix this problem:

$ python3 -m pip install  --index-url https://pypi.org/project/ --user libra-client

The message is available on
https://1drv.ms/u/s!AtUXj588tml9hJtlbGuQtw7UyC_Kdg?e=xgnqSD

1 Like

Sorry, I can’t open the link. Maybe you can paste the error messages here.

Please install python3.6 and above, Then execute following command:

python3 -m pip install --index-url https://pypi.org/project/ --user libra-client

This command can ensure you that the python and pip version is correct.

python 3.6.9 is installed

it worked in my environment without any issue. Perhaps, your screenshot indicates that pip ver is still 8.

Have you checked pip3 version ?

Thanks very much, the installation is done.
But $ libra_shell doesn’t work, the message is “Not able to connect to validator at ac.testnet.libra.org:8000
What’s wrong?

Try uninstall and then reinstall with following commands:

python3 -m pip uninstall libra-client
python3 -m pip install --user --no-binary libra-client libra-client

or try install pysha3 after install libra-client:

python3 -m pip install --user pysha3

If it works, I will publish a new version to fix this installation problem.

Thank you very much,
Now it works well
These commands helped!
2