Docs

Docs

  • Develop
  • Validate
  • Integrate
  • Learn

›Developers

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

Set up a Local Testnet (advanced)

How to set up a local Elrond Testnet on a workstation.

Prerequisites

First, clone elrond-go and elrond-proxy-go in a directory of your choice.

$ mkdir mytestnet && cd mytestnet
$ git clone git@github.com:ElrondNetwork/elrond-go.git
$ git clone git@github.com:ElrondNetwork/elrond-proxy-go.git

Then, run the prerequisites command.

$ cd elrond-go/scripts/testnet
$ ./prerequisites.sh

This will install some packages and also clone the elrond-deploy-go repository, as a sibling of the previously cloned elrond-go.

Depending on your Linux distribution, you may need to run the following commands as well:

sudo apt install tmux
sudo apt install gnome-terminal

Configure the Testnet

The variables that dictate the structure of the Testnet are located in the file scripts/testnet/variables.sh. For example:

export TESTNETDIR="$HOME/Elrond/testnet"
export SHARDCOUNT=2
...

You can override the default variables by creating a new file called local.sh, as a sibling of variables.sh. For example, in order to use a different directory than the default one:

local.sh
export TESTNETDIR="$HOME/Desktop/mytestnet/sandbox"
export USETMUX=1
export NODETERMUI=0

Once ready with overriding the desired parameters, run the config command.

$ ./config.sh

After that, you can inspect the generated configuration files in the specified folder:

$HOME/Desktop/mytestnet/sandbox
├── filegen
│   ├── filegen
│   └── output
│       ├── delegationWalletKey.pem
│       ├── delegators.pem
│       ├── genesis.json
│       ├── genesisSmartContracts.json
│       ├── nodesSetup.json
│       ├── validatorKey.pem
│       └── walletKey.pem
├── node
│   └── config
│       ├── api.toml
│       ├── config_observer.toml
│       ├── config_validator.toml
│       ├── delegationWalletKey.pem
│       ├── delegators.pem
│       ├── economics.toml
│       ├── external.toml
│       ├── gasSchedule.toml
│       ├── genesisContracts
│       │   ├── delegation.wasm
│       │   └── dns.wasm
│       ├── genesis.json
│       ├── genesisSmartContracts.json
│       ├── nodesSetup.json
│       ├── p2p.toml
│       ├── prefs.toml
│       ├── ratings.toml
│       ├── systemSmartContractsConfig.toml
│       ├── validatorKey.pem
│       └── walletKey.pem
├── node_working_dirs
├── proxy
│   └── config
│       ├── config.toml
│       ├── economics.toml
│       ├── external.toml
│       └── walletKey.pem
└── seednode
    └── config
        ├── config.toml
        └── p2p.toml

Starting and stopping the Testnet

In order to start the Testnet, run the start command.

$ ./start.sh debug

After waiting about 1 minute, you can inspect the logs of the running nodes in folder mytestnet/sandbox/node_working_dirs.

In order to stop the Testnet, run the stop command.

$ ./stop.sh

If desired, you can also pause and resume the Testnet (without actually stopping the running nodes):

$ ./pause.sh
$ ./resume.sh

Recreating the Testnet

In order to destroy the Testnet, run the clean command:

./stop.sh
./clean.sh
Run config after clean

After running clean, you need to run config before start, in order to start the Testnet again.

If you need to recreate a Testnet from scratch, use the reset command (which also executes clean under the hood):

$ ./reset.sh

Inspecting the Proxy

By default, the local Testnet also includes a local Elrond Proxy instance, listening on port 7950. You can query in a browser or directly in the command line. Also see REST API.

$ curl http://localhost:7950/network/config

Given the request above, extract and save the fields erd_chain_id and erd_min_transaction_version from the response. You will need them in order to send transactions against your local Testnet.

Configuring erdpy

You can configure erdpy to point to your local Testnet by default:

$ erdpy config set chainID 15...
$ erdpy config set txVersion 123
$ erdpy config set proxy http://localhost:7950

Sending transactions

Let's send a simple transaction using erdpy:

$ erdpy tx new --recall-nonce --data="Hello, World" --gas-limit=70000 \
 --receiver=erd1... \
 --pem=./sandbox/node/config/walletKey.pem --pem-index=0 \
 --send

You should see the prepared transaction and the transaction hash in the stdout (or in the --outfile of your choice). Using the transaction hash, you can query the status of the transaction against the Proxy:

$ curl http://localhost:7950/transaction/1363...

Deploying and interacting with Smart Contracts

Let's deploy a Smart Contract using erdpy. We'll use the Simple Counter as an example.

Deploy
erdpy --verbose contract deploy --bytecode=./mycounter/output/counter.wasm \
 --recall-nonce --gas-limit=5000000 \
 --pem=./sandbox/node/config/walletKey.pem --pem-index=0 \
 --outfile=myCounter.json \
 --send

Upon deployment, you can check the status of the transaction and the existence of the Smart Contract:

$ curl http://localhost:7950/transaction/daf2...
$ curl http://localhost:7950/address/erd1qqqqqqqqqqqqqpgql...

If everything is fine (transaction status is executed and the code property of the address is set), you can interact with or perform queries against the deployed contract:

Call
erdpy --verbose contract call erd1qqqqqqqqqqqqqpgql... \
 --recall-nonce --gas-limit=1000000 --function=increment \
 --pem=./sandbox/node/config/walletKey.pem --pem-index=0 --outfile=myCall.json \
 --send

Query
erdpy --verbose contract query erd1qqqqqqqqqqqqqpgqlq... --function=get
← Setup a Local TestnetCreating Wallets →
  • Configure the Testnet
  • Starting and stopping the Testnet
  • Recreating the Testnet
  • Inspecting the Proxy
  • Configuring erdpy
  • Sending transactions
  • Deploying and interacting with Smart Contracts
Made withby the Elrond team.
GithubChat
Main siteWalletExplorerBridgeDocsGrowthMaiarMaiar Exchange