{"id":24678833,"url":"https://github.com/islishude/web3-cli","last_synced_at":"2026-05-20T10:12:41.143Z","repository":{"id":57692329,"uuid":"327191278","full_name":"islishude/web3-cli","owner":"islishude","description":"web3-cli - web3 jsonrpc viewer","archived":false,"fork":false,"pushed_at":"2025-03-10T13:05:12.000Z","size":234,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-10T13:38:45.947Z","etag":null,"topics":["cli","dapp","ethereum","jsonrpc-client"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/islishude.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-06T03:42:00.000Z","updated_at":"2025-03-10T13:05:10.000Z","dependencies_parsed_at":"2024-01-29T15:27:38.817Z","dependency_job_id":"8c133486-19b4-49a0-83e0-ccdd91786939","html_url":"https://github.com/islishude/web3-cli","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islishude%2Fweb3-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islishude%2Fweb3-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islishude%2Fweb3-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/islishude%2Fweb3-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/islishude","download_url":"https://codeload.github.com/islishude/web3-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244846191,"owners_count":20520091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","dapp","ethereum","jsonrpc-client"],"created_at":"2025-01-26T13:18:33.906Z","updated_at":"2026-05-20T10:12:36.121Z","avatar_url":"https://github.com/islishude.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WEB3-CLI\n\n[![test](https://github.com/islishude/web3-cli/actions/workflows/test.yaml/badge.svg)](https://github.com/islishude/web3-cli/actions/workflows/test.yaml)\n\n## Install\n\nYou can download the binary in the latest [release page](https://github.com/islishude/web3-cli/releases/latest).\n\nor you have docker\n\n```\ndocker pull ghcr.io/islishude/web3-cli\n```\n\nor if you have golang installed\n\n```sh\n# install with the laest tag\ngo install github.com/islishude/web3-cli@latest\n# install with the latest commit\ngo install github.com/islishude/web3-cli@main\n```\n\n## Usage\n\n**Do a simple jsonrpc call**\n\nthe default rpc endpoint is your local: `http://localhost:8545`\n\nyour command is like `web3-cli jsonrpc_method [jsonrpc_param...]`\n\n```console\n$ web3-cli web3_clientVersion\n\"Geth/v1.12.1-unstable-60070fe5-20230805/darwin-amd64/go1.20.7\"\n$ web3-cli eth_getBlockByNumber 1 false\n{\n    \"baseFeePerGas\": \"0x342770c0\",\n    \"difficulty\": \"0x0\",\n    \"extraData\": \"0xd983010c01846765746888676f312e32302e378664617277696e\",\n    \"gasLimit\": \"0xafa5bd\",\n    \"gasUsed\": \"0x5208\",\n    \"hash\": \"0xf5c52795b6fb4b69601e8613c436e07d964b33fb97b5b2b8670a106e0617bf6e\",\n    \"logsBloom\": \"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n    \"miner\": \"0x0000000000000000000000000000000000000000\",\n    \"mixHash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n    \"nonce\": \"0x0000000000000000\",\n    \"number\": \"0x1\",\n    \"parentHash\": \"0xd7bcb282488afadddab1b33e1d5906d1cf367bfc6249b6eaf140961e986621c2\",\n    \"receiptsRoot\": \"0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa\",\n    \"sha3Uncles\": \"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347\",\n    \"size\": \"0x2ad\",\n    \"stateRoot\": \"0x05b0dc6527b6d706aa6400866014f8f0bc4996ac8f7b9c4d7b4801fccfad139f\",\n    \"timestamp\": \"0x64fc7d7a\",\n    \"totalDifficulty\": \"0x0\",\n    \"transactions\": [\n        \"0xfae530d45ec70be05c68aaa0628588f0055f4aae360a8c090c2591e8691a47ca\"\n    ],\n    \"transactionsRoot\": \"0x8b2e1c5c5426fb942d176fac9186a05911c41867709a9fa43b05e2051a64f712\",\n    \"uncles\": [],\n    \"withdrawals\": [],\n    \"withdrawalsRoot\": \"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\"\n}\n```\n\nweb3-cli supports built-in chain config as well.\n\n```console\n$ web3-cli --chain eth eth_blockNumber\n\"0x1142cb9\"\n$ web3-cli --chain bsc eth_chainId\n\"0x38\"\n```\n\nYou can run `web3-cli chains` to get all built-in chain configs.\n\nOf course, you can also use your own rpc endpoint\n\n```console\n$ web3-cli --rpc https://rpc.ankr.com/arbitrum eth_chainId\n\"0xa4b1\"\n```\n\n**Call a contract with human-readable params**\n\n```console\n$ export USDT_TOKEN=0xdac17f958d2ee523a2206206994597c13d831ec7\n$ web3-cli --chain eth --abi-name erc20 --call-to $USDT_TOKEN symbol\n[\n    \"USDT\"\n]\n$ web3-cli --chain eth --call-to $USDT_TOKEN balanceOf 0x0000000000000000000000000000000000000000\n[\n    \"0xbf17d330\"\n]\n```\n\nthe `--abi-name` could be a built-in abi name, you can `web3-cli abis` to get the built-in abi list.\n\nand it also could be a url and file path.\n\n```\n$ web3-cli --chain eth --abi-path https://http-server/abi/abi.json\n$ web3-cli --chain eth --abi-path local/path/to/abi.json\n```\n\nif you don't provide `--abi-name` or `--abi-path`, web3-cli can fetch the abi from explorer api automatically\n\n```console\n$ web3-cli --chain eth --call-to $USDT_TOKEN getOwner\n[\n    \"0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828\"\n]\n```\n\nyou may need to provide your explorer api endpoint as well if you provide a custom rpc\n\n```console\n$ # not required if use a built-in chain\n$ web3-cli --chain eth --rpc https://my-own-rpc.com\n$ web3-cli --rpc https://my-own-rpc.com --explorer-api https://my-custom-explorer.com/api\n```\n\nWhat about a complex abi type parameter, like array and tuple?\n\n**bytes**\n\n```solidity\nfunction logbyt(bytes memory) public returns (bytes memory)\n```\n\nyou must use a hex string\n\n```\n0x776562332d636c6920697320736f20636f6f6c21\n```\n\n**array and slice**\n\n```solidity\nfunction add(uint256[] calldata items) public pure returns (uint256)\n```\n\njson array is valid\n\n```json\n[\"0x1\", 100]\n```\n\n**tuple(struct)**\n\n```solidity\nstruct Payment {\n    address payable to;\n    uint256 value;\n}\n\nfunction transfer(Payment calldata item) external payable returns (bool success) {\n    return item.to.send(msg.value);\n}\n```\n\njson array is valid (you can use it in Remix)\n\n```json\n[\"0x0000000000000000000000000000000000000000\", \"0x1\"]\n```\n\njson object is valid as well!\n\nthe key is the field name, and it is not case sensitive.\n\n```json\n{ \"to\": \"0x0000000000000000000000000000000000000000\", \"value\": \"0x1\" }\n{ \"To\": \"0x0000000000000000000000000000000000000000\", \"Value\": \"0x1\" }\n```\n\n## Built-in tools\n\n**Create a new address with optional prefix and suffix**\n\n```console\n$ web3-cli tools new-random-address --prefix 00 --suffix 00\n{\n    \"Address\": \"0x00BbEA9643992F70879a1f4009a18c82B14f1A00\",\n    \"PrivateKey\": \"0xc44591dd44df800b1f9$REDACTED$be239403741b2196ca28\",\n    \"PublicKey\": \"0x044708bac89fd0c4f595b0808c068350cf889d7aeea67848498997458c0541da955a7b6c8aafd5e8fbe00edfabb2d47da9fee680b711b2ce90401145ffce90defe\"\n}\n```\n\n**Decode raw transactions**\n\nNOTE: OP system transactions are not supported.\n\n```console\n$ web3-cli tools decode-raw-tx 0x...REDACTED...\n{\n    \"type\": \"0x2\",\n    \"chainId\": \"0x1\",\n    \"nonce\": \"0x1018\",\n    \"to\": \"0x388c818ca8b9251b393131c08a736a67ccb19297\",\n    \"gas\": \"0x565f\",\n    \"gasPrice\": null,\n    \"maxPriorityFeePerGas\": \"0x0\",\n    \"maxFeePerGas\": \"0x50c81c068\",\n    \"value\": \"0x475c0000a4d611\",\n    \"input\": \"0x\",\n    \"accessList\": [],\n    \"v\": \"0x1\",\n    \"r\": \"0xa5a963fee24751d6f54656be527c699584ef47aade8a677c806f119b02b0daf7\",\n    \"s\": \"0x257af2dbf67d167dfbf4f4acf032b43ca4fa8b8f06ae8b09f16bd2cc57817ce4\",\n    \"yParity\": \"0x1\",\n    \"hash\": \"0x048117077d33c6f3670d601de5525dda41374719162cb0ed252726559d4ffe70\"\n}\n```\n\n## Contribution\n\n**How to add your chain to built-in list?**\n\nAdd it to [internal/chains/list.go](./internal/chains/list.go) file.\n\nfor example:\n\n```go\nvar example = \u0026Chain{\n\tName:     \"example\",\n\tId:       111000111,\n\tEndpoint: \"https://jsonrpc-endpoint.example\",\n\tExplorer: \"https://full-explorer-api-endpoint.example/api\",\n}\n```\n\nthen append it to `Builtin` slice.\n\nyou also need to add a test case for it in [internal/chains/explorer_api_test.go](./internal/chains/explorer_api_test.go)\n\n**How to add an ABI to built-in list?**\n\nAdd a valid json file to `internal/abis/abi` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fislishude%2Fweb3-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fislishude%2Fweb3-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fislishude%2Fweb3-cli/lists"}