Package: dymka
DymkaSwiss-knife command line tool for interacting with Ethereum-based blockchains.Install the tool:pip3 install --user dymkaFollowing are the usage examples.Configuring provider and 'from' accountUnless your web3 provider is 'http://localhost:8545', you can use the--providerand specify it every time you run the tool. Or you may create a
filemyproviderwith the following content:--provider https://eth.llamarpc.comand run the tool with it:dymka @myprovider exec eth_blockNumber. Or you may
use environment variable like the following:export WEB3_PROVIDER=https://eth.llamarpc.comTo specify the account that you use to transact from, use--fromto specify
account keystore file (and--passwordto specify the file with its pass
phrase) or specify a private key.Similarly to above, you can put this to a file, saymyaccount:--from account.json --password account.password.txtand run the tool with it:dymka @myprovider @myaccount balance. Or justexport WEB3_FROM=...In the following examples I assume you specify both provider and 'from'
account.Raw RPC requests$dymkaexecweb3_clientVersion{"id":0,"jsonrpc":"2.0","result":"EthereumJS TestRPC/v2.8.0/ethereum-js"}$dymkaexecrpc_modules{"id":0,"jsonrpc":"2.0","result":{"eth":"1.0","net":"1.0","rpc":"1.0","web3":"1.0","evm":"1.0","personal":"1.0"}}$dymkaexecweb3_sha3"'0x68656c6c6f20776f726c64'"$dymkaexecweb3_sha3"'hello world'"{"id":0,"jsonrpc":"2.0","result":"0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"}(or alrernatively usedymka keccak256 'hello world')Seenote about argumentsbelow for why we need double quotes here.See Ethereum wikiJSON-RPCandManagement APIsfor more details.Accounts, Balance and nonce$dymkaaccounts["0xB18aE0D7F12105e36a430523721622e5930879cC"]$dymkabalance0xD6F0d25305cD6F53829aF54945d6FDEC370e20a5[{"account":"0xD6F0d25305cD6F53829aF54945d6FDEC370e20a5","result":99945104760000000000}]$dymkanonce0xD6F0d25305cD6F53829aF54945d6FDEC370e20a5[{"account":"0xD6F0d25305cD6F53829aF54945d6FDEC370e20a5","result":40}]Send moneydymkasend--to0xb92FbF90bFAC4a34557bbA17b91204C8D36a5055\--value1000000000000000000\--gasPrice1000000000-eNote that-eor--estimatestands for 'estimate gas'. Alternatively you can
specify--gas 21000.Compile contractThere isDemocontract, compile it like the following so we getdemo.json.solc--combined-jsonabi,bin--optimizedemo.sol>demo.jsonor with docker imagecdtests
dockerrun--rm-v$PWD:/src:roethereum/solc:0.5.9\/src/demo.sol--combined-jsonabi,bin--optimize>demo.jsonDeploy contract$dymka-cdemodeploy{"hash":"0xe4a8eeb6dc8a21e430077d460d2618c6a0a380e71dfecadcf4ceb252bae729b3","receipt":{..."contractAddress":"0xbABA05e6c21551bb50caF7C684a1Fc9B57B02A9A",...}}If you need to send money to the contract being deployed, use--value.For convenience, export the address as environment variable as following.exportWEB3_CONTRACT_DEMO=0xbABA05e6c21551bb50caF7C684a1Fc9B57B02A9AAlternatively, you may specify the address every time you want to call/send to
the contract with-a 0xbABA05e6c21551bb50caF7C684a1Fc9B57B02A9A.Call contract$dymka-cdemocallvalue{"result":42}$dymka-cdemocallcompare45{"result":[false,true]}Invoke contractdymka-cdemosendset42100dymka-cdemosendactIf you need to send money to the contract, use--value.EventsTo list the events of the contract for blocks from 1 till 3:$dymka-a0xbABA05e6c21551bb50caF7C684a1Fc9B57B02A9A-jdemo.abi.jsonevents1-3Gas priceDisplays gas price of the current provider
(web3.eth.gasPrice).$dymkagas{"gasPrice":20000000000}Other commandsaccounts- list available accounts,checksum- calculate correct checksummed string for the given address,show- display used provider and from address,transaction- show transaction details for the given hash,receipt- show receipt for the given hash,keccak- calculate Keccak-256 of the given string argument,chain- return an integer value for the currently configured “Chain Id”
value introduced inEIP-155(delegates toeth_chainIdRPC Method),selector- returns contract's function by given selector,events,logs- Returns emitted events of the given contract for the
specified block range (last 1000 blocks by default),help- shows full list of commands and short command description.Note about argumentsArguments for deploy, call and send contracts are first evaluated with python
(eval()). Thus addresses should be quoted twice like the following.$dymka-cdemosendteardown"\"0x0000000000000000000000000000000000000000\""The outer quotes are consumed by your shell (e.g. bash) and the inner
(escaped) quotes are consumed by python to make sure your address is not
evaluated to the plain number 0. Use-vd(verbose and dry run) to see how
your arguments are evaluated.TroubleshootingUse-vand-vvflags to see more information. File anissueor send a pull request so I try to help and review.Why should I trust dymkaDymka source code is open and kept reasonably small for review, it resides in
a single filedymkafor simplicity. The only runtimedependencyis aWeb3
python librarythat does all actions. Dymka actually is a thin command-line
wrapper over it. Dymka can be used with no Internet access, it only needs to
access its web3 provider (gateway node). No telemetry or other requests are
ever made.DonateIf you find the tool useful, please donate to ethereum address
0xb92FbF90bFAC4a34557bbA17b91204C8D36a5055.Happy hacking 🐱.