Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Swiss Army knife of blockchain tools

License

NotificationsYou must be signed in to change notification settings

stringscut/polygon-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,371 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 formake 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 bycobra usingmake gen-doc.

Testing

To test the features ofpolycli, we'll run geth indev 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 usingpolycli.

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.4WARN [07-10|10:44:29.250] P2P server will be useless, neither dialing nor listeningINFO [07-10|10:44:29.255] Stored checkpoint snapshot to disk       number=0 hash=039839..dcb5c1DEBUG[07-10|10:44:29.255] IPCs registered                          namespaces=admin,debug,web3,eth,txpool,clique,miner,net,engineINFO [07-10|10:44:29.256] IPC endpoint opened                      url=/var/folders/7m/3_x4ns7557x52hb6vncqkx8h0000gn/T/geth.ipcINFO [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 is1337.

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 theR&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.comcurl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "eth_blockNumber", "params": []}' https://polygon-rpc.comcurl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "eth_getBlockByNumber", "params": ["0x1DE8531", true]}' https://polygon-rpc.comcurl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "clique_getSigner", "params": ["0x1DE8531", true]}' https://polygon-rpc.comcurl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "eth_getBalance", "params": ["0x85da99c8a7c2c95964c8efd687e95e632fc533d6", "latest"]}' https://polygon-rpc.comcurl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "eth_getCode", "params": ["0x79954f948079ee9ef1d15eff3e07ceaef7cdf3b4", "latest"]}' https://polygon-rpc.comcurl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "txpool_inspect", "params": []}' http://localhost:8545curl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "txpool_status", "params": []}' http://localhost:8545curl -v -H'Content-Type: application/json' -d'{"jsonrpc":"2.0", "id": 1, "method": "eth_gasPrice", "params": []}' http://localhost:8545curl -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 the following command:cd cmd/loadtest && stringer -type=loadTestMode. You can installstringer withgo install golang.org/x/tools/cmd/stringer@v0.37.0.

About

A Swiss Army knife of blockchain tools

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go88.0%
  • Shell8.3%
  • Solidity2.1%
  • Other1.6%

[8]ページ先頭

©2009-2026 Movatter.jp