A comprehensive set of tools for working with the Polkadot API, Substrate chains, and Moonbeam networks.
Use PNPM to avoid dependency conflicts
Install packages:
pnpm installThen, run scripts with ts-node for TypeScript files or python/python3 for Python files.
# Create ECDSA accounts
ts-node createECDSAAcc.ts --n 5
# Check balance at specific height
ts-node checkBalanceAtHeight.ts
# Calculate multisig address
ts-node calculateMultisigAddress.ts --a '["addr1","addr2"]' --t 2createECDSAAcc - 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...batchRefundRefDeposits - Batch processes referendum deposit refunds
batchTxs - Executes multiple transactions in batch format
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
calculateMoonbeamRefundPhala - Calculates refund operations for Phala transfers on Moonbeam
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
treasuryTransferUSDCBack - Handles USDC transfer operations back to Treasury
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
- Node.js (v16 or higher recommended)
- PNPM package manager
- TypeScript for running
.tsfiles - Python 3 for running
.pyfiles
Install TypeScript globally if needed:
npm install -g typescript ts-nodeMost 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:AHAssets.json- Asset Hub assetsHydraDXAsset.json- HydraDX asset configurationsKusamaAssets.json- Kusama network assetsParachainKusamaAssets.json- Parachain-specific Kusama assets
Key configuration files:
package.json- Node.js dependencies and scriptstsconfig.json- TypeScript compiler configurationrequirements.txt- Python dependencies.gitignore- Git ignore rules
These tools handle private keys and perform on-chain operations. Always follow these security practices:
- ✅ Test on testnets first before using on mainnet
- ✅ Never share private keys or commit them to version control
- ✅ Review all transactions carefully before signing
- ✅ Use hardware wallets for production environments when possible
- ✅ Keep dependencies updated to patch security vulnerabilities
⚠️ Use at your own risk - no warranties provided
Scripts that handle sensitive data:
getAccFromJSON.ts- Exposes private keys (DO NOT SHARE OUTPUT)sendSubstrateTx.ts- Requires mnemonic input (NOT SAFE FOR PRODUCTION)createECDSAAcc.ts&createSR25519Acc.ts- Generate and store private keys
Contributions are welcome! Please ensure:
- Code follows existing patterns and style
- Add documentation for new scripts in this README
- Test thoroughly on testnets before submitting
- Include usage examples for complex operations
Use at your own risk. No warranties provided.
Last Updated: January 2026