chainlib-eth

Ethereum implementation of the chainlib interface
Log | Files | Refs | README | LICENSE

commit b59eebe181b50a6467047b669e760900f7c5d5a2
parent 2f906037a968a78c6d357b8395198523e3c34be3
Author: lash <dev@holbrook.no>
Date:   Fri, 25 Feb 2022 11:07:18 +0000

Add remaining man pages

Diffstat:
MMakefile | 5+++++
Mchainlib/eth/runnable/count.py | 2+-
Mchainlib/eth/runnable/flags.py | 6++++++
Mchainlib/eth/runnable/raw.py | 1+
Aman/eth-balance.head.groff | 16++++++++++++++++
Aman/eth-balance.overrides | 1+
Aman/eth-checksum.custom.groff | 7+++++++
Aman/eth-checksum.head.groff | 11+++++++++++
Aman/eth-count.head.groff | 15+++++++++++++++
Aman/eth-count.overrides | 1+
Mman/eth-gas.examples.groff | 8++++----
Mman/eth-get.head.groff | 10++++++----
Aman/eth-raw.examples.groff | 8++++++++
Aman/eth-raw.head.groff | 26++++++++++++++++++++++++++
Aman/eth-raw.seealso.groff | 4++++
Aman/eth-wait.head.groff | 17+++++++++++++++++
Aman/eth-wait.overrides | 2++
17 files changed, 131 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile @@ -7,5 +7,10 @@ man: chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py info` -v -n eth-info -d $(BUILD_DIR)/ man chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py get` -v -n eth-get -d $(BUILD_DIR)/ man chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py decode` -v -n eth-decode -d $(BUILD_DIR)/ man + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py encode` -v -n eth-encode -d $(BUILD_DIR)/ man + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py count` -v -n eth-count -d $(BUILD_DIR)/ man + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py raw` -v -n eth-raw -d $(BUILD_DIR)/ man + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py wait` -v -n eth-wait -d $(BUILD_DIR)/ man + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py balance` -v -n eth-balance -d $(BUILD_DIR)/ man .PHONY: man diff --git a/chainlib/eth/runnable/count.py b/chainlib/eth/runnable/count.py @@ -25,7 +25,7 @@ logg = logging.getLogger() script_dir = os.path.dirname(os.path.realpath(__file__)) config_dir = os.path.join(script_dir, '..', 'data', 'config') -arg_flags = chainlib.eth.cli.argflag_std_read +arg_flags = chainlib.eth.cli.argflag_std_base_read | chainlib.eth.cli.Flag.WALLET argparser = chainlib.eth.cli.ArgumentParser(arg_flags) argparser.add_positional('address', type=str, help='Ethereum address of recipient') args = argparser.parse_args() diff --git a/chainlib/eth/runnable/flags.py b/chainlib/eth/runnable/flags.py @@ -10,6 +10,12 @@ cmds = { 'info': chainlib.eth.cli.argflag_reset(chainlib.cli.argflag_std_base_read, chainlib.eth.cli.Flag.CHAIN_SPEC), 'get': chainlib.eth.cli.argflag_reset(chainlib.cli.argflag_std_base_read, chainlib.eth.cli.Flag.CHAIN_SPEC), 'decode': chainlib.cli.argflag_std_base | chainlib.eth.cli.Flag.CHAIN_SPEC, + 'encode': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC | chainlib.eth.cli.Flag.FEE | chainlib.eth.cli.Flag.FMT_HUMAN | chainlib.eth.cli.Flag.FMT_WIRE | chainlib.eth.cli.Flag.FMT_RPC, + 'count': chainlib.eth.cli.argflag_std_base_read | chainlib.eth.cli.Flag.WALLET, + 'raw': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC, + 'balance': chainlib.eth.cli.argflag_std_base | chainlib.eth.cli.Flag.WALLET, + 'wait': chainlib.eth.cli.argflag_reset(chainlib.eth.cli.argflag_std_base_read | chainlib.eth.cli.Flag.NO_TARGET | chainlib.eth.cli.Flag.RPC_AUTH, chainlib.eth.cli.Flag.CHAIN_SPEC | chainlib.eth.cli.Flag.RAW), + 'checksum': 0, } if __name__ == '__main__': diff --git a/chainlib/eth/runnable/raw.py b/chainlib/eth/runnable/raw.py @@ -51,6 +51,7 @@ config_dir = os.path.join(script_dir, '..', 'data', 'config') arg_flags = chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.EXEC argparser = chainlib.eth.cli.ArgumentParser(arg_flags) argparser.add_argument('--deploy', action='store_true', help='Deploy data as contract') +argparser.add_argument('--mode', choices=['tx', 'call'], type=str, help='Mode of operation') argparser.add_positional('data', type=str, help='Transaction data') args = argparser.parse_args() config = chainlib.eth.cli.Config.from_args(args, arg_flags, default_config_dir=config_dir) diff --git a/man/eth-balance.head.groff b/man/eth-balance.head.groff @@ -0,0 +1,16 @@ +.TH eth-balance 1 + +.SH NAME +eth-balance \- Get network gas token balance for an address + +.SH SYNOPSIS +\fBeth-balance\fP [ -p \fIrpc_provider\fP ] \fIaddress\fP + +.SH DESCRIPTION +.P +Query the network for the gas token balance of an account. +.P +The balance will be returned as an integer value denominated in the gas unit. + + +.SS OPTION diff --git a/man/eth-balance.overrides b/man/eth-balance.overrides @@ -0,0 +1 @@ +a Address to get balance for. -a, --address diff --git a/man/eth-checksum.custom.groff b/man/eth-checksum.custom.groff @@ -0,0 +1,7 @@ +.SH ABOUT THE CHECKSUM +.P +Checksum protection may be used as protection against address typos. +.P +It uses the value of the address itself as input to an algorithm, which results in altering the case of the letters in the hexadecimal address. +.P +A checksum address consisting of only numbers will always pass checksum. diff --git a/man/eth-checksum.head.groff b/man/eth-checksum.head.groff @@ -0,0 +1,11 @@ +.TH eth-checksum 1 + +.SH NAME +eth-checksum \- Calculate checksum address + +.SH SYNOPSIS +\fBeth-checksum\fP \fIaddress\fP + +.SH DESCRIPTION +.P +Converts \fIaddress\fP into a checksum-protected address. diff --git a/man/eth-count.head.groff b/man/eth-count.head.groff @@ -0,0 +1,15 @@ +.TH eth-count 1 + +.SH NAME +eth-count \- Get transaction count for an address + +.SH SYNOPSIS +\fBeth-count\fP [ -p \fIrpc_provider\fP ] \fIaddress\fP + + +.SH DESCRIPTION +.P +Query the network for the number of transactions known for an account. The result can be used as the \fInonce\fP value for a consecutive transaction. + + +.SS OPTIONS diff --git a/man/eth-count.overrides b/man/eth-count.overrides @@ -0,0 +1 @@ +a Address to count transactions for. -a, --address diff --git a/man/eth-gas.examples.groff b/man/eth-gas.examples.groff @@ -4,7 +4,7 @@ In the follwing we willconsaider transactions signed by the private key for addr .SS Offline transaction .EX -$ PYTHONPATH=. python chainlib/eth/runnable/gas.py -y <\fIkey_file_path\fP> -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 1024 +$ eth-gas -y <\fIkey_file_path\fP> -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 1024 from: Eb3907eCad74a0013c259D5874AE7f22DcBcC95C to: 00000000000000000000000000000000DeaDBeef nonce: 42 @@ -25,7 +25,7 @@ src: 0xf8662a85174876e8008252089400000000000000000000000000000000deadbeef8204008 .SS Offline transaction with arbitrary data .EX -$ PYTHONPATH=. python chainlib/eth/runnable/gas.py -y <\fIkey_file_path\fP> -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 --data 0x2a 1024 +$ eth-gas -y <\fIkey_file_path\fP> -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 --data 0x2a 1024 from: Eb3907eCad74a0013c259D5874AE7f22DcBcC95C to: 00000000000000000000000000000000DeaDBeef nonce: 42 @@ -46,14 +46,14 @@ src: 0xf8662a85174876e8008252089400000000000000000000000000000000deadbeef8204002 .SS Offline transaction with wire-format output .EX -$ PYTHONPATH=. python chainlib/eth/runnable/gas.py -y <\fIkey_file_path\fP> -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 --raw 1024 +$ eth-gas -y <\fIkey_file_path\fP> -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 --raw 1024 0xf8662a85174876e8008252089400000000000000000000000000000000deadbeef8204008025a00c97432d4db724e66a56f7ced04174cf6129e2555709f206dd6d3a156b4af23aa0287862548314a59c7ca6139eee8b51400eb40a67b08b8dc13d67302abecccae0 .EE .SS Sign transaction for a different network .EX -$ PYTHONPATH=. python chainlib/eth/runnable/gas.py -i evm:london:3:rinkeby -y /home/lash/src/contrib/grassrootseconomics/cic-dev/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 --data 0x2a 1024 +$ eth-gas -i evm:london:3:rinkeby -y /home/lash/src/contrib/grassrootseconomics/cic-dev/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 --data 0x2a 1024 from: Eb3907eCad74a0013c259D5874AE7f22DcBcC95C to: 00000000000000000000000000000000DeaDBeef nonce: 42 diff --git a/man/eth-get.head.groff b/man/eth-get.head.groff @@ -4,14 +4,16 @@ eth-get \- Retrieve transaction and transaction state from network .SH SYNOPSIS +.PP \fBeth-get\fP [ -p \fIrpc_provider\fP] \fItx_hash\fP +.PP +\fBeth-get\fP [ -p \fIrpc_provider\fP] \fIaddress\fP .SH DESCRIPTION .P -Retrieve a transaction by its transaction hash. +Retrieve a transaction by its transaction hash, or contract code by its address. .P -\fBeth-get\fP retrieves the state of the transaction (the "receipt") and applies it to the output. -.P -It also re-serializes the transaction wire format for reference. +In the context of transaction, \fBeth-get\fP retrieves the state of the transaction (the "receipt") and applies it to the output. It also re-serializes the transaction wire format for reference. + .SS OPTIONS diff --git a/man/eth-raw.examples.groff b/man/eth-raw.examples.groff @@ -0,0 +1,8 @@ +.SH EXAMPLES + +Outputs of \fBeth-gas\fP and \fBeth-encode\fP map directly to inputs for \fBeth-raw\fP. + +.SS Encapsulate a gas transaction + +.EX +$ eth-gas -y <\fIkey_file_path\fP> -a 00000000000000000000000000000000DeaDBeef --fee-price 100000000000 --fee-limit 21000 --nonce 42 --raw 1024 | eth-raw diff --git a/man/eth-raw.head.groff b/man/eth-raw.head.groff @@ -0,0 +1,26 @@ +.TH eth-raw 1 + +.SH NAME +eth-raw \- Create and send a jsonrpc transaction from signed rlp transaction + +.SH SYNOPSIS +.P +\fBeth-raw\fP [ --deploy ] \fItransaction_data\fP +.P +\fBeth-raw\fP [ -p \fIrpc_provider\fP ] [ --deploy ] -s \fItransaction_data\fP + + +.SH DESCRIPTION +.P +Creates a jsonrpc object from serialized data. +.P +If \fB-y\fP is defined, and \fB--mode\fP is not set, or set to "tx", a \fIeth_sendRawTransaction\fP object will be created. +.P +Otherwise, an \fIeth_call\fP object will be created. The recipient of the call will be the contract specified with \fB-e\fP. If \fB-y\fP has been set, the sender of the query will be the address corresponding to the key file. +.P +If the \fB-s\fP option is added, the jsonrpc object will be sent to the rpc provider. \fBNote\fP If the jsonrpc object is a transaction, this may incur real costs. +.P +See the \fBEXAMPLES\fP section for details on how to use \fBeth-raw\fP with the outputs from \fBeth-gas\fP and \fBeth-encode\fP + + +.SS OPTIONS diff --git a/man/eth-raw.seealso.groff b/man/eth-raw.seealso.groff @@ -0,0 +1,4 @@ +.SH SEE ALSO + +.BP +confini-dump(1), eth-keyfile(1), eth-encode(1), eth-gas(1) diff --git a/man/eth-wait.head.groff b/man/eth-wait.head.groff @@ -0,0 +1,17 @@ +.TH eth-wait 1 + +.SH NAE +eth-wait \- Wait for a transaction to be confirmed on network + +.SH SYNOPSIS +\fBeth-wait\fP [ -p \fIrpc_provider\fP ] \fItransaction_hash\fP ... + +.SH DESCRIPTION +.P +Blocks until network confirmation for the transactions are returned from \fIrpc_provider\fP. +.P +By default, if execution of the transaction failed on the network, the command will cause an error. This behavior can be adjusted using the \fB--ignore\fP or \fB--ignore-all\fP option. +.P +A transaction hash unknown to the \fIrpc_provider\fP will also cause an error. + +.SS OPTIONS diff --git a/man/eth-wait.overrides b/man/eth-wait.overrides @@ -0,0 +1,2 @@ +ignore Ignore error from the specified transaction. May be defined more than once. --ignore tx_hash +ignoreall Ignore errors from all transactions. --ignore-all