Skip to content

Nadria/chainprof

 
 

Repository files navigation

Chainprof Rollup Profiler

Requirements

  1. NodeJs >= 18 (use nvm)
  2. Fill the .env file with the correct values(see .env.example)
  3. Install dependencies
  4. Build the project
npm install
make clean && make

Setup chain profiling

This checklist describes how to setup chain profiling

Environment variables

  • export RPC=<rpc endpoint>
  • export NUM_ACCOUNTS=<number of accounts to create>
  • export ACCOUNTS_DIR=<directory containing generated accounts>
  • export ACCOUNTS_PASSWORD=<password to unlock accounts>

Create Accounts to be used for chain profiling

  • Create accounts for chain profiling
bin/chainprof chainprof accounts \
  --accounts-dir $ACCOUNTS_DIR \
  --num-accounts $NUM_ACCOUNTS \
  --password $ACCOUNTS_PASSWORD \
  --rpc $RPC

Transfer Native tokens to Created Accounts

Environment variables

  • export KEY=<path to keyfile of account to fund>
  • export VALUE=<value to send to accounts>

Fund Accounts

  • Send Transaction to fund accounts with Native Token
bin/chainprof account fund \
    --rpc $RPC \
    --keyfile $KEY \
    --accounts-dir $ACCOUNTS_DIR \
    --value $VALUE

Output: Transaction Hashes

Transfer Balances from Created Accounts

Environment variables

  • export RECIPIENT=<address to send funds to>

Drain Accounts

  • Send Transaction to Transfer all Native Token balance from created accounts to recipient
bin/chainprof account drain \
    --rpc $RPC \
    --send-to $RECIPIENT \
    --accounts-dir $ACCOUNTS_DIR \
    --password $ACCOUNTS_PASSWORD 

Output: Transaction Hashes

Evaluate Chain Performance

Environment variables

  • export NUM_TRANSACTIONS=<number of transactions to send>
  • export CALLDATA=<calldata to send in transactions>
  • export OUTFILE=<output file to write results to>
  • export TO=<address to send transactions to>
  • export KEY=<path to keyfile of account to send transactions from>

Evaluate

  • Send Transactions to evaluate chain performance
bin/chainprof chainprof evaluate \
    --rpc $RPC \
    --accounts-dir $ACCOUNTS_DIR \
    --password $ACCOUNTS_PASSWORD \
    --value $VALUE \
    --transactions-per-account $NUM_TRANSACTIONS \
    --calldata $CALLDATA \
    --outfile $OUTFILE \
    --to $TO

Output: Results written to file

About

Rollup profiler

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.6%
  • Makefile 0.4%