Endless
  • 🚀README
  • Discovery
    • 🚀Endless Web3 Genesis Cloud
    • 💎Business Model
    • 🎯Vision
    • ✈️Roadmap
    • 🪙Economics
    • 👤Team
      • Yu Xiong
      • Amit Kumar Jaiswal
      • Ned
      • 0xfun
      • Scott Trowbridge
      • Neeraj Sharma LLB
      • Amjad Suleman
      • Binu Paul
      • Eduard Romulus GOEAN
    • ❤️Developer Community
  • Endless Chain
    • Tech Docs
      • Account Address Format
      • Endless Account
      • Endless Coin(EDS)
      • Sponsored Transaction
      • On-Chain Multisig
      • Randomness
      • Safety Transaction
      • Token Locking & Distribution
    • Start
      • Learn about Endless
        • Accounts
        • Resources
        • Events
        • Transactions and States
        • Gas and Storage Fees
        • Computing Transaction Gas
        • Blocks
        • Staking
          • Delegated Staking
        • Governance
        • Endless Blockchain Deep Dive
          • Validator Nodes Overview
          • Fullnodes Overview
          • Node Networks and Synchronization
        • Move - A Web3 Language and Runtime
      • Explore Endless
      • Latest Endless Releases
      • Networks
    • Build
      • Tutorials
        • Your First Transaction
        • Your First Fungible Asset
        • Your First NFT
        • Your First Move Module
        • Your First Multisig
      • Learn the Move Language
        • The Move Book
          • Getting Started
            • Introduction
            • Modules and Scripts
          • Primitive Types
            • Move Tutorial
            • Integers
            • Bool
            • Address
            • Vector
            • Signer
            • References
            • Tuples and Unit
          • Basic Concepts
            • Local Variables and Scope
            • Equality
            • Abort and Assert
            • Conditionals
            • While, For, and Loop
            • Functions
            • Structs and Resources
            • Constants
            • Generics
            • Abilities
            • Uses and Aliases
            • Friends
            • Packages
            • Package Upgrades
            • Unit Tests
          • Global Storage
            • Global Storage - Structure
            • Global Storage - Operators
          • Reference
            • Libraries
            • Move Coding Conventions
        • Advanced Move Guides
          • Objects
            • Creating Objects
            • Configuring objects
            • Using objects
          • Move Scripts
            • Writing Move Scripts
            • Compiling Move Scripts
            • Running Move Scripts
            • Move Scripts Tutorial
          • Resource Accounts
          • Modules on Endless
          • Cryptography
          • Gas Profiling
          • Security
      • Endless Standards
        • Object
        • Endless Fungible Asset Standard
        • Endless Digital Asset Standard
        • Endless Wallet Standard
      • Endless APIs
        • Fullnode Rest API
        • Indexer Restful API
          • Indexer Installation
        • GRPC Transaction Stream
          • Running Locally
          • Custom Processors
            • End-to-End Tutorial
            • Parsing Transactions
          • Self-Hosted Transaction Stream Service
      • Endless SDKs
        • TypeScript SDK
          • Account
          • SDK Configuration
          • Fetch data from chain
          • Transaction Builder
          • HTTP Client
          • Move Types
          • Testing
          • Typescript
        • Rust SDK
        • Go SDK
      • Endless CLI
        • Install the Endless CLI
          • Install On Mac
          • Install On Alibaba Cloud
          • Install On Linux
          • Install On Windows
        • CLI Configuration
        • Use Endless CLI
          • Working With Move Contracts
            • Arguments in JSON Tutorial
          • Trying Things On-Chain
            • Look Up On-Chain Account Info
            • Create Test Accounts
          • Running A Local Network
            • Running a Public Network
          • Managing a Network Node
      • Integrate with Endless
        • Endless Token Overview
        • Application Integration Guide
      • Endless VSCode extension
      • Advanced Builder Guides
        • Develop Locally
          • Running a Local Network
          • Run a Localnet with Validator
    • Nodes
      • Learn about Nodes
      • Run a Validator and VFN
        • Node Requirements
        • Deploy Nodes
          • Using Docker
          • Using AWS
          • Using Azure
          • Using GCP
        • Connect Nodes
          • Connect to a Network
        • Verify Nodes
          • Node Health
          • Validator Leaderboard
      • Run a Public Fullnode
        • PFN Requirements
        • Deploy a PFN
          • Using Pre-compiled Binary
          • Using Docker
          • Using GCP 🚧 (under_construction)
        • Verify a PFN
        • Modify a PFN
          • Upgrade your PFN
          • Generate a PFN Identity
          • Customize PFN Networks
      • Bootstrap a Node
        • Bootstrap from a Snapshot
        • Bootstrap from a Backup
      • Configure a Node
        • State Synchronization
        • Data Pruning
        • Telemetry
        • Locating Node Files
          • Files For Mainnet
          • Files For Testnet
          • Files For Devnet
      • Monitor a Node
        • Node Inspection Service
        • Important Node Metrics
        • Node Health Checker
    • Reference
      • Endless Error Codes
      • Move Reference Documentation
      • Endless Glossary
    • FAQs
  • Endless Bridge
    • Intro to Endless Bridge
    • How to use bridge
    • Liquidity Management
    • Faucet
    • Developer Integration
      • Contract Integration
        • Message Contract
        • Execute Contract
      • Server-Side Integration
        • Message Sender
        • Example of Message Listener Service (Rust)
        • Example of Token Cross-Chain (JS)
  • Endless Wallet
    • User Guide
    • Basic Tutorial
    • FAQs
    • MultiAccount
    • SDK
      • Functions
      • Events
  • GameFi
    • Intro
    • GameFi & Endless
  • Endless Modules
    • Stacks
    • Storage
    • Module List
  • Endless Ecosystem
    • Intro
    • Show Cases
    • App Demo
  • Whitepaper
  • Endless SCAN
    • User Guide
  • MULTI-SIGNATURE
    • Multi-Signature User Guide
  • Regulations
    • Privacy Policy
    • Terms of Service
    • Funding Terms - Disclaimer
Powered by GitBook
On this page
  • Running a Local Network via Endless CLI
  • Starting A Local Network
Export as PDF
  1. Endless Chain
  2. Build
  3. Endless CLI
  4. Use Endless CLI

Running A Local Network

PreviousCreate Test AccountsNextRunning a Public Network

Last updated 5 months ago

Running a Local Network via Endless CLI

Local networks can be helpful when testing your code. They are not connected to any production Endless networks like mainnet, but they are useful for three main reasons:

  1. No rate limits: You can interact with hosted services like the Node API, Indexer API, and faucet with no rate-limits to speed up testing.

  2. Reproducibility: You can set up specific on-chain scenarios and restart the network from scratch at any point to return to a clean slate.

  3. High availability: The Endless devnet and testnet networks are periodically upgraded, during which time they can be unavailable. Local development networks are also always available even if you have no internet access.

Starting A Local Network

  1. Ensure you have the Endless CLI installed.

  2. Ensure you have installed.

    1. This is exclusively needed for making a production-like environment by running the Indexer API. Many downstream tools such as the Endless SDK depend on the Indexer API.

    2. Docker recommends that you install via to get automatic updates.

  3. Start Docker.

  4. Run the following command in a new terminal to start the private network:

endless node run-local-testnet

Note: Despite the name (local-testnet), this has nothing to do with the Endless testnet, it will run a network entirely local to your machine.

You should expect to see an output similar to this:

Identified node type (Validator) and chain ID (Some(testing)) from node config!


Readiness endpoint: http://0.0.0.0:8070/

Transaction stream is starting, please wait...
Node API is starting, please wait...

Completed generating configuration:
        Log file: "/Users/dport/.endless/testnet/validator.log"
        Test dir: "/Users/dport/.endless/testnet"
        Endless root key path: "/Users/dport/.endless/testnet/mint.key"
        Waypoint: 0:a7ee6363f24362a6ab7362558b7f0d2e63be78b19a73d3a8c1f5697f65aa1ac1
        ChainId: 223
        REST API endpoint: http://0.0.0.0:8080
        Metrics endpoint: http://0.0.0.0:9101/metrics
        Endlessnet fullnode network endpoint: /ip4/0.0.0.0/tcp/6181
        Indexer gRPC node stream endpoint: 0.0.0.0:50051

Endless is running, press ctrl-c to exit

Node API is ready. Endpoint: http://0.0.0.0:8080/
Transaction stream is ready. Endpoint: http://0.0.0.0:50051/

Applying post startup steps...

Setup is complete, you can now use the local testnet!
  1. Wait for the final line Setup is complete, you can now use the localnet!

    :::caution If you ran into an error, jump to the Common Errors section below. :::

As you can see from the above example output, once the local network is running, you have access to the following services:

  • Node API: This is a REST API that runs directly on the node. It enables core write functionality such as transaction submission and a limited set of read functionality, such as reading account resources or Move module information.

  • Transaction Stream Service: This is a gRPC stream of transactions used by the Indexer API. This is only relevant to you if you are developing a custom processor.

If you do not want to run any of these sub-components of a network, there are flags to disable them.

For more information on different flags you can pass when starting your local network, or configuration settings such as changing which port certain services run on, run the help command:

endless node run-local-testnet --help

Common Errors On Network Startup

If you successfully started the local network, skip to Using The Local Network.

Address Already In Use

panicked at 'error binding to 0.0.0.0:8080: error creating server listener: Address already in use (os error 48)

This means one of the ports needed by the local network is already in use by another process.

To fix this on Unix systems, you can:

  1. Identify the name and PID of the process by running lsof -i :8080.

  2. Run kill <pid> once you know the PID to free up that port.

Too many open files error

panicked at crates/endless/src/node/local_testnet/logging.rs:64:10:
called `Result::unwrap()` on an `Err` value: Os { code: 24, kind: Uncategorized, message: \"Too many open files\" }"""

This means there were too many open files on your system. On many Unix systems you can increase the maximum number of open files by adding something like this to your .zshrc:

ulimit -n 32768

Docker is not available

Unexpected error: Failed to apply pre-run steps for Postgres: Docker is not available, confirm it is installed and running. On Linux you may need to use sudo

To debug this, try the below fixes:

  1. Make sure you have docker installed by running docker --version.

  2. Ensure the Docker daemon is running by running docker info (if this errors saying Cannot connect to the Docker daemon Docker is NOT running)

  3. Make sure the socket for connecting to Docker is present on your machine in the default location. For example, on Unix systems /var/run/docker.sock should exist.

    1. If that file does not exist, open Docker Desktop and enable Settings -> Advanced -> Allow the default Docker socket to be used.

    2. Or, you can find where the Docker socket is by running docker context inspect | grep Host, then symlink that location to the default location by running sudo ln -s /Users/dport/.docker/run/docker.sock /var/run/docker.sock

Using The Local Network

Now that the network is running, you can use it like you would any other network.

So, you can create a local profile like this:

endless init --profile <your-profile-name> --network local
endless move publish --profile <your-profile-name> --package-dir /opt/git/endless-core/endless-move/move-examples/hello_blockchain --named-addresses HelloBlockchain=local

Configuring the TypeScript SDK

If you want to use the local network with the TypeScript SDK, you can use local network URLs when initializing the client object (Endless):

import { Endless, EndlessConfig, Network } from "@endless-labs/ts-sdk";

const network = Network.LOCAL;
const config = new EndlessConfig({ network });
const client = new Endless(config);

Resetting the local network

Sometimes while developing it is helpful to reset the local network back to its initial state, for example:

  • You made backwards incompatible changes to a Move module, and you'd like to redeploy it without renaming it or using a new account.

  • You want to clear all on chain state, e.g. accounts, objects, etc.

To start with a brand new local network, use the --force-restart flag:

endless node run-local-testnet --force-restart

It will then prompt you if you really want to restart the chain, to ensure that you do not delete your work by accident.

Are you sure you want to delete the existing chain? [yes/no]
> yes

If you do not want to be prompted, include --assume-yes as well:

endless node run-local-testnet --force-restart --assume-yes

If you are writing a script and would like to wait for the local network to come up with all services, you can make a GET request to http://127.0.0.1:8070. At first this will return http code . When it returns it means all the services are ready.

You can then use that profile for any commands you want to use going forward. For example, if you wanted to publish a Move module like the package to your local network you could run:

You are building a and would like to index using a fresh network.

Docker
Docker Desktop
503
200
hello_blockchain
custom indexer processor