@brief Tool for sending transactions and querying state from @ref eosd
@brief Tool for sending transactions and querying state from @ref eosd
@section intro Introduction to EOSC
`eosc` is a command line tool that interfaces with the REST api exposed by @ref eosd. In order to use `eosc` you will need to
have a local copy of `eosd` running and configured to load the 'eos::chain_api_plugin'.
...
...
@@ -35,9 +35,30 @@ $ ./eosc get info
}
```
@section createwallet Creating a Wallet
In order to push transaction to the blockchain (without --skip-transaction-signatures enabled on `eosd`), you will need a wallet that store your private key.
EOS Wallet application can be found inside programs/eos-walletd. Let's first start eos-walletd on port 8887 (since port 8888 is used by `eosd`)
@note The rest of this tutorial signs every transaction, however, you can always opt to use ``./eosc -s` if you want to skip transaction signing (with --skip-transaction-signature enabled on `eosd`)
@section transfereos Transfer EOS
After creating the account we can view the current account status like so:
You will note that there is no balance because almost all genesis EOS tokens are currently allocated to the `eos` account.
You will note that there is no balance because almost all genesis EOS tokens are currently allocated to the `eos` account and genesis accounts.
```
$ ./eosc get account eos
{
"name": "eos",
"eos_balance": "8999999999998100",
"staked_balance": 0,
"unstaking_balance": 0,
"eos_balance": "69000000.0000 EOS",
"staked_balance": "0.0000 EOS",
"unstaking_balance": "0.0000 EOS",
"last_unstaking_time": "1969-12-31T23:59:59",
"abi": {
"types": [{
"newTypeName": "AccountName",
"type": "Name"
}
],
"structs": [{
"name": "transfer",
"base": "",
"fields": {
"from": "AccountName",
"to": "AccountName",
"amount": "UInt64"
}
}
],
"actions": [{
"action": "transfer",
"type": "transfer"
}
],
"tables": []
}
"permissions": []
}
```
@note The `eos` account happens to have an ABI (Application Binary Interface) defined which provides meta-data to tools that want to interface with the `eos` contract.
We can fund our `tester` account via `eosc` with the following command:
Since we have the private key of the genesis accounts (i.e. inita, initb, initc, etc) in the wallet.
We can fund our `tester` account via `eosc` through any of the genesis account with the following command:
In this section we will use `eosc` to create and publish a currency contract. You can find the example currency contract in the `eos/contracts/currency` directory.
In this section we will use `eosc` to create and publish a currency contract. You can find the example currency contract in the `eos/contracts/currency` directory.
The first step is to create an account for currency. We will have the `inita` account create the `currency` account.
The first step is to create an account for currency. We will have the `tester` account create the `currency` account.
eosc contains documentation for all of its commands. For a list of all commands known to eosc, simply run it with no arguments:
We can check the balance of `tester` inside its scope, and see it has balance of 50
```
$ ./eosc
ERROR: RequiredError: Subcommand required
Command Line Interface to Eos Daemon
Usage: ./eosc [OPTIONS] SUBCOMMAND
Options:
-h,--help Print this help message and exit
Subcommands:
create Create various items, on and off the blockchain
get Retrieve various items and information from the blockchain
contract Create or update the contract on an account
transfer Transfer EOS from account to account
push Push arbitrary data to the blockchain
```
To get help with any particular subcommand, run it with no arguments as well:
```
$ ./eosc create
ERROR: RequiredError: Subcommand required
Create various items, on and off the blockchain
Usage: ./eosc create SUBCOMMAND
Subcommands:
key Create a new keypair and print the public and private keys
account Create a new account on the blockchain
$ ./eosc create account
ERROR: RequiredError: creator
Create a new account on the blockchain
Usage: ./eosc create account creator name OwnerKey ActiveKey
Positionals:
creator TEXT The name of the account creating the new account
name TEXT The name of the new account
OwnerKey TEXT The owner public key for the account
ActiveKey TEXT The active public key for the account
./eosc get table tester currency account
{
"rows": [{
"account": "account",
"balance": 50
}
],
"more": true
}
```
@note at this time the blockchain is not validating signatures so anyone can do anything provided if they simply declare the proper authority. In the future the declared authorities will direct the wallet on which keys to use to sign the transaction. Also future revisions of this API may automatically detect `scope` and `authorization` via a trial run of the contract.
Now we can transfer it from `tester` to `inita` and require the permission of `tester`. This should drain the balance of `tester` to 0.