diff --git a/contracts/eoslib/eosc.dox b/contracts/eoslib/eosc.dox index 377159405e90d9d1e7d7fcbbd51b75db5cba4e93..c842c346c024ff946da3290fd3c885ec8a68d313 100644 --- a/contracts/eoslib/eosc.dox +++ b/contracts/eoslib/eosc.dox @@ -3,522 +3,708 @@ @defgroup eosc EOS Command Line Client (eosc) @brief Tool for sending transactions and querying state from @ref eosd + @section contents Table of Contents + + - [Introduction to EOSC](#intro) + - [Creating a Wallet](#createwallet) + - [Importing Key to Wallet](#importkey) + - [Locking and Unlocking Wallet](#lockwallet) + - [Opening Wallet](#openwallet) + - [Creating an Account](#createaccount) + - [Transfer EOS](#transfereos) + - [Getting Transaction](#gettingtransaction) + - [Creating a Contract](#createcontract) + - [Connecting to Particular Node](#particularnode) + - [Using Separate Wallet App](#separatewallet) + - [Skipping Signature](#skippingsignature) + - [Additional Documentation](#additionaldocumentation) + @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'. - As an easy way for developers to test functionality without dealing with keys, `eosd` can be run so that - Transaction signatures are not required. - ... - ./eosd --skip-transaction-signatures - ... + In order to sign transaction and push it to the blockchain, you will need to have the 'eos::wallet_api_plugin' + loaded. + And in order to query account history and transaction, you will need to have the 'eos::account_history_api_plugin' loaded. ``` # Plugin(s) to enable, may be specified multiple times plugin = eos::producer_plugin plugin = eos::chain_api_plugin + plugin = eos::wallet_api_plugin + plugin = eos::account_history_api_plugin ``` After starting `eosd` you should be able to query the current blockchain state like so: -``` -$ ./eosc get info -{ - "head_block_num": 25048, - "last_irreversible_block_num": 25027, - "head_block_id": "000061d8ae49d6af614e02779e19261959f22d6d9f37906ed5db2dabd88be142", - "head_block_time": "2017-07-25T17:44:48", - "head_block_producer": "initi", - "recent_slots": "1110000000000000000000000000000000000000000000000000000000000011", - "participation_rate": "0.07812500000000000" -} -``` - + ``` + $ ./eosc get info + { + "head_block_num": 25048, + "last_irreversible_block_num": 25027, + "head_block_id": "000061d8ae49d6af614e02779e19261959f22d6d9f37906ed5db2dabd88be142", + "head_block_time": "2017-07-25T17:44:48", + "head_block_producer": "initi", + "recent_slots": "1110000000000000000000000000000000000000000000000000000000000011", + "participation_rate": "0.07812500000000000" + } + ``` @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. + Any transaction sent to the blockchain will need to be signed by the respective authority's private key. + Before you will be able to sign the transaction, you will need a wallet to store and manage the private key. + ``` + $ ./eosc wallet create + Creating wallet: default + Save password to use in the future to unlock this wallet. + Without password imported keys will not be retrievable. + "PW5JD9cw9YY288AXPvnbwUk5JK4Cy6YyZ83wzHcshu8F2akU9rRWE" + ``` + This will create a wallet called 'default' inside `eos-walletd` and return a password that you can use to unlock your wallet in the future. -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`) -``` - ./eos-walletd --http-server-endpoint 127.0.0.1:8887 -``` -Then create a wallet inside `eos-walletd` using `eosc`: -``` -$ ./eosc --wallet-port 8887 wallet create -Creating wallet: default -Save password to use in the future to unlock this wallet. -Without password imported keys will not be retrievable. -"PW5JD9cw9YY288AXPvnbwUk5JK4Cy6YyZ83wzHcshu8F2akU9rRWE" -``` -This will create a wallet called 'default' inside `eos-walletd` and return a password that you can use to unlock your wallet in the future. -Note that, the wallet is going to be automatically locked after certain period of time. + You can create multiple wallets by specifying unique name + ``` + $ ./eosc wallet create -n second-wallet + Creating wallet: second-wallet + Save password to use in the future to unlock this wallet. + Without password imported keys will not be retrievable. + "PW5Ji6JUrLjhKAVn68nmacLxwhvtqUAV18J7iycZppsPKeoGGgBEw" + ``` + And you will be see it in the list of your wallets + ``` + $ ./eosc wallet list + Wallets: + [ + "default *", + "second-wallet *" + ] + ``` - @section createaccount Creating an Account + @note For any wallet operation, if you don't specify the name of the wallet, it will always resort to `default` wallet -In order to create an account you will need two new keys: owner and active. You can ask eosc to create some keys for you: - -This will be your owner key, -``` -$ ./eosc create key -public: EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq -private: 5JKbLfCXgcafDQVwHMm3shHt6iRWgrr9adcmt6vX3FNjAEtJGaT -``` - -And this will be your active key, -``` -$ ./eosc create key -public: EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA -private: 5Hv22aPcjnENBv6X9o9nKGdkfrW44En6z4zJUt2PobAvbQXrT9z -``` - -@note eosc does not save the generated private key. - -Next we will create the account `tester`, but because all accounts need to be created by an existing account we will ask the `inita` account -to create `tester` using the owner and active keys created above. `inita` was specified in the genesis file. - -In order to push transaction as `inita`, you first need to import inita's private key to your wallet -``` -$ ./eosc --wallet-port 8887 import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 -imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV -``` - -Then create an account called tester -``` -$ ./eosc --wallet-port 8887 create account inita tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA -{ - "transaction_id": "6acd2ece68c4b86c1fa209c3989235063384020781f2c67bbb80bc8d540ca120", - "processed": { - "refBlockNum": "25217", - "refBlockPrefix": "2095475630", - "expiration": "2017-07-25T17:54:55", - "scope": [ - "eos", - "inita" - ], - "signatures": [], - "messages": [{ - "code": "eos", - "type": "newaccount", - "authorization": [{ - "account": "inita", - "permission": "active" - } - ], - "data": "c9251a0000000000b44c5a2400000000010000000102bcca6347d828d4e1868b7dfa91692a16d5b20d0ee3d16a7ca2ddcc7f6dd03344010000010000000102bcca6347d828d4e1868b7dfa91692a16d5b20d0ee3d16a7ca2ddcc7f6dd03344010000010000000001c9251a000000000061d0640b000000000100010000000000000008454f5300000000" - } - ], - "output": [{ - "notify": [], - "sync_transactions": [], - "async_transactions": [] - } + @section importkey Importing Key to Wallet + + Import the key that you want to use to sign the transaction to your wallet. + The following will import key for genesis accounts (i.e. inita, initb, initc, ..., initu) + ``` + $ ./eosc wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 + imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV + ``` + You will then be able to see the list of imported private keys and their respective public key + ``` + $ ./eosc wallet keys + [[ + "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", + "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" ] + ] + ``` + + @section lockwallet Locking and Unlocking Wallet + + To keep your private key safe, lock your wallet + ``` + $ ./eosc wallet lock -n second-wallet + Locked: 'second-wallet' + ``` + Notice that the locked wallet doesn't have * symbol in the list + ``` + $ ./eosc wallet list + Wallets: + [ + "default *", + "second-wallet" + ] + ``` + To unlock it specify the password you get when creating the wallet + ``` + $ ./eosc wallet unlock -n second-wallet --password PW5Ji6JUrLjhKAVn68nmacLxwhvtqUAV18J7iycZppsPKeoGGgBEw + Unlocked: 'second-wallet' + ``` + + @section openwallet Opening Wallet + + All of the wallets data are store inside data_dir folder. + When you restart your wallet app (in this case `eosd`), you will need to open the wallet so `eosc` can have access to it. + ``` + $ ./eosc wallet list + Wallets: [] + $ ./eosc wallet open + Wallets: [ + "default" + ] + $ ./eosc wallet open -n second-wallet + Wallets: [ + "default", + "second-wallet" + ] + ``` + @note The wallet is locked by default + + @section createaccount Creating an Account + + In order to create an account you will need two new keys: owner and active. You can ask `eosc` to create some keys for you: + + This will be your owner key, + ``` + $ ./eosc create key + public: EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq + private: 5JKbLfCXgcafDQVwHMm3shHt6iRWgrr9adcmt6vX3FNjAEtJGaT + ``` + + And this will be your active key, + ``` + $ ./eosc create key + public: EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA + private: 5Hv22aPcjnENBv6X9o9nKGdkfrW44En6z4zJUt2PobAvbQXrT9z + ``` + + @note eosc does not save the generated private key. + + Next we will create the account `tester`, but because all accounts need to be created by an existing account we will ask the `inita` account + to create `tester` using the owner and active keys created above. `inita` was specified in the genesis file. + + In order to push transaction as `inita`, you first need to [import inita's private key to your wallet](#importkey) + + Then create an account called tester + ``` + $ ./eosc create account inita tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA + { + "transaction_id": "6acd2ece68c4b86c1fa209c3989235063384020781f2c67bbb80bc8d540ca120", + "processed": { + "refBlockNum": "25217", + "refBlockPrefix": "2095475630", + "expiration": "2017-07-25T17:54:55", + "scope": [ + "eos", + "inita" + ], + "signatures": [], + "messages": [{ + "code": "eos", + "type": "newaccount", + "authorization": [{ + "account": "inita", + "permission": "active" + } + ], + "data": "c9251a0000000000b44c5a2400000000010000000102bcca6347d828d4e1868b7dfa91692a16d5b20d0ee3d16a7ca2ddcc7f6dd03344010000010000000102bcca6347d828d4e1868b7dfa91692a16d5b20d0ee3d16a7ca2ddcc7f6dd03344010000010000000001c9251a000000000061d0640b000000000100010000000000000008454f5300000000" + } + ], + "output": [{ + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + ] + } } -} -``` -If you enable --skip-signing-transaction in `eosd`, you can also skip the transaction signing with -s option -``` -$ ./eosc create account inita tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA -s -``` -@note The rest of this tutorial signs every transaction, however, you can always opt to use `-s` option of `eosc` 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: - -``` -$ ./eosc get account tester -{ - "name": "tester", - "eos_balance": 0, - "staked_balance": 1, - "unstaking_balance": 0, - "last_unstaking_time": "1969-12-31T23:59:59", - "permissions": [{ - "name": "active", - "parent": "owner", - "required_auth": { - "threshold": 1, - "keys": [{ - "key": "EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA", - "weight": 1 - } - ], - "accounts": [] - } - },{ - "name": "owner", - "parent": "owner", - "required_auth": { - "threshold": 1, - "keys": [{ - "key": "EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq", - "weight": 1 - } - ], - "accounts": [] + After creating the account we can view the current account status like so: + + ``` + $ ./eosc get account tester + { + "name": "tester", + "eos_balance": 0, + "staked_balance": 1, + "unstaking_balance": 0, + "last_unstaking_time": "1969-12-31T23:59:59", + "permissions": [{ + "name": "active", + "parent": "owner", + "required_auth": { + "threshold": 1, + "keys": [{ + "key": "EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA", + "weight": 1 + } + ], + "accounts": [] + } + },{ + "name": "owner", + "parent": "owner", + "required_auth": { + "threshold": 1, + "keys": [{ + "key": "EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq", + "weight": 1 + } + ], + "accounts": [] + } } + ] + } + ``` + + You will note that there is no balance because almost all genesis EOS tokens are currently allocated to the `eos` account and genesis accounts. + + ``` + { + "name": "eos", + "eos_balance": "69000000.0000 EOS", + "staked_balance": "0.0000 EOS", + "unstaking_balance": "0.0000 EOS", + "last_unstaking_time": "1969-12-31T23:59:59", + "permissions": [] + } + ``` + + 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: + + ``` + $ ./eosc transfer inita tester 1000 + { + "transaction_id": "eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703", + "processed": { + "refBlockNum": 2206, + "refBlockPrefix": 221394282, + "expiration": "2017-09-05T08:03:58", + "scope": [ + "inita", + "tester" + ], + "signatures": [ + "1f22e64240e1e479eee6ccbbd79a29f1a6eb6020384b4cca1a958e7c708d3e562009ae6e60afac96f9a3b89d729a50cd5a7b5a7a647540ba1678831bf970e83312" + ], + "messages": [{ + "code": "eos", + "type": "transfer", + "authorization": [{ + "account": "inita", + "permission": "active" + } + ], + "data": { + "from": "inita", + "to": "tester", + "amount": 1000, + "memo": "" + }, + "hex_data": "000000008040934b00000000c84267a1e80300000000000000" + } + ], + "output": [{ + "notify": [{ + "name": "tester", + "output": { + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + },{ + "name": "inita", + "output": { + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + } + ], + "sync_transactions": [], + "async_transactions": [] + } + ] } - ] -} -``` - -You will note that there is no balance because almost all genesis EOS tokens are currently allocated to the `eos` account and genesis accounts. - -``` -{ - "name": "eos", - "eos_balance": "69000000.0000 EOS", - "staked_balance": "0.0000 EOS", - "unstaking_balance": "0.0000 EOS", - "last_unstaking_time": "1969-12-31T23:59:59", - "permissions": [] -} -``` - -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: - -``` -$ ./eosc transfer inita tester 1000 -{ - "transaction_id": "eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703", - "processed": { - "refBlockNum": 2206, - "refBlockPrefix": 221394282, - "expiration": "2017-09-05T08:03:58", - "scope": [ - "inita", - "tester" - ], - "signatures": [ - "1f22e64240e1e479eee6ccbbd79a29f1a6eb6020384b4cca1a958e7c708d3e562009ae6e60afac96f9a3b89d729a50cd5a7b5a7a647540ba1678831bf970e83312" - ], - "messages": [{ - "code": "eos", - "type": "transfer", - "authorization": [{ - "account": "inita", - "permission": "active" - } - ], - "data": { - "from": "inita", - "to": "tester", - "amount": 1000, - "memo": "" - }, - "hex_data": "000000008040934b00000000c84267a1e80300000000000000" - } - ], - "output": [{ - "notify": [{ - "name": "tester", - "output": { - "notify": [], - "sync_transactions": [], - "async_transactions": [] + } + + ``` + + Now we can verify that the funds were received. + + ``` + $ ./eosc get account tester + { + "name": "tester", + "eos_balance": "0.1000 EOS", + "staked_balance": "0.0001 EOS", + "unstaking_balance": "0.0000 EOS", + "last_unstaking_time": "1969-12-31T23:59:59", + "permissions": [{ + "name": "active", + "parent": "owner", + "required_auth": { + "threshold": 1, + "keys": [{ + "key": "EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA", + "weight": 1 } - },{ - "name": "inita", - "output": { - "notify": [], - "sync_transactions": [], - "async_transactions": [] + ], + "accounts": [] + } + },{ + "name": "owner", + "parent": "owner", + "required_auth": { + "threshold": 1, + "keys": [{ + "key": "EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq", + "weight": 1 } - } - ], - "sync_transactions": [], - "async_transactions": [] + ], + "accounts": [] + } } ] } -} - -``` - -Now we can verify that the funds were received. - -``` -$ ./eosc get account tester -{ - "name": "tester", - "eos_balance": "0.1000 EOS", - "staked_balance": "0.0001 EOS", - "unstaking_balance": "0.0000 EOS", - "last_unstaking_time": "1969-12-31T23:59:59", - "permissions": [{ - "name": "active", - "parent": "owner", - "required_auth": { - "threshold": 1, - "keys": [{ - "key": "EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA", - "weight": 1 - } - ], - "accounts": [] - } - },{ - "name": "owner", - "parent": "owner", - "required_auth": { - "threshold": 1, - "keys": [{ - "key": "EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq", - "weight": 1 - } - ], - "accounts": [] - } + ``` + + @section gettingtransaction Getting Transaction + + With account_history_api_plugin loaded in `eosd`, we can query for particular transaction + ``` + $ ./eosc get transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703 + { + "transaction_id": "eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703", + "processed": { + "refBlockNum": 2206, + "refBlockPrefix": 221394282, + "expiration": "2017-09-05T08:03:58", + "scope": [ + "inita", + "tester" + ], + "signatures": [ + "1f22e64240e1e479eee6ccbbd79a29f1a6eb6020384b4cca1a958e7c708d3e562009ae6e60afac96f9a3b89d729a50cd5a7b5a7a647540ba1678831bf970e83312" + ], + "messages": [{ + "code": "eos", + "type": "transfer", + "authorization": [{ + "account": "inita", + "permission": "active" + } + ], + "data": { + "from": "inita", + "to": "tester", + "amount": 1000, + "memo": "" + }, + "hex_data": "000000008040934b00000000c84267a1e80300000000000000" + } + ], + "output": [{ + "notify": [{ + "name": "tester", + "output": { + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + },{ + "name": "inita", + "output": { + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + } + ], + "sync_transactions": [], + "async_transactions": [] + } + ] } + } + ``` + Also we can query list of transactions performed by certain account starting from recent one + ``` + $ ./eosc get transactions inita + [ + { + "transaction_id": "eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703", + ... + }, + { + "transaction_id": "6acd2ece68c4b86c1fa209c3989235063384020781f2c67bbb80bc8d540ca120", + ... + }, + ... ] -} -``` - + ``` -@section createcontract Creating a Contract + @section createcontract Creating a Contract -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 `inita` account create the `currency` account. Ensure you have inita private key imported. -``` -$ ./eosc --wallet-port 8887 create account inita currency EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA -``` + ``` + $ ./eosc create account inita currency EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA + ``` -The next step is to publish the contract (.wast) and its abi (.abi). + The next step is to publish the contract (.wast) and its abi (.abi). -We will need currency active key in our wallet for this -``` -$ ./eosc --wallet-port 8887 import 5Hv22aPcjnENBv6X9o9nKGdkfrW44En6z4zJUt2PobAvbQXrT9z -imported private key for: EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA -``` -Then proceed with setting the code + We will need currency active key in our wallet for this + ``` + $ ./eosc import 5Hv22aPcjnENBv6X9o9nKGdkfrW44En6z4zJUt2PobAvbQXrT9z + imported private key for: EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA + ``` + Then proceed with setting the code -``` -$ ./eosc --wallet-port 8887 set contract currency ../../../contracts/currency/currency.wast ../../../contracts/currency/currency.abi -Reading WAST... -Assembling WASM... -Publishing contract... -{ - "transaction_id": "9990306e13f630a9c5436a5a0b6fb8fe2c7f3da2f342b4898a39c4a2c17dcdb3", - "processed": { - "refBlockNum": 1208, - "refBlockPrefix": 3058534156, - "expiration": "2017-08-24T18:29:52", - "scope": [ - "currency", - "eos" - ], - "signatures": [], - "messages": [{ - "code": "eos", - "type": "setcode", - "authorization": [{ - "account": "currency", - "permission": "active" - } - ], - "data": "00000079b822651d0000e8150061736d0100000001390a60017e0060037e7e7f017f60047e7e7f7f017f60017f0060057e7e7e7f7f017f60027f7f0060027f7f017f60027e7f0060000060027e7e00029d010a03656e7606617373657274000503656e76086c6f61645f693634000403656e76067072696e7469000003656e76067072696e746e000003656e76067072696e7473000303656e760b726561644d657373616765000603656e760a72656d6f76655f693634000103656e760b7265717569726541757468000003656e760d726571756972654e6f74696365000003656e760973746f72655f6936340002030706000007030809040401700000050301000107cc0107066d656d6f72790200205f5a4e33656f733133726571756972654e6f74696365454e535f344e616d6545000a1e5f5a4e33656f7331317265717569726541757468454e535f344e616d6545000b345f5a4e3863757272656e6379313273746f72654163636f756e74454e33656f73344e616d6545524b4e535f374163636f756e7445000c355f5a4e3863757272656e637932336170706c795f63757272656e63795f7472616e7366657245524b4e535f385472616e7366657245000d04696e6974000e056170706c79000f0a9d0d060600200010080b0600200010070b3400024020012903084200510d0020004280808080a8d7bee3082001411010091a0f0b20004280808080a8d7bee308200110061a0b8a0604017e027f047e017f4100410028020441206b2208360204200029030821052000290300210720002903102104411010042004100241c000100442808080c887d7c8b21d100341d00010042007100341e000100420051003200029030021052000290308100820051008200029030010072000290300210142002105423b210441f00021034200210603400240024002400240024020054206560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b420021052008420037031820082006370310200142808080c887d7c8b21d4280808080a8d7bee308200841106a411010011a200041086a2903002101423b210441f00021034200210603400240024002400240024020054206560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b2008200637030020084200370308200142808080c887d7c8b21d4280808080a8d7bee3082008411010011a200841186a2203290300200041106a22022903005a418001100020032003290300200229030022057d370300200520082903087c20055a41b00110002008200829030820022903007c370308200029030021050240024020032903004200510d0020054280808080a8d7bee308200841106a411010091a0c010b20054280808080a8d7bee308200841106a10061a0b200041086a290300210502400240200841086a2903004200510d0020054280808080a8d7bee3082008411010091a0c010b20054280808080a8d7bee308200810061a0b4100200841206a3602040b980303027f057e017f4100410028020441106b220736020442002103423b210241e00121014200210403400240024002400240024020034207560d0020012c00002200419f7f6a41ff017141194b0d01200041a0016a21000c020b420021052003420b580d020c030b200041ea016a41002000414f6a41ff01714105491b21000b2000ad42388642388721050b2005421f83200242ffffffff0f838621050b200141016a2101200342017c2103200520048421042002427b7c2202427a520d000b42002103423b210241f00021014200210603400240024002400240024020034206560d0020012c00002200419f7f6a41ff017141194b0d01200041a0016a21000c020b420021052003420b580d020c030b200041ea016a41002000414f6a41ff01714105491b21000b2000ad42388642388721050b2005421f83200242ffffffff0f838621050b200141016a2101200342017c2103200520068421062002427b7c2202427a520d000b2007428094ebdc033703082007200637030020044280808080a8d7bee3082007411010091a4100200741106a3602040bb10303027f047e017f4100410028020441206b220836020442002105423b210441e00121034200210603400240024002400240024020054207560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b024020062000520d0042002105423b210441f00121034200210603400240024002400240024020054207560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b20062001520d00200842003703102008420037030820084200370318200841086a4118100541174b4180021000200841086a100d0b4100200841206a3602040b0bff010b0041040b04200500000041100b2254686973206170706561727320746f2062652061207472616e73666572206f6620000041c0000b0220000041d0000b072066726f6d20000041e0000b0520746f20000041f0000b086163636f756e7400004180010b2c696e746567657220756e646572666c6f77207375627472616374696e6720746f6b656e2062616c616e6365000041b0010b26696e7465676572206f766572666c6f7720616464696e6720746f6b656e2062616c616e6365000041e0010b0963757272656e6379000041f0010b097472616e7366657200004180020b1e6d6573736167652073686f72746572207468616e2065787065637465640000fd02046e616d651006617373657274020000086c6f61645f693634050000000000067072696e74690100067072696e746e0100067072696e747301000b726561644d6573736167650200000a72656d6f76655f693634030000000b726571756972654175746801000d726571756972654e6f7469636501000973746f72655f6936340400000000205f5a4e33656f733133726571756972654e6f74696365454e535f344e616d65450101301e5f5a4e33656f7331317265717569726541757468454e535f344e616d6545010130345f5a4e3863757272656e6379313273746f72654163636f756e74454e33656f73344e616d6545524b4e535f374163636f756e74450201300131355f5a4e3863757272656e637932336170706c795f63757272656e63795f7472616e7366657245524b4e535f385472616e73666572450901300131013201330134013501360137013804696e69740801300131013201330134013501360137056170706c7909013001310132013301340135013601370138010b4163636f756e744e616d65044e616d6502087472616e7366657200030466726f6d0b4163636f756e744e616d6502746f0b4163636f756e744e616d65087175616e746974790655496e743634076163636f756e740002036b65790655496e7436340762616c616e63650655496e74363401000000b298e982a4087472616e736665720100000080bafac608076163636f756e74" - } - ], - "output": [{ - "notify": [], - "sync_transactions": [], - "async_transactions": [] - } - ] - } -} -``` - -After the contract is published it initially allocates all of the currency to the `currency` account. So lets transfer some of it to our tester. - -``` -$ ./eosc --wallet-port 8887 push message currency transfer '{"from":"currency","to":"tester","amount":50}' -S currency -S tester -p currency@active -1589302ms thread-0 main.cpp:271 operator() ] Converting argument to binary... -1589304ms thread-0 main.cpp:290 operator() ] Transaction result: -{ - "transaction_id": "1c4911c0b277566dce4217edbbca0f688f7bdef761ed445ff31b31f286720057", - "processed": { - "refBlockNum": 1173, - "refBlockPrefix": 2184027244, - "expiration": "2017-08-24T18:28:07", - "scope": [ - "currency", - "tester" - ], - "signatures": [], - "messages": [{ - "code": "currency", - "type": "transfer", - "authorization": [{ - "account": "currency", - "permission": "active" - } - ], - "data": { - "from": "currency", - "to": "tester", - "quantity": 50 - }, - "hex_data": "00000079b822651d00000000c84267a13200000000000000" - } - ], - "output": [{ - "notify": [{ - "name": "tester", - "output": { - "notify": [], - "sync_transactions": [], - "async_transactions": [] + ``` + $ ./eosc set contract currency ../../../contracts/currency/currency.wast ../../../contracts/currency/currency.abi + Reading WAST... + Assembling WASM... + Publishing contract... + { + "transaction_id": "9990306e13f630a9c5436a5a0b6fb8fe2c7f3da2f342b4898a39c4a2c17dcdb3", + "processed": { + "refBlockNum": 1208, + "refBlockPrefix": 3058534156, + "expiration": "2017-08-24T18:29:52", + "scope": [ + "currency", + "eos" + ], + "signatures": [], + "messages": [{ + "code": "eos", + "type": "setcode", + "authorization": [{ + "account": "currency", + "permission": "active" } - } - ], - "sync_transactions": [], - "async_transactions": [] - } - ] + ], + "data": "00000079b822651d0000e8150061736d0100000001390a60017e0060037e7e7f017f60047e7e7f7f017f60017f0060057e7e7e7f7f017f60027f7f0060027f7f017f60027e7f0060000060027e7e00029d010a03656e7606617373657274000503656e76086c6f61645f693634000403656e76067072696e7469000003656e76067072696e746e000003656e76067072696e7473000303656e760b726561644d657373616765000603656e760a72656d6f76655f693634000103656e760b7265717569726541757468000003656e760d726571756972654e6f74696365000003656e760973746f72655f6936340002030706000007030809040401700000050301000107cc0107066d656d6f72790200205f5a4e33656f733133726571756972654e6f74696365454e535f344e616d6545000a1e5f5a4e33656f7331317265717569726541757468454e535f344e616d6545000b345f5a4e3863757272656e6379313273746f72654163636f756e74454e33656f73344e616d6545524b4e535f374163636f756e7445000c355f5a4e3863757272656e637932336170706c795f63757272656e63795f7472616e7366657245524b4e535f385472616e7366657245000d04696e6974000e056170706c79000f0a9d0d060600200010080b0600200010070b3400024020012903084200510d0020004280808080a8d7bee3082001411010091a0f0b20004280808080a8d7bee308200110061a0b8a0604017e027f047e017f4100410028020441206b2208360204200029030821052000290300210720002903102104411010042004100241c000100442808080c887d7c8b21d100341d00010042007100341e000100420051003200029030021052000290308100820051008200029030010072000290300210142002105423b210441f00021034200210603400240024002400240024020054206560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b420021052008420037031820082006370310200142808080c887d7c8b21d4280808080a8d7bee308200841106a411010011a200041086a2903002101423b210441f00021034200210603400240024002400240024020054206560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b2008200637030020084200370308200142808080c887d7c8b21d4280808080a8d7bee3082008411010011a200841186a2203290300200041106a22022903005a418001100020032003290300200229030022057d370300200520082903087c20055a41b00110002008200829030820022903007c370308200029030021050240024020032903004200510d0020054280808080a8d7bee308200841106a411010091a0c010b20054280808080a8d7bee308200841106a10061a0b200041086a290300210502400240200841086a2903004200510d0020054280808080a8d7bee3082008411010091a0c010b20054280808080a8d7bee308200810061a0b4100200841206a3602040b980303027f057e017f4100410028020441106b220736020442002103423b210241e00121014200210403400240024002400240024020034207560d0020012c00002200419f7f6a41ff017141194b0d01200041a0016a21000c020b420021052003420b580d020c030b200041ea016a41002000414f6a41ff01714105491b21000b2000ad42388642388721050b2005421f83200242ffffffff0f838621050b200141016a2101200342017c2103200520048421042002427b7c2202427a520d000b42002103423b210241f00021014200210603400240024002400240024020034206560d0020012c00002200419f7f6a41ff017141194b0d01200041a0016a21000c020b420021052003420b580d020c030b200041ea016a41002000414f6a41ff01714105491b21000b2000ad42388642388721050b2005421f83200242ffffffff0f838621050b200141016a2101200342017c2103200520068421062002427b7c2202427a520d000b2007428094ebdc033703082007200637030020044280808080a8d7bee3082007411010091a4100200741106a3602040bb10303027f047e017f4100410028020441206b220836020442002105423b210441e00121034200210603400240024002400240024020054207560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b024020062000520d0042002105423b210441f00121034200210603400240024002400240024020054207560d0020032c00002202419f7f6a41ff017141194b0d01200241a0016a21020c020b420021072005420b580d020c030b200241ea016a41002002414f6a41ff01714105491b21020b2002ad42388642388721070b2007421f83200442ffffffff0f838621070b200341016a2103200542017c2105200720068421062004427b7c2204427a520d000b20062001520d00200842003703102008420037030820084200370318200841086a4118100541174b4180021000200841086a100d0b4100200841206a3602040b0bff010b0041040b04200500000041100b2254686973206170706561727320746f2062652061207472616e73666572206f6620000041c0000b0220000041d0000b072066726f6d20000041e0000b0520746f20000041f0000b086163636f756e7400004180010b2c696e746567657220756e646572666c6f77207375627472616374696e6720746f6b656e2062616c616e6365000041b0010b26696e7465676572206f766572666c6f7720616464696e6720746f6b656e2062616c616e6365000041e0010b0963757272656e6379000041f0010b097472616e7366657200004180020b1e6d6573736167652073686f72746572207468616e2065787065637465640000fd02046e616d651006617373657274020000086c6f61645f693634050000000000067072696e74690100067072696e746e0100067072696e747301000b726561644d6573736167650200000a72656d6f76655f693634030000000b726571756972654175746801000d726571756972654e6f7469636501000973746f72655f6936340400000000205f5a4e33656f733133726571756972654e6f74696365454e535f344e616d65450101301e5f5a4e33656f7331317265717569726541757468454e535f344e616d6545010130345f5a4e3863757272656e6379313273746f72654163636f756e74454e33656f73344e616d6545524b4e535f374163636f756e74450201300131355f5a4e3863757272656e637932336170706c795f63757272656e63795f7472616e7366657245524b4e535f385472616e73666572450901300131013201330134013501360137013804696e69740801300131013201330134013501360137056170706c7909013001310132013301340135013601370138010b4163636f756e744e616d65044e616d6502087472616e7366657200030466726f6d0b4163636f756e744e616d6502746f0b4163636f756e744e616d65087175616e746974790655496e743634076163636f756e740002036b65790655496e7436340762616c616e63650655496e74363401000000b298e982a4087472616e736665720100000080bafac608076163636f756e74" + } + ], + "output": [{ + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + ] + } } -} -``` -We can check the balance of `tester` inside its scope, and see it has balance of 50 -``` - ./eosc get table tester currency account - { - "rows": [{ - "account": "account", - "balance": 50 + ``` + + After the contract is published it initially allocates all of the currency to the `currency` account. So lets transfer some of it to our tester. + + ``` + $ ./eosc push message currency transfer '{"from":"currency","to":"tester","amount":50}' -S currency -S tester -p currency@active + 1589302ms thread-0 main.cpp:271 operator() ] Converting argument to binary... + 1589304ms thread-0 main.cpp:290 operator() ] Transaction result: + { + "transaction_id": "1c4911c0b277566dce4217edbbca0f688f7bdef761ed445ff31b31f286720057", + "processed": { + "refBlockNum": 1173, + "refBlockPrefix": 2184027244, + "expiration": "2017-08-24T18:28:07", + "scope": [ + "currency", + "tester" + ], + "signatures": [], + "messages": [{ + "code": "currency", + "type": "transfer", + "authorization": [{ + "account": "currency", + "permission": "active" + } + ], + "data": { + "from": "currency", + "to": "tester", + "quantity": 50 + }, + "hex_data": "00000079b822651d00000000c84267a13200000000000000" + } + ], + "output": [{ + "notify": [{ + "name": "tester", + "output": { + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + } + ], + "sync_transactions": [], + "async_transactions": [] + } + ] } - ], - "more": true -} -``` - -Now we can transfer it from `tester` to `inita` and require the permission of `tester`. This should drain the balance of `tester` to 0. - -``` -$ ./eosc --wallet-port 8887 push message currency transfer '{"from":"tester","to":"inita","amount":50}' -S inita -S tester -p tester@active -3116153ms thread-0 main.cpp:271 operator() ] Converting argument to binary... -3116154ms thread-0 main.cpp:290 operator() ] Transaction result: -{ - "transaction_id": "56b9f0f3b9f43254af446c5dca02a6fcb24ebcdb506d7248947fd4d52a27972a", - "processed": { - "refBlockNum": 2882, - "refBlockPrefix": 1880685856, - "expiration": "2017-08-24T19:53:34", - "scope": [ - "inita", - "tester" - ], - "signatures": [], - "messages": [{ - "code": "currency", - "type": "transfer", - "authorization": [{ - "account": "tester", - "permission": "active" - } - ], - "data": { - "from": "tester", - "to": "inita", - "quantity": 50 - }, - "hex_data": "00000000c84267a1000000008040934b3200000000000000" + } + ``` + We can check the balance of `tester` inside its scope, and see it has balance of 50 + ``` + ./eosc get table tester currency account + { + "rows": [{ + "account": "account", + "balance": 50 } ], - "output": [{ - "notify": [{ - "name": "inita", - "output": { - "notify": [], - "sync_transactions": [], - "async_transactions": [] + "more": true + } + ``` + + Now we can transfer it from `tester` to `inita` and require the permission of `tester`. This should drain the balance of `tester` to 0. + + ``` + $ ./eosc push message currency transfer '{"from":"tester","to":"inita","amount":50}' -S inita -S tester -p tester@active + 3116153ms thread-0 main.cpp:271 operator() ] Converting argument to binary... + 3116154ms thread-0 main.cpp:290 operator() ] Transaction result: + { + "transaction_id": "56b9f0f3b9f43254af446c5dca02a6fcb24ebcdb506d7248947fd4d52a27972a", + "processed": { + "refBlockNum": 2882, + "refBlockPrefix": 1880685856, + "expiration": "2017-08-24T19:53:34", + "scope": [ + "inita", + "tester" + ], + "signatures": [], + "messages": [{ + "code": "currency", + "type": "transfer", + "authorization": [{ + "account": "tester", + "permission": "active" } - },{ - "name": "tester", - "output": { - "notify": [], - "sync_transactions": [], - "async_transactions": [] + ], + "data": { + "from": "tester", + "to": "inita", + "quantity": 50 + }, + "hex_data": "00000000c84267a1000000008040934b3200000000000000" + } + ], + "output": [{ + "notify": [{ + "name": "inita", + "output": { + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } + },{ + "name": "tester", + "output": { + "notify": [], + "sync_transactions": [], + "async_transactions": [] + } } - } - ], - "sync_transactions": [], - "async_transactions": [] - } - ] + ], + "sync_transactions": [], + "async_transactions": [] + } + ] + } } -} -``` + ``` + + Now that `tester` has a balance of 0, if we attempt this transfer a second time it should fail: + + ``` + $ ./eosc push message currency transfer '{"from":"tester","to":"inita","amount":50}' -S inita -S tester -p tester@active + 3543610ms thread-0 main.cpp:271 operator() ] Converting argument to binary... + 3543615ms thread-0 main.cpp:311 main ] Failed with error: 10 assert_exception: Assert Exception + status_code == 200: Error + : 10 assert_exception: Assert Exception + test: assertion failed: integer underflow subtracting token balance + {"s":"integer underflow subtracting token balance","ptr":176} + thread-1 wasm_interface.cpp:248 assertnonei32i32 + + [...snipped...] + ``` -Now that `tester` has a balance of 0, if we attempt this transfer a second time it should fail: + @section particularnode Connecting to Particular Node -``` -$ ./eosc --wallet-port 8887 push message currency transfer '{"from":"tester","to":"inita","amount":50}' -S inita -S tester -p tester@active -3543610ms thread-0 main.cpp:271 operator() ] Converting argument to binary... -3543615ms thread-0 main.cpp:311 main ] Failed with error: 10 assert_exception: Assert Exception -status_code == 200: Error -: 10 assert_exception: Assert Exception -test: assertion failed: integer underflow subtracting token balance - {"s":"integer underflow subtracting token balance","ptr":176} - thread-1 wasm_interface.cpp:248 assertnonei32i32 + By default, `eosc` will connect to `eosd` running on localhost port 8888. You can connect to another `eosd` node by specifying its host and port. + ``` + ./eosc -H localhost -p 8889 + ``` + + @section separatewallet Using Separate Wallet App + + Instead of using the wallet functionality built-in to `eosd`, you can also use a separate wallet app which can be found inside programs/eos-walletd. + By default, port 8888 is used by `eosd`, so choose another port for the wallet app. + ``` + ./eos-walletd --http-server-endpoint 127.0.0.1:8887 + ``` + Then for any operation that requires signing, use the --wallet-host and --wallet-port option + ``` + ./eosc --wallet-host 127.0.0.1 --wallet-port 8887 + ``` + + + @section skippingsignature Skipping Signatures + + As an easy way for developers to test functionality without dealing with keys, `eosd` can be run so that + Transaction signatures are not required. + ``` + ./eosd --skip-transaction-signatures + ``` + And then for any operation that requires signing, use the `-s` option + ``` + ./eosc -s + ``` -[...snipped...] -``` @section additionaldoc Additional Documentation -eosc contains documentation for all of its commands. For a list of all commands known to eosc, simply run it with no arguments: -``` -$ ./eosc -ERROR: RequiredError: Subcommand required -Command Line Interface to Eos Daemon -Usage: ./eosc [OPTIONS] SUBCOMMAND - -Options: - -h,--help Print this help message and exit - -H,--host TEXT=localhost the host where eosd is running - -p,--port UINT=8888 the port where eosd is running - --wallet-host TEXT=localhost - the host where eos-walletd is running - --wallet-port UINT=8888 the port where eos-walletd is running - -Subcommands: - create Create various items, on and off the blockchain - get Retrieve various items and information from the blockchain - set Set or update blockchain state - transfer Transfer EOS from account to account - wallet Interact with local wallet - benchmark Configure and execute benchmarks - push Push arbitrary transactions 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 contains documentation for all of its commands. For a list of all commands known to eosc, simply run it with no arguments: + ``` + $ ./eosc + ERROR: RequiredError: Subcommand required + Command Line Interface to Eos Daemon + Usage: ./eosc [OPTIONS] SUBCOMMAND + + Options: + -h,--help Print this help message and exit + -H,--host TEXT=localhost the host where eosd is running + -p,--port UINT=8888 the port where eosd is running + --wallet-host TEXT=localhost + the host where eos-walletd is running + --wallet-port UINT=8888 the port where eos-walletd is running + + Subcommands: + create Create various items, on and off the blockchain + get Retrieve various items and information from the blockchain + set Set or update blockchain state + transfer Transfer EOS from account to account + wallet Interact with local wallet + benchmark Configure and execute benchmarks + push Push arbitrary transactions 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 + ``` */