chainlib-eth

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

eth-encode.1 (9745B)


      1 .TH eth-encode 1
      2 
      3 .SH NAME
      4 eth-encode \- Encode arbitrary contract calls and transactions
      5 
      6 .SH SYNOPSIS
      7 \fBeth-encode\fP [ --mode \fImode\fP ] [ -f \fIformat\fP ] [ -p \fIrpc_provider\fP ] [ -i \fIchain_Spec\fP] [ -s ] [ -w ] [ -e \fIsmart_contract_address\fP ] --signature \fIcontract_method_name\fP [ \fIvalue_specifiers\fP ... ]
      8 
      9 .SH DESCRIPTION
     10 
     11 Generate wire-format or rpc query any EVM smart contract call or transaction by specifying method and arguments.
     12 
     13 The resulting call or transaction can either be stored offline for later use, or directly sent to the network using the \fB-s\fP option.
     14 
     15 A description of value formatting is given in the \fBSPECIFYING VALUES\fP section below. Usage is demonstrated in the \fBEXAMPLES\fP section.
     16 
     17 .SS OPTIONS
     18 
     19 .TP
     20 \fB-0\fP
     21 Omit newline to output
     22 
     23 .TP
     24 \fB-c \fI\fIconfig_dir\fP\fP, \fB--config \fI\fIconfig_dir\fP\fP
     25 Load configuration files from given directory. All files with an .ini extension will be loaded, of which all must contain valid ini file data.
     26 
     27 .TP
     28 \fB--dumpconfig \fI\fIformat\fP\fP
     29 Output configuration settings rendered from environment and inputs. Valid arguments are \fIini\fP for ini file output, and \fIenv\fP for environment variable output. See \fBCONFIGURATION\fP.
     30 
     31 .TP
     32 \fB-e\fP, \fB--executable-address\fP
     33 Address of an executable code point on the network.
     34 
     35 .TP
     36 \fB--env-prefix\fP
     37 Environment prefix for variables to overwrite configuration. Example: If \fB--env-prefix\fP is set to \fBFOO\fP then configuration variable \fBBAR_BAZ\fP would be set by environment variable \fBFOO_BAZ_BAR\fP. Also see \fBENVIRONMENT\fP.
     38 
     39 .TP
     40 \fB--fee-limit\fP
     41 Set the limit of execution units for the transaction. If used with \fB-s\fP this may incur actual network token cost. If \fB--fee-price\fP is not explicitly set, the price \fImay\fP be retrieved from the network, and multiplied with this value to define the cost.
     42 
     43 .TP
     44 \fB--fee-price\fP
     45 Set fee unit price to offer for the transaction. If used with \fB-s\fP this may incur actual network token cost.
     46 
     47 .TP
     48 \fB--height\fP
     49 Block height at which to query state for. Does not apply to transactions.
     50 
     51 .TP
     52 \fB-i \fI\fIchain_spec\fP\fP, \fB--chain-spec \fI\fIchain_spec\fP\fP
     53 Chain specification string, in the format <engine>:<fork>:<chain_id>:<common_name>. Example: "evm:london:1:ethereum". Overrides the \fIRPC_CREDENTIALS\fP configuration setting.
     54 
     55 .TP
     56 \fB--mode \fI\fImode
     57 \fP\fP
     58 Mode of operation encoding is for. Must be one of "tx," "call," or "arg." See \fBMODES\fP below.
     59 
     60 .TP
     61 \fB-n \fI\fInamespace\fP\fP, \fB--namespace \fI\fInamespace\fP\fP
     62 Load given configuration namespace. Configuration will be loaded from the immediate configuration subdirectory with the same name.
     63 
     64 .TP
     65 \fB--no-logs\fP
     66 Turn of logging completely. Negates \fB-v\fP and \fB-vv\fP
     67 
     68 .TP
     69 \fB--nonce\fP
     70 Explicitly set nonce to use for transaction.
     71 
     72 .TP
     73 \fB-p\fP, \fB--rpc-provider\fP
     74 Fully-qualified URL of RPC provider. Overrides the \fIRPC_PROVIDER\fP configuration setting.
     75 
     76 .TP
     77 \fB--passphrase-file \fI\fIpath\fP\fP
     78 Path to file containing password to unlock key file
     79 
     80 .TP
     81 \fB--raw\fP
     82 Produce output most optimized for machines.
     83 
     84 .TP
     85 \fB--rpc-auth\fP
     86 RPC endpoint authentication method, e.g. how to handle a HTTP WWW-Authenticate header. Overrides the \fIRPC_AUTH\fP configuration setting.
     87 
     88 .TP
     89 \fB--rpc-credentials\fP
     90 RPC endpoint authentication data. Format depends on the authentication method defined in \fB--rpc-auth\fP. Overrides the \fIRPC_CREDENTIALS\fP configuration setting.
     91 
     92 .TP
     93 \fB--rpc-dialect\fP
     94 RPC backend dialect. If specified it \fImay\fP help with encoding and decoding issues. Overrides the \fIRPC_DIALECT\fP configuration setting.
     95 
     96 .TP
     97 \fB-s\fP
     98 Send to network. If set, network state may change. This means tokens may be spent and so on. Use with care. Only applies to transactions.
     99 
    100 .TP
    101 \fB--seq\fP
    102 Use numeric sequencial jsonrpc query ids. Useful for buggy server implementations who expects such.
    103 
    104 .TP
    105 \fB-u\fP, \fB--unsafe\fP
    106 Allow addresses that do not pass checksum.
    107 
    108 .TP
    109 \fB-v\fP
    110 Verbose. Show logs for important state changes.
    111 
    112 .TP
    113 \fB-vv\fP
    114 Very verbose. Show logs with debugging information.
    115 
    116 .TP
    117 \fB-w\fP
    118 Wait for the last transaction to be confirmed on the network. Will generate an error if the EVM execution fails.
    119 
    120 .TP
    121 \fB-ww\fP
    122 Wait for \fIall\fP transactions sequentially to be confirmed on the network. Will generate an error if EVM execution fails for any of the transactions.
    123 
    124 .TP
    125 \fB-y \fI\fIpath\fP\fP, \fB--key-path \fI\fIpath\fP\fP
    126 Path to signing key. Overrides the \fIWALLET_KEY_FILE\fP configuration setting.
    127 
    128 .SH CONFIGURATION
    129 
    130 All configuration settings may be overriden both by environment variables, or by overriding settings with the contents of ini-files in the directory defined by the \fB-c\fP option.
    131 
    132 The active configuration, with values assigned from environment and arguments, can be output using the \fB--dumpconfig\fP \fIformat\fP option. Note that entries having keys prefixed with underscore (e.g. _SEQ) are not actual configuration settings, and thus cannot be overridden with environment variables.
    133 
    134 To refer to a configuration setting by environment variables, the \fIsection\fP and \fIkey\fP are concatenated together with an underscore, and transformed to upper-case. For example, the configuration variable \fIFOO_BAZ_BAR\fP refers to an ini-file entry as follows:
    135 
    136 .EX
    137 [foo]
    138 bar_baz = xyzzy
    139 .EE
    140 
    141 In the \fBENVIRONMENT\fP section below, the relevant configuration settings for this tool is listed along with a short description of its meaning.
    142 
    143 Some configuration settings may also be overriden by command line options. Also note that the use of the \fB-n\fP and \fB--env-prefix\fP options affect how environment and configuration is read. The effects of options on how configuration settings are affective is described in the respective \fBOPTIONS\fP section.
    144 
    145 .SH MODES
    146 
    147 The modes parameter specifies what kind of operaion the encoding should be generated for. There are three valid modes:
    148 
    149 .SS tx
    150 Generates a transaction that changes state. Used with \fB--format\fP \fIrpc\fP it will generate an \fIeth_sendRawTransaction\fP jsonrpc object. Used with \fB--format\fP \fIbin\fP it outputs signed RLP only in hexdecimal.
    151 
    152 .SS call
    153 Generates a query that reads state. Used with \fB--format\fP \fIrpc\fP it will generate a \fIeth_call\fP jsonrpc object with applicable fields filled out from environment, arguments and/or rpc retrieval. \fB--format\fP \fIbin\fP is not valid for this mode.
    154 
    155 .SS arg
    156 Encodes the argument part only, optionally with a method signature. \fB--format\fP \fIrpc\fP is not valid for this mode.
    157 
    158 .SH SPECIFYING VALUES
    159 Dynamic value types are not yet supported.
    160 
    161 .SS Specifying an unsigned integer:
    162 .IP u:1024
    163 
    164 .SS Specifying an address:
    165 .IP a:19062190B1925b5b6689D7073fDfC8c2976EF8Cb
    166 
    167 .SS Specifying bytes values:
    168 
    169 .IP b:deadbeef 
    170 .IP b4:deadbeef
    171 .IP b32:deadbeef
    172 
    173 .SS Specifying a string value:
    174 
    175 .IP s:foobar
    176 .SH EXAMPLES
    177 
    178 .SS Build a signed ERC20 transfer in wire format, setting nonce and fee details manually.
    179 .EX
    180 $ eth-encode -f bin -y <\fIkey_file_path\fP> -e <\fItoken_address\fP> --fee-price 1000000000 --fee-limit 100000 --nonce 42 --signature transfer a:00000000000000000000000000000000DeaDBeef u:1024
    181 .EE
    182 
    183 .SS Build Smart contract call with method signature, retrieving fee and nonce settings from rpc
    184 
    185 \fBeth-encode\fP --mode call -f rpc -e <\fItoken_address\fP> --signature balanceOf -p <\fIrpc_endpoint\fP> a:deadbeef
    186 
    187 .SS Build smart contract ERC20 transfer argument with signature
    188 .EX
    189 \fBeth-encode\fP --mode arg --signature transfer a:00000000000000000000000000000000DeaDBeef u:1024
    190 .TP Outupt
    191 a9059cbb00000000000000000000000000000000000000000000000000000000deadbeef0000000000000000000000000000000000000000000000000000000000000400
    192 .EE
    193 
    194 .SS Build smart contract ERC20 transfer argument types without signature
    195 .EX
    196 \fBeth-encode\fP --mode arg a:00000000000000000000000000000000DeaDBeef u:1024
    197 .TP Output
    198 00000000000000000000000000000000000000000000000000000000deadbeef0000000000000000000000000000000000000000000000000000000000000400
    199 .EE
    200 .SH ENVIRONMENT
    201 
    202 
    203 .TP
    204 \fICHAIN_SPEC\fP
    205 String specifying the type of chain connected to, in the format \fI<engine>:<fork>:<network_id>:<common_name>\fP. For EVM nodes the \fIengine\fP value will always be \fIevm\fP.
    206 
    207 .TP
    208 \fIRPC_AUTH\fP
    209 Authentication method to use for the \fIRPC_PROVIDER\fP. Currently only \fIbasic\fP is supported.
    210 
    211 .TP
    212 \fIRPC_CREDENTIALS\fP
    213 Authentication credentials to use for \fIRPC_AUTH\fP. For \fIbasic\fP authentication the value must be given as \fI<user>:<pass>\fP.
    214 
    215 .TP
    216 \fIRPC_DIALECT\fP
    217 Enables translations of EVM node specific formatting and response codes.
    218 
    219 .TP
    220 \fIRPC_PROVIDER\fP
    221 Fully-qualified URL to the RPC endpoint of the blockchain node.
    222 
    223 .TP
    224 \fIWALLET_KEY_FILE\fP
    225 The wallet key file containing private key to use for transaction signing. Overridden by \fB-y\fP.
    226 
    227 .TP
    228 \fIWALLET_PASSPHRASE\fP
    229 Passphrase to unlock wallet. \fBWARNING:\fP it is \fBunsafe\fP to pass the passphrase as an environment variable. If the key unlocks something of value, the passphrase should rather be in a configuration file, preferably as an encrypted entry. Alternatively, a passphrase can be read from file using the \fB--passphrase-file\fP option. Files containing passphrases should only be accessible by the owner.
    230 
    231 .SH LICENSE
    232 
    233 This documentation and its source is licensed under the Creative Commons Attribution-Sharealike 4.0 International license.
    234 
    235 The source code of the tool this documentation describes is licensed under the GNU General Public License 3.0.
    236 
    237 .SH COPYRIGHT
    238 
    239 Louis Holbrook <dev@holbrook.no> (https://holbrook.no)
    240 PGP: 59A844A484AC11253D3A3E9DCDCBD24DD1D0E001
    241 
    242 
    243 
    244 .SH SOURCE CODE
    245 
    246 https://git.defalsify.org
    247 
    248 
    249 .SH SEE ALSO
    250 
    251 .BP
    252 confini-dump(1), eth-keyfile(1)
    253