Docs

Docs

  • Develop
  • Validate
  • Integrate
  • Learn

›erdpy

Welcome to Elrond

  • Welcome to Elrond

Technology

  • Architecture Overview
  • Glossary
  • Entities
  • Chronology
  • Secure Proof of Stake
  • Adaptive State Sharding
  • The Elrond WASM VM
  • Cross Shard Transactions

Wallet

  • Wallets - Overview
  • Web Wallet
  • Maiar Web Wallet Extension
  • Webhooks
  • Ledger

Tokens

  • Native Tokens
  • ESDT tokens
  • NFT tokens

Validators

  • Validators - Overview
  • System Requirements
  • Install a Mainnet Node

    • Scripts & User config
    • Installing a Validator Node
    • Optional Configurations
    • How to use the Docker Image

    Install a Testnet/Devnet Node

    • Scripts & User config
    • Installing a Validator Node
    • Manage a validator node
    • How to use the Docker Image

    Manage your keys

    • Validator Keys
    • Wallet Keys
    • Protecting your keys

    Staking, Unstaking, Unjailing

    • Staking, unstaking and unjailing
    • Staking
    • Unjailing
    • The Staking Smart Contract
  • The Delegation Manager
  • Convert An Existing Validator Into A Staking Pool
  • Merging A Validator Into An Existing Delegation Smart Contract
  • Rating
  • Elrond Node upgrades
  • Node redundancy
  • Import DB
  • Node CLI
  • Node Databases
  • Useful Links & Tools
  • FAQs

Developers

  • Developers - Overview
  • Tutorials

    • Build a dApp in 15 minutes
    • Build a Microservice for your dApp
    • The Crowdfunding Smart Contract (part 1)
    • The Crowdfunding Smart Contract (part 2)
    • The Counter Smart Contract
    • Custom Wallet Connect

    Signing Transactions

    • Signing Transactions
    • Tools for signing
    • Signing programmatically

    Gas and Fees

    • Overview
    • EGLD transfers (move balance transactions)
    • System Smart Contracts
    • User-defined Smart Contracts

    Developer reference

    • The Elrond Serialization Format
    • Smart contract annotations
    • Smart contract modules
    • Smart contract to smart contract calls
    • Smart Contract Developer Best Practices
    • Code Metadata
    • Smart Contract API Functions
    • Storage Mappers
    • Rust Testing Framework
    • Rust Testing Framework Functions Reference
    • Rust Smart Contract Debugging
    • Random Numbers in Smart Contracts

    Developers Best Practices

    • Basics
    • BigUint Operations
    • The dynamic allocation problem
    • Multi-values

    Mandos tests reference

    • Mandos Overview
    • Mandos Structure
    • Mandos Simple Values
    • Mandos Complex Values
    • Embedding Mandos code in Go
  • Constants
  • Built-In Functions
  • Account storage
  • Setup a Local Testnet
  • Set up a Local Testnet (advanced)
  • Creating Wallets

SDK and Tools

  • SDKs and Tools - Overview
  • REST API

    • REST API overview
    • api.elrond.com
    • Gateway overview
    • Addresses
    • Transactions
    • Network
    • Nodes
    • Blocks
    • Virtual Machine
    • Versions and Changelog
  • Proxy
  • Elasticsearch
  • erdpy

    • erdpy
    • Installing erdpy
    • Configuring erdpy
    • erdpy CLI
    • Deriving the Wallet PEM file
    • Sending bulk transactions
    • Writing and running erdpy scripts
    • Smart contract interactions

    erdjs

    • erdjs
    • Cookbook
    • Extending erdjs
    • Writing and testing interactions
    • Migration guides
    • Signing Providers for dApps
  • erdgo
  • erdcpp
  • erdjava
  • erdkotlin
  • erdwalletjs-cli

Integrators

  • Integrators - Overview
  • EGLD integration guide
  • ESDT tokens integration guide
  • Observing Squad
  • Accounts Management
  • Creating Transactions
  • Querying the Blockchain

Sending bulk transactions

It is easy to prepare a set of transaction and then send them all at once using erdpy. Here's how.

Requirements:

  • You must have erdpy installed on your computer. See Installing erdpy for details.
  • You need a wallet that contains sufficient EGLD. We will use the mnemonics you have for this wallet to generate a PEM file that erdpy needs.

There will be 3 steps to fulfill:

  1. Prepare the PEM file from the wallet mnemonics.
  2. Prepare the transaction set, which involves you configuring a Bash script (provided below). This script will contain your desired transactions and will reference your PEM file.
  3. Execute the command that sends all the transactions in the prepared set.
warning

Make sure your terminal is running bash, and not zsh or any other shell. Run the following command:

ps -p $$

It should print something like:

PID TTY          TIME CMD
169860 pts/6 00:00:00 bash

The word under the CMDkeyword must be bash, otherwise the script provided below will not work. If it says zsh, csh, tcsh or anything else, run the following command to start a bash session:

exec /bin/bash

Step 1: Prepare the PEM file

See the page Deriving the Wallet PEM file for how to prepare a PEM file. Make sure you know exactly where erdpy saved it for you.

Step 2: Prepare the transaction set

The following Bash script defines a set of 9 example transactions. Each transaction is on one line, and contains the receiver wallet address (such aserd1qx22...), then a space, then the EGLD amount to be transferred (for example 8). The script will take care of applying the correct EGLD denomination.

You must change the value of MYWALLET first. The wallet you see in the script below doesn't actually exist and transactions sent from it will fail. Therefore, you need to write your wallet address between the quotation marks " on the line where MYWALLET is defined.

Next, you must change the PEM_FILE variable to the path to the PEM file you prepared at Step 1 (see above).

Next, you must change the TRANSACTIONS list with the receiver wallets you want, and the amounts you want to transfer. You can delete some of the lines in this list, or add more if you want.

# You must edit the values of MYWALLET and PEM_FILE
# and then modify the TRANSACTIONS list.

MYWALLET="erd1sg4u62lzvgkeu4grnlwn7h2s92rqf8a64z48pl9c7us37ajv9u8qj9w8xg"
PEM_FILE="./walletKey.pem"

declare -a TRANSACTIONS=(
  "erd1qx22s3yyawvfvsn3573r3nkwk6c9efj756ex5cnqk5ul6fz5nggqhaze4y 2"
  "erd1qx22s3yyawvfvsn3573r3nkwk6c9efj756ex5cnqk5ul6fz5nggqhaze4y 4"
  "erd1qx22s3yyawvfvsn3573r3nkwk6c9efj756ex5cnqk5ul6fz5nggqhaze4y 8"
  "erd1nuxuu4s07m0348tacnu7et3x9dsskj6rql3yax2qsmct8uux3qqqf86kl9 16"
  "erd1nuxuu4s07m0348tacnu7et3x9dsskj6rql3yax2qsmct8uux3qqqf86kl9 32"
  "erd1nuxuu4s07m0348tacnu7et3x9dsskj6rql3yax2qsmct8uux3qqqf86kl9 64"
  "erd1a6wdtlr72ejdf8szvxaz4xvtcq8650az9005s9s92n7vpkj0lylsmja0h0 128"
  "erd1a6wdtlr72ejdf8szvxaz4xvtcq8650az9005s9s92n7vpkj0lylsmja0h0 256"
  "erd1a6wdtlr72ejdf8szvxaz4xvtcq8650az9005s9s92n7vpkj0lylsmja0h0 512"
)



# DO NOT MODIFY ANYTHING FROM HERE ON

PROXY="https://gateway.elrond.com"
DENOMINATION="000000000000000000"

# We recall the nonce of the wallet
NONCE=$(erdpy account get --nonce --address="$MYWALLET" --proxy="$PROXY")

function send-bulk-tx {
  for transaction in "${TRANSACTIONS[@]}"; do
    set -- $transaction
    erdpy --verbose tx new --send --outfile="bon-mission-tx-$NONCE.json" --pem=$PEM_FILE --nonce=$NONCE --receiver=$1 --value="$2$DENOMINATION" --gas-limit=50000 --proxy=$PROXY
    echo "Transaction sent with nonce $NONCE and backed up to bon-mission-tx-$NONCE.json."
    (( NONCE++ ))
  done
}

Save the above code into a file called transactions.sh. We will need it in the next step.

Step 3: Send the transactions

Let's send the transactions:

source ./transactions.sh
send-bulk-tx

The first command imports the send-bulk-tx command from the transactions.sh file (see the file in step 1 above). Then the second command executes send-bulk-tx, which will call erdpy for each of the transactions in the set.

Done!

← Deriving the Wallet PEM fileWriting and running erdpy scripts →
  • Step 1: Prepare the PEM file
  • Step 2: Prepare the transaction set
  • Step 3: Send the transactions
Made withby the Elrond team.
GithubChat
Main siteWalletExplorerBridgeDocsGrowthMaiarMaiar Exchange