{"id":18953146,"url":"https://github.com/0xpolygon/polygon-cli","last_synced_at":"2026-03-04T04:07:21.267Z","repository":{"id":65857982,"uuid":"511928256","full_name":"0xPolygon/polygon-cli","owner":"0xPolygon","description":"A Swiss Army knife of blockchain tools","archived":false,"fork":false,"pushed_at":"2025-03-27T13:41:33.000Z","size":5599,"stargazers_count":74,"open_issues_count":5,"forks_count":44,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-28T05:11:34.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xPolygon.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-08T14:42:57.000Z","updated_at":"2025-03-24T18:13:42.000Z","dependencies_parsed_at":"2024-03-25T12:01:20.575Z","dependency_job_id":"53adfd17-aff1-4533-b60c-f668c8ac6a18","html_url":"https://github.com/0xPolygon/polygon-cli","commit_stats":null,"previous_names":["0xpolygon/polygon-cli"],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygon%2Fpolygon-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygon%2Fpolygon-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygon%2Fpolygon-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygon%2Fpolygon-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xPolygon","download_url":"https://codeload.github.com/0xPolygon/polygon-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345850,"owners_count":20924102,"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":[],"created_at":"2024-11-08T13:36:44.438Z","updated_at":"2026-03-04T04:07:21.253Z","avatar_url":"https://github.com/0xPolygon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Polycli\n\nWe run a lot of different blockchain technologies. Different tools often have inconsistent tooling and this makes automation and operations painful. The goal of this codebase is to standardize some of our commonly needed tools and provide interfaces and formats.\n\n## Summary\n\n- [Install](#install)\n- [Features](#features)\n- [Testing](#testing)\n- [References](#references)\n\n## Install\n\nRequirements:\n\n- [Go](https://go.dev/)\n- make\n- jq\n- bc\n- protoc (Only required for `make generate`)\n\nTo install, clone this repo and run:\n\n```bash\nmake install\n```\n\nBy default, the commands will be in `$HOME/go/bin/`, so for ease, we recommend adding that path to your shell's startup file by adding the following line:\n\n```bash\nexport PATH=\"$HOME/go/bin:$PATH\"\n```\n\n## Features\n\n![polycli monitor](doc/assets/monitor.gif)\n\nNote: Do not modify this section! It is auto-generated by `cobra` using `make gen-doc`.\n\n\u003cgenerated\u003e\n\n- [polycli abi](doc/polycli_abi.md) - Provides encoding and decoding functionalities with contract signatures and ABI.\n\n- [polycli cdk](doc/polycli_cdk.md) - Utilities for interacting with CDK networks.\n\n- [polycli contract](doc/polycli_contract.md) - Interact with smart contracts and fetch contract information from the blockchain.\n\n- [polycli dbbench](doc/polycli_dbbench.md) - Perform a level/pebble db benchmark.\n\n- [polycli dockerlogger](doc/polycli_dockerlogger.md) - Monitor and filter Docker container logs.\n\n- [polycli dumpblocks](doc/polycli_dumpblocks.md) - Export a range of blocks from a JSON-RPC endpoint.\n\n- [polycli ecrecover](doc/polycli_ecrecover.md) - Recovers and returns the public key of the signature.\n\n- [polycli enr](doc/polycli_enr.md) - Convert between ENR and Enode format.\n\n- [polycli fix-nonce-gap](doc/polycli_fix-nonce-gap.md) - Send txs to fix the nonce gap for a specific account.\n\n- [polycli fold-trace](doc/polycli_fold-trace.md) - Trace an execution trace and fold it for visualization.\n\n- [polycli fork](doc/polycli_fork.md) - Take a forked block and walk up the chain to do analysis.\n\n- [polycli fund](doc/polycli_fund.md) - Bulk fund crypto wallets automatically.\n\n- [polycli hash](doc/polycli_hash.md) - Provide common crypto hashing functions.\n\n- [polycli loadtest](doc/polycli_loadtest.md) - Run a generic load test against an Eth/EVM style JSON-RPC endpoint.\n\n- [polycli metrics-to-dash](doc/polycli_metrics-to-dash.md) - Create a dashboard from an Openmetrics / Prometheus response.\n\n- [polycli mnemonic](doc/polycli_mnemonic.md) - Generate a BIP39 mnemonic seed.\n\n- [polycli monitor](doc/polycli_monitor.md) - Monitor blocks using a JSON-RPC endpoint.\n\n- [polycli monitorv2](doc/polycli_monitorv2.md) - Monitor v2 command stub.\n\n- [polycli nodekey](doc/polycli_nodekey.md) - Generate node keys for different blockchain clients and protocols.\n\n- [polycli p2p](doc/polycli_p2p.md) - Set of commands related to devp2p.\n\n- [polycli parse-batch-l2-data](doc/polycli_parse-batch-l2-data.md) - Convert batch l2 data into an ndjson stream.\n\n- [polycli parseethwallet](doc/polycli_parseethwallet.md) - Extract the private key from an eth wallet.\n\n- [polycli plot](doc/polycli_plot.md) - Plot a chart of transaction gas prices and limits.\n\n- [polycli publish](doc/polycli_publish.md) - Publish transactions to the network with high-throughput.\n\n- [polycli report](doc/polycli_report.md) - Generate a report analyzing a range of blocks from an Ethereum-compatible blockchain.\n\n- [polycli retest](doc/polycli_retest.md) - Convert the standard ETH test fillers into something to be replayed against an RPC.\n\n- [polycli rpcfuzz](doc/polycli_rpcfuzz.md) - Continually run a variety of RPC calls and fuzzers.\n\n- [polycli signer](doc/polycli_signer.md) - Utilities for security signing transactions.\n\n- [polycli ulxly](doc/polycli_ulxly.md) - Utilities for interacting with the uLxLy bridge.\n\n- [polycli version](doc/polycli_version.md) - Get the current version of this application.\n\n- [polycli wallet](doc/polycli_wallet.md) - Create or inspect BIP39(ish) wallets.\n\n- [polycli wrap-contract](doc/polycli_wrap-contract.md) - Wrap deployed bytecode into create bytecode.\n\n\u003c/generated\u003e\n\n## Testing\n\nTo test the features of `polycli`, we'll run geth in `dev` mode but you can run any node you want.\n\n```bash\nmake geth\n```\n\nYou can then fund the default load testing account and run some tests.\n\n```bash\nmake geth-loadtest\n```\n\nYou can view the state of the chain using `polycli`.\n\n```bash\npolycli monitor --rpc-url http://127.0.0.1:8545\n```\n\n![polycli monitor](doc/assets/monitor.gif)\n\nNote that if you want to debug the monitor, you can use the following command.\n\n```bash\npolycli monitor --rpc-url http://34.117.145.249:80 -v 700 \u0026\u003e log.txt\n```\n\nYou can also interact manually with your node, you can attach a Javascript console to your node using IPC.\n\nFirst, wait for the IPC endpoint to open.\n\n```bash\nINFO [07-10|10:44:29.250] Starting peer-to-peer node               instance=Geth/v1.12.0-stable/darwin-amd64/go1.20.4\nWARN [07-10|10:44:29.250] P2P server will be useless, neither dialing nor listening\nINFO [07-10|10:44:29.255] Stored checkpoint snapshot to disk       number=0 hash=039839..dcb5c1\nDEBUG[07-10|10:44:29.255] IPCs registered                          namespaces=admin,debug,web3,eth,txpool,clique,miner,net,engine\nINFO [07-10|10:44:29.256] IPC endpoint opened                      url=/var/folders/7m/3_x4ns7557x52hb6vncqkx8h0000gn/T/geth.ipc\nINFO [07-10|10:44:29.256] Generated ephemeral JWT secret           secret=0x7511b4e6312a1a63348d8fc8c6a586ed4ea69ed31c27b3c0cc5e41cb6d2d5822\n```\n\nThen, attach a console to your node.\n\n```bash\ngeth attach /var/folders/7m/3_x4ns7557x52hb6vncqkx8h0000gn/T/geth.ipc\n```\n\nFrom there, you can do anything such as funding the default load testing account with some currency.\n\n```bash\n\u003e eth.coinbase==eth.accounts[0]\ntrue\n\n\u003e eth.sendTransaction({from: eth.coinbase, to: \"0x85da99c8a7c2c95964c8efd687e95e632fc533d6\", value: web3.toWei(5000, \"ether\")})\n\"0xd8223589989d198741e0543ab01d9d3ce2b81e38927cb213a56589e111dfd388\"\n```\n\nYou can then generate some load to make sure that blocks with transactions are being created. Note that the chain id of local geth is `1337`.\n\n```bash\npolycli loadtest --verbosity 700 --chain-id 1337 --concurrency 1 --requests 1000 --rate-limit 5 --mode c --rpc-url http://127.0.0.1:8545\n```\n\n## Contact\n\nFor more discussions, please head to the [R\u0026D Discord](https://discord.gg/0xPolygonRnD)\n\n## References\n\nSending some value to the default load testing account.\n\nListening for re-orgs.\n\n```bash\nsocat - UNIX-CONNECT:/var/folders/zs/k8swqskj1t79cgnjh6yt0fqm0000gn/T/geth.ipc\n{\"id\": 1, \"method\": \"eth_subscribe\", \"params\": [\"newHeads\"]}\n```\n\nUseful RPCs when testing.\n\n```bash\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"net_version\", \"params\": []}' https://polygon-rpc.com\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"eth_blockNumber\", \"params\": []}' https://polygon-rpc.com\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"eth_getBlockByNumber\", \"params\": [\"0x1DE8531\", true]}' https://polygon-rpc.com\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"clique_getSigner\", \"params\": [\"0x1DE8531\", true]}' https://polygon-rpc.com\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"eth_getBalance\", \"params\": [\"0x85da99c8a7c2c95964c8efd687e95e632fc533d6\", \"latest\"]}' https://polygon-rpc.com\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"eth_getCode\", \"params\": [\"0x79954f948079ee9ef1d15eff3e07ceaef7cdf3b4\", \"latest\"]}' https://polygon-rpc.com\n\n\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"txpool_inspect\", \"params\": []}' http://localhost:8545\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"txpool_status\", \"params\": []}' http://localhost:8545\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"eth_gasPrice\", \"params\": []}' http://localhost:8545\ncurl -v -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"admin_peers\", \"params\": []}' http://localhost:8545\n```\n\n```bash\nwebsocat ws://34.208.176.205:9944\n{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"chain_subscribeNewHead\", \"params\": []}\n```\n\nIf you add a new loadtest mode, don't forget to update the loadtest mode string by running `make gen-load-test-modes`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xpolygon%2Fpolygon-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xpolygon%2Fpolygon-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xpolygon%2Fpolygon-cli/lists"}