polygon-cli

command module
v0.1.114 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

README

Polycli

We 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.

Summary

Install

Requirements:

  • Go
  • make
  • jq
  • bc
  • protoc (Only required for make generate)

To install, clone this repo and run:

make install

By 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:

export PATH="$HOME/go/bin:$PATH"

Features

polycli monitor

Note: Do not modify this section! It is auto-generated by cobra using make gen-doc.

Testing

To test the features of polycli, we'll run geth in dev mode but you can run any node you want.

make geth

You can then fund the default load testing account and run some tests.

make geth-loadtest

You can view the state of the chain using polycli.

polycli monitor --rpc-url http://127.0.0.1:8545

polycli monitor

Note that if you want to debug the monitor, you can use the following command.

polycli monitor --rpc-url http://34.117.145.249:80 -v 700 &> log.txt

You can also interact manually with your node, you can attach a Javascript console to your node using IPC.

First, wait for the IPC endpoint to open.

INFO [07-10|10:44:29.250] Starting peer-to-peer node               instance=Geth/v1.12.0-stable/darwin-amd64/go1.20.4
WARN [07-10|10:44:29.250] P2P server will be useless, neither dialing nor listening
INFO [07-10|10:44:29.255] Stored checkpoint snapshot to disk       number=0 hash=039839..dcb5c1
DEBUG[07-10|10:44:29.255] IPCs registered                          namespaces=admin,debug,web3,eth,txpool,clique,miner,net,engine
INFO [07-10|10:44:29.256] IPC endpoint opened                      url=/var/folders/7m/3_x4ns7557x52hb6vncqkx8h0000gn/T/geth.ipc
INFO [07-10|10:44:29.256] Generated ephemeral JWT secret           secret=0x7511b4e6312a1a63348d8fc8c6a586ed4ea69ed31c27b3c0cc5e41cb6d2d5822

Then, attach a console to your node.

geth attach /var/folders/7m/3_x4ns7557x52hb6vncqkx8h0000gn/T/geth.ipc

From there, you can do anything such as funding the default load testing account with some currency.

> eth.coinbase==eth.accounts[0]
true

> eth.sendTransaction({from: eth.coinbase, to: "0x85da99c8a7c2c95964c8efd687e95e632fc533d6", value: web3.toWei(5000, "ether")})
"0xd8223589989d198741e0543ab01d9d3ce2b81e38927cb213a56589e111dfd388"

You 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.

polycli loadtest --verbosity 700 --chain-id 1337 --concurrency 1 --requests 1000 --rate-limit 5 --mode c --rpc-url http://127.0.0.1:8545

Contact

For more discussions, please head to the R&D Discord

References

Sending some value to the default load testing account.

Listening for re-orgs.

socat - UNIX-CONNECT:/var/folders/zs/k8swqskj1t79cgnjh6yt0fqm0000gn/T/geth.ipc
{"id": 1, "method": "eth_subscribe", "params": ["newHeads"]}

Useful RPCs when testing.

curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "net_version", "params": []}' https://polygon-rpc.com
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "eth_blockNumber", "params": []}' https://polygon-rpc.com
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["0x1DE8531", true]}' https://polygon-rpc.com
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "clique_getSigner", "params": ["0x1DE8531", true]}' https://polygon-rpc.com
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "eth_getBalance", "params": ["0x85da99c8a7c2c95964c8efd687e95e632fc533d6", "latest"]}' https://polygon-rpc.com
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "eth_getCode", "params": ["0x79954f948079ee9ef1d15eff3e07ceaef7cdf3b4", "latest"]}' https://polygon-rpc.com


curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "txpool_inspect", "params": []}' http://localhost:8545
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "txpool_status", "params": []}' http://localhost:8545
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "eth_gasPrice", "params": []}' http://localhost:8545
curl -v -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "id": 1, "method": "admin_peers", "params": []}' http://localhost:8545
websocat ws://34.208.176.205:9944
{"jsonrpc":"2.0", "id": 1, "method": "chain_subscribeNewHead", "params": []}

If you add a new loadtest mode, don't forget to update the loadtest mode string by running make gen-load-test-modes.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package abi provides utilities for interacting with contracts.
Package abi provides utilities for interacting with contracts.
bindings
cmd
abi
cdk
enr
heimdall
Package heimdall implements the `polycli heimdall` command group, a cast-like CLI for querying Heimdall v2 REST + CometBFT endpoints and broadcasting signed Heimdall transactions.
Package heimdall implements the `polycli heimdall` command group, a cast-like CLI for querying Heimdall v2 REST + CometBFT endpoints and broadcasting signed Heimdall transactions.
heimdall/chain
Package chain implements the cast-familiar CometBFT-facing subcommands of `polycli heimdall`: block, block-number, age, find-block, chain-id, chain, client.
Package chain implements the cast-familiar CometBFT-facing subcommands of `polycli heimdall`: block, block-number, age, find-block, chain-id, chain, client.
heimdall/chainparams
Package chainparams implements the `polycli heimdall chainmanager` umbrella command (alias `cm`) and its subcommands targeting Heimdall v2's `x/chainmanager` module.
Package chainparams implements the `polycli heimdall chainmanager` umbrella command (alias `cm`) and its subcommands targeting Heimdall v2's `x/chainmanager` module.
heimdall/checkpoint
Package checkpoint implements the `polycli heimdall checkpoint` umbrella command (alias `cp`) and its subcommands: params, count, latest, get, buffer, last-no-ack, next, list, signatures, overview.
Package checkpoint implements the `polycli heimdall checkpoint` umbrella command (alias `cp`) and its subcommands: params, count, latest, get, buffer, last-no-ack, next, list, signatures, overview.
heimdall/clerk
Package clerk implements the `polycli heimdall state-sync` umbrella command (aliases `clerk` and `ss`) and its subcommands targeting Heimdall v2's `x/clerk` module: count, latest-id, get, list, range, sequence, is-old.
Package clerk implements the `polycli heimdall state-sync` umbrella command (aliases `clerk` and `ss`) and its subcommands targeting Heimdall v2's `x/clerk` module: count, latest-id, get, list, range, sequence, is-old.
heimdall/decode
Package decode implements the `polycli heimdall decode` umbrella command and its subcommands (tx, msg, hash-tx, ve).
Package decode implements the `polycli heimdall decode` umbrella command and its subcommands (tx, msg, hash-tx, ve).
heimdall/milestone
Package milestone implements the `polycli heimdall milestone` umbrella command (alias `ms`) and its subcommands targeting Heimdall v2's `x/milestone` module: params, count, latest, get.
Package milestone implements the `polycli heimdall milestone` umbrella command (alias `ms`) and its subcommands targeting Heimdall v2's `x/milestone` module: params, count, latest, get.
heimdall/ops
Package ops implements the `polycli heimdall ops` umbrella command and its CometBFT JSON-RPC-facing subcommands: status, health, peers, consensus, tx-pool, abci-info, commit, and validators-cometbft.
Package ops implements the `polycli heimdall ops` umbrella command and its CometBFT JSON-RPC-facing subcommands: status, health, peers, consensus, tx-pool, abci-info, commit, and validators-cometbft.
heimdall/span
Package span implements the `polycli heimdall span` umbrella command (alias `sp`) and its subcommands targeting Heimdall v2's `x/bor` module: params, latest, get, list, producers, seed, votes, downtime, scores, find.
Package span implements the `polycli heimdall span` umbrella command (alias `sp`) and its subcommands targeting Heimdall v2's `x/bor` module: params, latest, get, list, producers, seed, votes, downtime, scores, find.
heimdall/topup
Package topup implements the `polycli heimdall topup` umbrella command and its subcommands targeting Heimdall v2's `x/topup` module: root, account, proof, verify, sequence, is-old.
Package topup implements the `polycli heimdall topup` umbrella command and its subcommands targeting Heimdall v2's `x/topup` module: root, account, proof, verify, sequence, is-old.
heimdall/tx
Package tx implements the cast-familiar tx/account read-only subcommands of `polycli heimdall`: tx, receipt, logs, nonce, sequence, balance, rpc, publish.
Package tx implements the cast-familiar tx/account read-only subcommands of `polycli heimdall`: tx, receipt, logs, nonce, sequence, balance, rpc, publish.
heimdall/tx/msgs
Package msgs wires the per-Msg subcommands shared by `polycli heimdall mktx`, `polycli heimdall send`, and `polycli heimdall estimate`.
Package msgs wires the per-Msg subcommands shared by `polycli heimdall mktx`, `polycli heimdall send`, and `polycli heimdall estimate`.
heimdall/util
Package heimdallutil implements the `polycli heimdall util` umbrella command and its local utility subcommands (addr, b64, version, completions).
Package heimdallutil implements the `polycli heimdall util` umbrella command and its local utility subcommands (addr, b64, version, completions).
heimdall/validator
Package validator implements the `polycli heimdall validator` umbrella command (alias `val`) and its subcommands targeting Heimdall v2's `x/stake` module: set/validators, total-power, get, signer, status, proposer, proposers, is-old-stake-tx.
Package validator implements the `polycli heimdall validator` umbrella command (alias `val`) and its subcommands targeting Heimdall v2's `x/stake` module: set/validators, total-power, get, signer, status, proposer, proposers, is-old-stake-tx.
heimdall/wallet
Package wallet implements the `polycli heimdall wallet` umbrella command.
Package wallet implements the `polycli heimdall wallet` umbrella command.
p2p
pos
Package pos provides utilities for interacting with Polygon PoS.
Package pos provides utilities for interacting with Polygon PoS.
pos/exitproof
Package exitproof generates Polygon PoS exit proofs for L2→L1 token withdrawals.
Package exitproof generates Polygon PoS exit proofs for L2→L1 token withdrawals.
publish/script command
rpcfuzz
Package rpcfuzz is meant to have some basic RPC fuzzing and conformance tests.
Package rpcfuzz is meant to have some basic RPC fuzzing and conformance tests.
rpcfuzz/argfuzz
Package argfuzz implements the randomizers, mutators, and fuzzers that can be utilized by gofuzz.
Package argfuzz implements the randomizers, mutators, and fuzzers that can be utilized by gofuzz.
ulxly
Package ulxly provides utilities for interacting with the uLxLy bridge.
Package ulxly provides utilities for interacting with the uLxLy bridge.
ulxly/bridge
Package bridge provides commands for bridging assets and messages between chains.
Package bridge provides commands for bridging assets and messages between chains.
ulxly/bridge/asset
Package asset provides the bridge asset command.
Package asset provides the bridge asset command.
ulxly/bridge/message
Package message provides the bridge message command.
Package message provides the bridge message command.
ulxly/bridge/weth
Package weth provides the bridge WETH command.
Package weth provides the bridge WETH command.
ulxly/claim
Package claim provides commands for claiming deposits on a particular chain.
Package claim provides commands for claiming deposits on a particular chain.
ulxly/claim/asset
Package asset provides the claim asset command.
Package asset provides the claim asset command.
ulxly/claim/everything
Package everything provides the claim-everything command.
Package everything provides the claim-everything command.
ulxly/claim/message
Package message provides the claim message command.
Package message provides the claim message command.
ulxly/events/claims
Package claims provides the get-claims command.
Package claims provides the get-claims command.
ulxly/events/deposits
Package deposits provides the get-deposits command.
Package deposits provides the get-deposits command.
ulxly/events/verifybatches
Package verifybatches provides the get-verify-batches command.
Package verifybatches provides the get-verify-batches command.
ulxly/proof/deposits
Package deposits provides the proof deposits command.
Package deposits provides the proof deposits command.
ulxly/proof/empty
Package empty provides the proof empty command.
Package empty provides the proof empty command.
ulxly/proof/rollups
Package rollups provides the proof rollups command.
Package rollups provides the proof rollups command.
ulxly/proof/zero
Package zero provides the proof zero command.
Package zero provides the proof zero command.
ulxly/tree/balance
Package balance provides the compute-balance-tree command.
Package balance provides the compute-balance-tree command.
ulxly/tree/combined
Package combined provides the compute-balance-nullifier-tree command.
Package combined provides the compute-balance-nullifier-tree command.
ulxly/tree/nullifier
Package nullifier provides the compute-nullifier-tree command.
Package nullifier provides the compute-nullifier-tree command.
Package flag provides utilities for managing command flags with environment variable fallback support.
Package flag provides utilities for managing command flags with environment variable fallback support.
internal
heimdall/client
Package client provides thin HTTP clients for Heimdall's REST gateway and CometBFT JSON-RPC endpoint.
Package client provides thin HTTP clients for Heimdall's REST gateway and CometBFT JSON-RPC endpoint.
heimdall/cmdutil
Package cmdutil holds the plumbing shared by every `polycli heimdall` command package: config-resolving client constructors, render.Options assembly, JSON decoding, hex normalization, the gRPC-gateway error envelope, and generic cobra command builders for the common "GET endpoint → render" and "CometBFT RPC → render" shapes.
Package cmdutil holds the plumbing shared by every `polycli heimdall` command package: config-resolving client constructors, render.Options assembly, JSON decoding, hex normalization, the gRPC-gateway error envelope, and generic cobra command builders for the common "GET endpoint → render" and "CometBFT RPC → render" shapes.
heimdall/comet
Package comet provides typed fetch helpers for the CometBFT JSON-RPC endpoints shared by the heimdall subcommand families (chain, milestone).
Package comet provides typed fetch helpers for the CometBFT JSON-RPC endpoints shared by the heimdall subcommand families (chain, milestone).
heimdall/config
Package config resolves the runtime configuration for the `polycli heimdall` command tree.
Package config resolves the runtime configuration for the `polycli heimdall` command tree.
heimdall/proto
Package proto implements the narrow subset of the Cosmos SDK and Heimdall v2 protobuf wire format that polycli's heimdall tx builder needs.
Package proto implements the narrow subset of the Cosmos SDK and Heimdall v2 protobuf wire format that polycli's heimdall tx builder needs.
heimdall/render
Package render formats Heimdall REST + CometBFT responses for CLI output.
Package render formats Heimdall REST + CometBFT responses for CLI output.
heimdall/tx
Package tx implements the shared Heimdall transaction builder used by `polycli heimdall mktx`, `send`, and `estimate`.
Package tx implements the shared Heimdall transaction builder used by `polycli heimdall mktx`, `send`, and `estimate`.
heimdall/wallet
Package wallet provides BIP-39/BIP-32 key derivation and go-ethereum v3 keystore helpers shared by `polycli heimdall wallet` (keystore management) and `polycli heimdall tx/mktx/send/estimate` (signing).
Package wallet provides BIP-39/BIP-32 key derivation and go-ethereum v3 keystore helpers shared by `polycli heimdall wallet` (keystore management) and `polycli heimdall tx/mktx/send/estimate` (signing).
p2p
proto
Package rpctypes provides pretty JSON marshaling functionality for blockchain data types.
Package rpctypes provides pretty JSON marshaling functionality for blockchain data types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL