A comprehensive set of tools for working with the Polkadot API, Substrate chains, and Moonbeam networks.
Use PNPM to avoid dependency conflicts
Use at your own risk!
Install packages:
pnpm installThen, run scripts with ts-node for TypeScript files or python/python3 for Python files.
createECDSAAcc - Creates ECDSA accounts using Polkadot Keyring with Ethereum derivation paths
ts-node createECDSAAcc.ts --n 5 # Creates 5 ECDSA accountscreateSR25519Acc - Creates SR25519 accounts with a given prefix, saved to JSON file
encodeDecodeAddress - Simple snippet demonstrating encode and decode functionality for Substrate addresses
getAccFromJSON - Prints the private key from a JSON file (
getAddressFromMnemonic - Derives Ethereum addresses from mnemonic using m/44/60/0/0/0 derivation path and Substrate addresses with //hard/soft derivation
getEthAddressFromPrivKey - Shows the Ethereum address associated with a private key
calculateAddressStorageKey - Calculates the storage key for an EVM address
calculateDerivedAddress - Calculates the derivative address of a given index
calculateMultisigAddress - Calculates multisig addresses based on an array of addresses and threshold
ts-node calculateMultisigAddress.ts --a '["14gZZ9xc52TKDJA6LmzX7iVBcdPeBNX6B3NkGubKd6pLTcSe","1333RgL47QYYkmJk1BHzfEF4hRE7Bd2Yf8P2HdV8Cn3p9hVh"]' --t 2calculateSovereignAccountFundTransfer - Calculates sovereign account fund transfers between parachains
checkBalanceAtHeight - Checks account balances at a specific block height, saves results to JSON
checkBlockFinality - Prints the latest finalized block in the provided chain
checkTxFinality - Checks if a given transaction hash has been finalized (both TypeScript and Python versions)
getBlock - Gets a Substrate block with a given hash
getBalanceEvents - Fetches all balance transfer events via the Substrate API
getStakingAddress - Fetches all staking addresses and their totals for Moonbeam or Moonriver
ts-node getStakingAddress.ts --network moonbeamgetStakingData - Gets staking data from all collators
batchRemoveVotes - Batch removes conviction voting for a given sender address
ts-node batchRemoveVotes.ts --n moonbeam --s 0x1234...addContractMetadata - Adds contract metadata for multiple contracts using lazy migrations
ts-node addContractMetadata.ts --c "0x452bE05439d83D3A6A510F11a4Ba1F1909d1cA6d,0x149f3dDeB5FF9bE7342D07C35D6dA19Df3F790af" --n moonbeamsetDummyCode - Calculates encoded call data to set dummy code for provided precompiles
calculateMBRT3100_MRLFix - Calculates Moonbeam RT3100 fix for failed Hydration asset transfers
calculateMoonbeamHydraDXAssetFix - Calculates fixes for Moonbeam HydraDX asset issues
calculateMoonbeamRefundPinkNCTR - Calculates refund operations for Pink NCTR tokens on Moonbeam
calculateMoonriverXCMDeliveryCalldata - Calculates XCM delivery calldata for Moonriver
moonbeamAssetMigration - Handles asset migration operations on Moonbeam
treasuryDCAHydration - Creates Dollar Cost Averaging (DCA) operations from Treasury funds via Hydration
- Transfers GLMR from Treasury to Hydration sovereign account
- Sets up automated DCA trading schedules
- Handles XCM message construction for remote execution
treasuryRemoveLPHydration - Removes liquidity provider positions from Hydration via Treasury operations
getCrowdloanContAddress - Retrieves and saves crowdloan rewards information for a given network to JSON
nestAsDerivatives - Nests derivative calls to multiple levels and provides encoded call data
estimateTxFee - Estimates transaction fees for a given call
sendSubstrateTx - Sends simple transactions using Substrate API (SR25519 accounts only, not for Moonriver!)
chopsticks_fakeTx - Creates fake transactions for testing with Chopsticks local development environment
ts-node chopsticks_fakeTx.ts --e ws://127.0.0.1:8000 --s 0x1234...verifyMessage - Verifies signed messages by providing the signer's public address, message, and signature
PALTxGenerator - Generates Polkadot Assurance Legion multisig transactions
PALMonthlyPayoutGenerator - Generates monthly payout transactions for Polkadot Assurance Legion
VLTxGenerator - Specialized transaction generator for VL operations
Most scripts support the following networks:
- Moonbeam (
--n moonbeam) - Moonriver (
--n moonriver) - Moonbase Alpha (
--n moonbase)
accounts.json- Stores generated account informationaddresses.json- Contains address data for various operationsmisc/- Directory containing asset data and configuration files
- Test on testnets first
- Never share private keys
- Review all transactions before signing
- Use at your own risk in production environments