Compare commits
5 Commits
d49e3dd6ec
...
90d4c4eb95
Author | SHA1 | Date | |
---|---|---|---|
|
90d4c4eb95 | ||
|
edf8c4b604 | ||
|
f61ac91205 | ||
|
7e6daa0be3 | ||
|
a3081367db |
@ -1,5 +1,6 @@
|
|||||||
- 0.0.27:
|
- 0.0.27:
|
||||||
* Add man pages
|
* Add man pages with chainlib man page generator helper
|
||||||
|
* Remove redundant arg flags from runnables: get
|
||||||
- 0.0.26:
|
- 0.0.26:
|
||||||
* Remove manual 0x handling bug in tx
|
* Remove manual 0x handling bug in tx
|
||||||
- 0.0.25:
|
- 0.0.25:
|
||||||
|
11
Makefile
Normal file
11
Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
PREFIX ?= /usr/local
|
||||||
|
BUILD_DIR = build/$(PREFIX)/share/man
|
||||||
|
|
||||||
|
man:
|
||||||
|
mkdir -vp $(BUILD_DIR)
|
||||||
|
chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py gas` -v -n eth-gas -d $(BUILD_DIR)/ 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
|
||||||
|
|
||||||
|
.PHONY: man
|
@ -4,6 +4,7 @@ from chainlib.cli import (
|
|||||||
argflag_std_read,
|
argflag_std_read,
|
||||||
argflag_std_write,
|
argflag_std_write,
|
||||||
argflag_std_base,
|
argflag_std_base,
|
||||||
reset as argflag_reset,
|
argflag_std_base_read,
|
||||||
|
flag_reset as argflag_reset,
|
||||||
Flag,
|
Flag,
|
||||||
)
|
)
|
||||||
|
@ -7,6 +7,9 @@ from hexathon import add_0x
|
|||||||
|
|
||||||
cmds = {
|
cmds = {
|
||||||
'gas': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.WALLET,
|
'gas': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.WALLET,
|
||||||
|
'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,
|
||||||
}
|
}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -48,7 +48,8 @@ logg = logging.getLogger()
|
|||||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
config_dir = os.path.join(script_dir, '..', 'data', 'config')
|
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
|
||||||
|
arg_flags = chainlib.eth.cli.argflag_reset(arg_flags, chainlib.eth.cli.Flag.CHAIN_SPEC)
|
||||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
||||||
argparser.add_positional('item', type=str, help='Address or transaction to retrieve data for')
|
argparser.add_positional('item', type=str, help='Address or transaction to retrieve data for')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
14
man/eth-decode.head.groff
Normal file
14
man/eth-decode.head.groff
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
.TH eth-decode 1
|
||||||
|
|
||||||
|
.SH NAME
|
||||||
|
eth-decode \- Decode a transaction in wire-format to human readable form
|
||||||
|
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBeth-decode\fI [ -i \fIchain_spec\fP ] encoded_tx
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.P
|
||||||
|
This tool deserializes a wire-format transaction and outputs its fields in human-readable form. It does not require a node to operate, and does not apply transaction state.
|
||||||
|
.P
|
||||||
|
The transaction wire-format is an ordered concatenation of transaction values, which in turn is serialized using the Recurive Length Prefix (RLP) format. \fBeth-decode\fP accepts the RLP-encoded transaction as a hex string.
|
||||||
|
.P
|
18
man/eth-encode.custom.groff
Normal file
18
man/eth-encode.custom.groff
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
.SH SPECIFYING VALUES
|
||||||
|
Dynamic value types are not yet supported.
|
||||||
|
|
||||||
|
.SS Specifying an unsigned integer:
|
||||||
|
.IP u:1024
|
||||||
|
|
||||||
|
.SS Specifying an address:
|
||||||
|
.IP a:19062190B1925b5b6689D7073fDfC8c2976EF8Cb
|
||||||
|
|
||||||
|
.SS Specifying bytes values:
|
||||||
|
|
||||||
|
.IP b:deadbeef
|
||||||
|
.IP b4:deadbeef
|
||||||
|
.IP b32:deadbeef
|
||||||
|
|
||||||
|
.SS Specifying a string value:
|
||||||
|
|
||||||
|
.IP s:foobar
|
5
man/eth-encode.examples.groff
Normal file
5
man/eth-encode.examples.groff
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.SS Build a signed ERC20 transfer
|
||||||
|
|
||||||
|
.EX
|
||||||
|
$ eth-encode -y <\fIkey_file_path\fP> -e <\fItoken_address\fP> --signature transfer a:00000000000000000000000000000000DeaDBeef u:1024
|
||||||
|
.EE
|
17
man/eth-encode.head.groff
Normal file
17
man/eth-encode.head.groff
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
.TH eth-encode 1
|
||||||
|
|
||||||
|
.SH NAME
|
||||||
|
eth-encode \- Encode arbitrary contract calls and transactions
|
||||||
|
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBeth-encode\fP [ -p \fIrpc_provider\fP ] [ -i \fIchain_Spec\fP] [ -s ] [ -w ] [ -e \fIsmart_contract_address\fP ] --signature \fIcontract_method_name\fP [ \fIvalue_specifiers\fP ... ]
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
|
||||||
|
Generate wire-format or rpc query any EVM smart contract call or transaction by specifying method and arguments.
|
||||||
|
|
||||||
|
The resulting call or transaction can either be stored offline for future use, or directly sent to the network using the \fB-s\fP flag.
|
||||||
|
|
||||||
|
A description of value formatting is given in the \fBSPECIFYING VALUES\fP section below. Usage is demonstrated in the \fBEXAMPLES\fP section.
|
||||||
|
|
||||||
|
.SS OPTIONS
|
75
man/eth-gas.examples.groff
Normal file
75
man/eth-gas.examples.groff
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
.P
|
||||||
|
In the follwing we willconsaider transactions signed by the private key for address Eb3907eCad74a0013c259D5874AE7f22DcBcC95C:
|
||||||
|
|
||||||
|
.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
|
||||||
|
from: Eb3907eCad74a0013c259D5874AE7f22DcBcC95C
|
||||||
|
to: 00000000000000000000000000000000DeaDBeef
|
||||||
|
nonce: 42
|
||||||
|
gasPrice: 100000000000 (100 gwei)
|
||||||
|
gas: 21000
|
||||||
|
value: 1024 (0.000000000000001024 eth)
|
||||||
|
data: 0x
|
||||||
|
v: 37
|
||||||
|
recovery_byte: 0
|
||||||
|
r: 0x0c97432d4db724e66a56f7ced04174cf6129e2555709f206dd6d3a156b4af23a
|
||||||
|
s: 0x287862548314a59c7ca6139eee8b51400eb40a67b08b8dc13d67302abecccae0
|
||||||
|
chainId: 1
|
||||||
|
hash: 0x003030af05460633e85b16fff7a17607818dc67e58f89396e5491ad6f5438971
|
||||||
|
hash_unsigned: 0xa59cf9e5438b186de381892b7879ce66476d5469478c7148880da5d553ade651
|
||||||
|
src: 0xf8662a85174876e8008252089400000000000000000000000000000000deadbeef8204008025a00c97432d4db724e66a56f7ced04174cf6129e2555709f206dd6d3a156b4af23aa0287862548314a59c7ca6139eee8b51400eb40a67b08b8dc13d67302abecccae0
|
||||||
|
.EE
|
||||||
|
|
||||||
|
.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
|
||||||
|
from: Eb3907eCad74a0013c259D5874AE7f22DcBcC95C
|
||||||
|
to: 00000000000000000000000000000000DeaDBeef
|
||||||
|
nonce: 42
|
||||||
|
gasPrice: 100000000000 (100 gwei)
|
||||||
|
gas: 21000
|
||||||
|
value: 1024 (0.000000000000001024 eth)
|
||||||
|
data: 0x2a
|
||||||
|
v: 37
|
||||||
|
recovery_byte: 0
|
||||||
|
r: 0x800b6982d3f178201d7e7e7693b9c90b3fbcd54d04b6fff5284c81101fad54dd
|
||||||
|
s: 0x3b86d710d31ac74b58f0040b0f51fdb6bdbabea62a68cf99c05e765e7e81de87
|
||||||
|
chainId: 1
|
||||||
|
hash: 0xede30052befd80760c5ab543babdccc3d97fe90523e5710d77220155a82faa47
|
||||||
|
hash_unsigned: 0xad82d8cf1a412541c8a94ef71c50e9172c3a37853af036adee2f55c577da9770
|
||||||
|
src: 0xf8662a85174876e8008252089400000000000000000000000000000000deadbeef8204002a25a0800b6982d3f178201d7e7e7693b9c90b3fbcd54d04b6fff5284c81101fad54dda03b86d710d31ac74b58f0040b0f51fdb6bdbabea62a68cf99c05e765e7e81de87
|
||||||
|
.EE
|
||||||
|
|
||||||
|
.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
|
||||||
|
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
|
||||||
|
from: Eb3907eCad74a0013c259D5874AE7f22DcBcC95C
|
||||||
|
to: 00000000000000000000000000000000DeaDBeef
|
||||||
|
nonce: 42
|
||||||
|
gasPrice: 100000000000 (100 gwei)
|
||||||
|
gas: 21000
|
||||||
|
value: 1024 (0.000000000000001024 eth)
|
||||||
|
data: 0x2a
|
||||||
|
v: 41
|
||||||
|
recovery_byte: 0
|
||||||
|
r: 0xe522c25784111a512cbf46f883e3bdacffc2cdbd465fa1042892c28fc10ee054
|
||||||
|
s: 0x5f84eb51a0c9871cfcedaba4e6274b300014899b3a2fec9292de6fe5919bcd07
|
||||||
|
chainId: 3
|
||||||
|
hash: 0x771200a20072294a6a843b89b98d5f868c9aa94da75dacf6a9f5834dfd241199
|
||||||
|
hash_unsigned: 0xa5f9e8a5cda6985d81f4129955b7529f48ecb54728badac16ec550384e3a2bcc
|
||||||
|
src: 0xf8662a85174876e8008252089400000000000000000000000000000000deadbeef8204002a29a0e522c25784111a512cbf46f883e3bdacffc2cdbd465fa1042892c28fc10ee054a05f84eb51a0c9871cfcedaba4e6274b300014899b3a2fec9292de6fe5919bcd07
|
||||||
|
.EE
|
||||||
|
|
||||||
|
.P
|
||||||
|
The wire-format can in turn be decoded using the \fBeth-decode\fP tool)
|
19
man/eth-gas.head.groff
Normal file
19
man/eth-gas.head.groff
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
.TH eth-gas 1
|
||||||
|
.SH NAME
|
||||||
|
eth-gas - Create EVM gas token transaction
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.P
|
||||||
|
\fBeth-gas\fP -a RECIPIENT -y KEYFILE [ -p \fIrpc_provider ] [ -s ] [ -u ] AMOUNT
|
||||||
|
.P
|
||||||
|
\fBeth-gas\fP -a RECIPIENT -y KEYFILE [ --fee-price PRICE ] [ --fee-limit LIMIT ] [ --nonce NONCE ] [ -s ] [ -u ] AMOUNT
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fBeth-gas\fP generates serialized gas token transactions in various output formats.
|
||||||
|
|
||||||
|
If an \fIrpc_provider\fP is available, the valuess \fIfee_price\fP and \fInonce\fP will be automatically retrieved if they are not explicitly specified. If missing values cannot be retrieved, an error will occur.
|
||||||
|
|
||||||
|
Providing all arguments enables fully offline creation of the transaction.
|
||||||
|
|
||||||
|
See \fBEXAMPLES\fP for more details on inputs and outputs.
|
||||||
|
|
||||||
|
|
||||||
|
.SS OPTIONS
|
17
man/eth-get.head.groff
Normal file
17
man/eth-get.head.groff
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
.TH eth-get 1
|
||||||
|
|
||||||
|
.SH NAME
|
||||||
|
eth-get \- Retrieve transaction and transaction state from network
|
||||||
|
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBeth-get\fP [ -p \fIrpc_provider\fP] \fItx_hash\fP
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.P
|
||||||
|
Retrieve a transaction by its transaction hash.
|
||||||
|
.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.
|
||||||
|
|
||||||
|
.SS OPTIONS
|
27
man/eth-info.head.groff
Normal file
27
man/eth-info.head.groff
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
.TH eth-info 1
|
||||||
|
|
||||||
|
.SH NAME
|
||||||
|
eth-info - Return key metrics from the current state of the EVM network.
|
||||||
|
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBeth-info\fP [ -p \fIrpc_provider\fP ] [ \fIkey\fP ]
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fBeth-info\fP reports statistics from the current state of the EVM network:
|
||||||
|
|
||||||
|
.EX
|
||||||
|
$ eth-info
|
||||||
|
Block: 1024478
|
||||||
|
Gas price: 1000000000
|
||||||
|
.EE
|
||||||
|
|
||||||
|
An individual data item may be specified using the \fIkey\fP positional argument:
|
||||||
|
|
||||||
|
.EX
|
||||||
|
$ eth-info block
|
||||||
|
Block: 1024478
|
||||||
|
$ eth-info --raw gas_price
|
||||||
|
1000000000
|
||||||
|
.EE
|
||||||
|
|
||||||
|
.SS OPTIONS
|
@ -1 +0,0 @@
|
|||||||
WALLET_KEY_FILE foobar baz
|
|
@ -1,9 +0,0 @@
|
|||||||
.TH eth-gas 1
|
|
||||||
.SH NAME
|
|
||||||
eth-gas - Create EVM gas token transaction
|
|
||||||
.SH SYNOPSIS
|
|
||||||
\fBeth-gas\fP -a RECIPIENT -y KEYFILE [ --fee-price PRICE ] [ --fee-limit LIMIT ] [ --nonce NONCE ] [ -s ] [ -u ] AMOUNT
|
|
||||||
.SH DESCRIPTION
|
|
||||||
\fBeth-gas\fP generates serialized gas token transactions.
|
|
||||||
|
|
||||||
.SS OPTIONS
|
|
Loading…
Reference in New Issue
Block a user