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
  • Integrate with the Endless Blockchain
  • Overview
  • Getting Started
  • Accounts on Endless
  • Transactions
  • Viewing current and historical state
  • Exchanging and tracking fungible assets
  • Exchanging and tracking coins
  • Integrating with the faucet
Export as PDF
  1. Endless Chain
  2. Build
  3. Integrate with Endless

Application Integration Guide

Integrate with the Endless Blockchain

If you provide blockchain services to your customers and wish to add the Endless blockchain to your platform, then this guide is for you. This system integrators guide will walk you through all you need to integrate the Endless blockchain into your platform.

Overview

This document will guide you through the following tasks to integrate with Endless:

  1. Prepare an environment for testing.

  2. Create an account on the blockchain.

  3. Exchange account identifiers with another entity on the blockchain, for example, to perform swaps.

  4. Create a transaction.

  5. Obtain a gas estimate and validate the transaction for correctness.

  6. Submit the transaction to the blockchain.

  7. Wait for the outcome of the transaction.

  8. Query historical transactions and interactions for a given account with a specific account, i.e., withdraws and deposits.

Getting Started

In order to get started you'll need to select a network and pick your set of tools. There are also a handful of SDKs to help accelerate development.

Choose a network

There are four well-supported networks for integrating with the Endless blockchain:

See Endless Blockchain Networks for full details on each environment.

Run a localnet

There are two options for running a localnet:

  • Install the Endless CLI and run a local development network. This path is useful for developing on the Endless blockchain, debugging Move contracts, and testing node operations. This will provide a fully featured local development environment including a single node network, a node REST API, an Indexer API, and a faucet.

  • Directly run a localnet using either the Endless source code. These paths are useful for testing changes to the Endless codebase or framework, or for building services on top of the Endless blockchain, respectively.

Either of these methods will expose a REST API service at http://127.0.0.1:8080.

Production network access

  1. Mainnet

  1. Testnet

SDKs and tools

Endless currently provides three SDKs:

Almost all developers will benefit from exploring the CLI. Using the CLI demonstrates how the CLI can be used to create accounts, transfer coins, publish Move modules, and more.

Accounts on Endless

  • An authentication key associated with their current public, private key(s).

  • A strictly increasing sequence number that represents the account's next transaction's sequence number to prevent replay attacks.

  • A strictly increasing number that represents the next distinct GUID creation number.

  • An event handle for all new types of coins added to the account.

  • An event handle for all key rotations for the account.

Read more about Accounts and set one up.

Transactions

Read more in Transactions and States.

Generating transactions

Endless supports two methods for constructing transactions:

  • Using the Endless client libraries to generate native BCS transactions.

  • Constructing JSON-encoded objects and interacting with the REST API to generate native transactions.

The preferred approach is to directly generate native BCS transactions. Generating them via the REST API enables rapid development at the cost of trusting the fullnode to generate the transaction correctly.

BCS-encoded transactions

JSON-encoded transactions

  1. The output of the above contains an object containing a message that must be signed with the sender’s private key locally.

  2. Extend the original JSON payload with the signature information and post it to the /transactions. This will return a transaction submission result that, if successful, contains a transaction hash in the hash field.

Types of transactions

Within a given transaction, the target of execution can be one of two types:

  • An entry point (formerly known as script function)

  • A script (payload)

Status of a transaction

A reasonable strategy for submitting transactions is to limit their lifetime to 30 to 60 seconds, and polling that API at regular intervals until success or several seconds after that time has elapsed. If there is no commitment on-chain, the transaction was likely discarded.

Testing transactions or transaction pre-execution

To facilitate evaluation of transactions as well as gas estimation, Endless supports a simulation API that does not require and should not contain valid signatures on transactions.

Viewing current and historical state

Most integrations into the Endless blockchain benefit from a holistic and comprehensive overview of the current and historical state of the blockchain. Endless provides historical transactions, state, and events, all the result of transaction execution.

  • Historical transactions specify the execution status, output, and tie to related events. Each transaction has a unique version number associated with it that dictates its global sequential ordering in the history of the blockchain ledger.

  • The state is the representation of all transaction outputs up to a specific version. In other words, a state version is the accumulation of all transactions inclusive of that transaction version.

  • As transactions execute, they may emit events. Events are hints about changes in on-chain data.

The storage service on a node employs two forms of pruning that erase data from nodes:

  • state

  • events, transactions, and everything else

While either of these may be disabled, storing the state versions is not particularly sustainable.

The REST API offers querying transactions and events in these ways:

Exchanging and tracking fungible assets

A user's FA is stored in FungibleStore objects owned by them. For each type of FA, every account has one primary store for that FA and optional multiple secondary stores. The difference between primary and secondary stores is the address of primary store is deterministic based on the addresses of user account and metadata object.

Transferring FAs between users

Current balance for Fungible Asset

The current balance for an EDS FA of FungibleStore is available at the account resources URL: https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::FungibleStore. The balance is stored as balance. The resource also contains a metadata object of the FA type and the frozen status. The address of the primary fungible store can be calculated as sha3_256(32-byte account address | 32-byte metadata object address | 0xFC). The metadata object address of EDS FA is 0xA.

Endless users have the option to upgrade to concurrent fungible balance to allow parallelization of balance updates, improving the performance of a single account. When a user has upgraded a fungible store balance to support concurrent update, the fungible store object will have another resource ConcurrentFungibleBalance that contains the balance of the store, and the balance field of FungibleStore will be set to 0. The current balance for an EDS FA of ConcurrentFungibleBalance (if exists) is available at the account resources URL: https://{rest_api_server}/accounts/{fungible_store_object_address}/resource/0x1::fungible_asset::ConcurrentFungibleBalance.

Therefore, to get the total balance of a fungible asset, it is either the non-zero balance of FungibleStore or the balance field of ConcurrentFungibleBalance if it exists and the balance of FungibleStore is 0.

{
    "type": "0x1::fungible_asset::FungibleStore"
    "data": {
        "balance": "0"
        "frozen": "false"
        "metadata": {
            "inner": "0xedc2704f2cef417a06d1756a04a16a9fa6faaed13af469be9cdfcac5a21a8e2e"
        }
    }
}
{
    "type": "0x1::fungible_asset::ConcurrentFungibleBalance"
    "data": {
        "balance": "233910778869"
    }
}

Exchanging and tracking coins

Coins are stored within an account under the resource CoinStore<T>. At account creation, each user has the resource CoinStore<0x1::endless_coin::EndlessCoin> or CoinStore<EndlessCoin>, for short. Within this resource is the Endless coin: Coin<EndlessCoin>.

Transferring coins between users

:::caution It is important to note that if an account has not registered a CoinStore<T> for a given T, then any transfer of type T to that account will fail. :::

Current balance for a coin

The current balance for a Coin<T> where T is the Endless coin is available at the account resources URL: https://{rest_api_server}/accounts/{address}/resource/0x1::coin::CoinStore<0x1::endless_coin::EndlessCoin>. The balance is stored within coin::amount. The resource also contains the total number of deposit and withdraw events, and the counter value within deposit_events and withdraw_events, respectively.

{
  "type": "0x1::coin::CoinStore<0x1::endless_coin::EndlessCoin>",
  "data": {
    "coin": {
      "value": "3927"
    },
    "deposit_events": {
      "counter": "1",
      "guid": {
        "id": {
          "addr": "0xcb2f940705c44ba110cd3b4f6540c96f2634938bd5f2aabd6946abf12ed88457",
          "creation_num": "2"
        }
      }
    },
    "withdraw_events": {
      "counter": "1",
      "guid": {
        "id": {
          "addr": "0xcb2f940705c44ba110cd3b4f6540c96f2634938bd5f2aabd6946abf12ed88457",
          "creation_num": "3"
        }
      }
    }
  }
}

Querying transactions

In Endless, each transaction is committed as a distinct version to the blockchain. This allows for the convenience of sharing committed transactions by their version number; to do so, query: https://{rest_server_api}/transactions/by_version/{version}

Transactions submitted by an account can also be queried via the following URL where the sequence_number matches the sequence number of the transaction: https://{rest_server_api}/account/{address}/transactions?start={sequence_number}&limit=1

A transfer transaction would appear as follows:

{
  "version": "13629679",
  "gas_used": "4",
  "success": true,
  "vm_status": "Executed successfully",
  "changes": [
    {
      "address": "0xb258b91eee04111039320a85b0c24a2dd433909e14a6b5c32ee722e0fdecfddc",
      "data": {
        "type": "0x1::coin::CoinStore<0x1::endless_coin::EndlessCoin>",
        "data": {
          "coin": {
            "value": "1000"
          },
          "deposit_events": {
            "counter": "1",
            "guid": {
              "id": {
                "addr": "0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
                "creation_num": "2",
              }
            }
          },
          ...
        }
      },
      "type": "write_resource"
    },
    ...
  ],
  "sender": "0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b",
  "sequence_number": "0",
  "max_gas_amount": "2000",
  "gas_unit_price": "1",
  "expiration_timestamp_secs": "1660616127",
  "payload": {
    "function": "0x1::endless_account::transfer",
    "arguments": [
      "0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
      "1000"
    ],
    "type": "entry_function_payload"
  },
  "events": [
    {
      "key": "0x0300000000000000810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b",
      "guid": {
        "id": {
          "addr": "0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b",
          "creation_num": "3"
          }
        }
      },
      "sequence_number": "0",
      "type": "0x1::coin::WithdrawEvent",
      "data": {
        "amount": "1000"
      }
    },
    {
      "key": "0x02000000000000005098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
      guid": {
        "id": {
          "addr": "0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
          "creation_num": "2"
          }
        }
      },
      "sequence_number": "0",
      "type": "0x1::coin::DepositEvent",
      "data": {
        "amount": "1000"
      }
    }
  ],
  "timestamp": "1660615531147935",
  "type": "user_transaction"
}

Here is a breakdown of the information in a transaction:

  • version indicates the globally unique identifier for this transaction, its ordered position in all the committed transactions on the blockchain

  • sender is the account address of the entity that submitted the transaction

  • gas_used is the units paid for executing the transaction

  • success and vm_status indicate whether the transaction successfully executed and any reasons why it might not have

  • changes include the final values for any state resources that have been modified during the execution of the transaction

  • events contain all the events emitted during the transaction execution

  • timestamp is the near real-time timestamp of the transaction's execution

If success is false, then vm_status will contain an error code or message that resulted in the transaction failing to succeed. When success is false, changes will be limited to gas deducted from the account and the sequence number incrementing. There will be no events.

Each event in events is differentiated by a key. The key is derived from the guid in changes. Specifically, the key is a 40-byte hex string where the first eight bytes (or 16 characters) are the little-endian representation of the creation_num in the guid of the changes event, and the remaining characters are the account address.

As events do not dictate what emitted them, it is imperative to track the path in changes to determine the source of an event. In particular, each CoinStore<T> has both a WithdrawEvent and a DepositEvent, based upon the type of coin. In order to determine which coin type is used in a transaction, an indexer can compare the guid::creation_num in a changes event combined with the address to the key for events in events.

Using the above example, events[1].guid is equivalent to changes[0].data.data.deposit_events.guid, which is {"addr": "0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e", "creation_num": "2"}.

:::tip The key field will be going away in favor of guid :::

Querying events

Endless provides clear and canonical events for all withdraw and deposit of coins. This can be used in coordination with the associated transactions to present to a user the change of their account balance over time, when that happened, and what caused it. With some amount of additional parsing, metadata such as the transaction type and the other parties involved can also be shared.

Query events by handle URL: https://{rest_api_server}/accounts/{address}/events/0x1::coin::CoinStore<0x1::endless_coin::EndlessCoin>/withdraw_events

[
  {
    "version":"13629679",
    "key": "0x0300000000000000cb2f940705c44ba110cd3b4f6540c96f2634938bd5f2aabd6946abf12ed88457",
    "guid": {
      "id": {
        "addr": "0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b",
        "creation_num": "3"
        }
      }
    },
    "sequence_number": "0",
    "type": "0x1::coin::WithdrawEvent",
    "data": {
      "amount": "1000"
    }
  }
]

Gather more information from the transaction that generated the event by querying https://{rest_server_api}/transactions/by_version/{version} where {version} is the same value as the {version} in the event query.

:::tip

When tracking full movement of coins, normally events are sufficient. 0x1::endless_coin::EndlessCoin, however, requires considering gas_used for each transaction sent from the given account since it represents gas in Endless. To reduce unnecessary overhead, extracting gas fees due to transactions does not emit an event. All transactions for an account can be retrieved from this API: https://{rest_server_api}/accounts/{address}/transactions

:::

Tracking coin balance changes

Consider the transaction from the earlier section, but now with an arbitrary coin 0x1337::my_coin::MyCoin and some gas parameters changed:

{
  "version": "13629679",
  "gas_used": "20",
  "success": true,
  "vm_status": "Executed successfully",
  "changes": [
    {
      "address": "0xb258b91eee04111039320a85b0c24a2dd433909e14a6b5c32ee722e0fdecfddc",
      "data": {
        "type": "0x1::coin::CoinStore<0x1337::my_coin::MyCoin>",
        "data": {
          "coin": {
            "value": "1000"
          },
          "deposit_events": {
            "counter": "1",
            "guid": {
              "id": {
                "addr": "0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
                "creation_num": "2",
              }
            }
          },
          ...
        }
      },
      "type": "write_resource"
    },
    ...
  ],
  "sender": "0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b",
  "sequence_number": "0",
  "max_gas_amount": "2000",
  "gas_unit_price": "110",
  "expiration_timestamp_secs": "1660616127",
  "payload": {
    "function": "0x1::endless_account::transfer_coins",
    "type_arguments": [
      "0x1337::my_coin::MyCoin"
    ],
    "arguments": [
      "0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
      "1000"
    ],
    "type": "entry_function_payload"
  },
  "events": [
    {
      "key": "0x0300000000000000810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b",
      "guid": {
        "id": {
          "addr": "0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b",
          "creation_num": "3"
          }
        }
      },
      "sequence_number": "0",
      "type": "0x1::coin::WithdrawEvent",
      "data": {
        "amount": "1000"
      }
    },
    {
      "key": "0x02000000000000005098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
      guid": {
        "id": {
          "addr": "0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e",
          "creation_num": "2"
          }
        }
      },
      "sequence_number": "0",
      "type": "0x1::coin::DepositEvent",
      "data": {
        "amount": "1000"
      }
    }
  ],
  "timestamp": "1660615531147935",
  "type": "user_transaction"
}

There are three balance changes in this transaction:

  1. A withdrawal of 1000 of 0x1337::my_coin::MyCoin from the transaction sending account 0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b

  2. A deposit of 1000 of 0x1337::my_coin::MyCoin to receiving account 0x5098df8e7969b58ab3bd2d440c6203f64c60a1fd5c08b9d4abe6ae4216246c3e

  3. A gas fee 2200 of 0x1::endless_coin::EndlessCoin from the sending account 0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b

To retrieve the withdrawal information:

  1. Scan the changes for 0x1::coin::CoinStore<CoinType>. Note the CoinType is a generic signifying which coin is stored in the store. In this example, the CoinType is 0x1337::my_coin::MyCoin.

  2. Retrieve the guid for withdraw_events. In this example, the guid contains addr 0x810026ca8291dd88b5b30a1d3ca2edd683d33d06c4a7f7c451d96f6d47bc5e8b and creation_num 3.

  3. Scan for events with this guid and extract the event associated with it. In this example, it is the 0x1::coin::WithdrawEvent.

  4. Note the amount field will be the number of CoinType removed from the account in the guid. In this example, it is 1000.

To retrieve the deposit information, it's the same as withdrawal except:

  1. The guid used is under deposit_events

  2. The amount will be a positive increase on the account's balance.

  3. The event's name will be: 0x1::coin::DepositEvent

To retrieve the gas fee:

  1. The gas_used field must be multiplied times the gas_unit_price. In this example, gas_used=20 and gas_unit_price=110 so the total gas coins withdrawn is 2200.

  2. Gas is always: 0x1::endless_coin::EndlessCoin

To retrieve information about the number of decimals of the coin:

  1. You can retrieve the number of decimals for a coin via its: 0x1::coin::CoinInfo<CoinType>

  2. This will be located at the address of the coin type. In this example, you would need to look up 0x1::coin::CoinInfo<0x1337::my_coin::MyCoin> at address 0x1337.

:::tip If you always use the events in this manner, you won't miss any balance changes for an account. By monitoring the events, you will find all balance changes in the 0x1::coin::CoinStore:

  1. Coin mints

  2. Coin burns

  3. Coin transfers

  4. Staking coins

  5. Withdrawing staked coins

  6. Transfers not derived from coin::transfer

:::

To create some sample data to explore, conduct "Your first transaction".

To learn more about coin creation, make "Your First Coin".

Integrating with the faucet

Differences between devnet and testnet

What are the differences between devnet and testnet? Effectively none. In the past, the testnet faucet had a Captcha in front of it, making it unqueryable by normal means. This is no longer true.

The endpoints for each faucet are:

  • Devnet: https://faucet.devnet.endlesslabs.com

  • Testnet: https://faucet.testnet.endlesslabs.com

Calling the faucet: JavaScript / TypeScript

Example use:

import {
  EndlessFaucetClient,
  FundRequest,
} from "@endless-labs/endless-faucet-client";

async function callFaucet(amount: number, address: string): Promise<string[]> {
  const faucetClient = new EndlessFaucetClient({
    BASE: "https://faucet.devnet.endlesslabs.com",
  });
  const request: FundRequest = {
    amount,
    address,
  };
  const response = await faucetClient.fund({ requestBody: request });
  return response.txn_hashes;
}

Calling the faucet: Other languages

If you are trying to call the faucet in other languages, you have two options:

  1. Call the faucet on your own.

For the latter, you will want to build a query similar to this:

curl -X POST 'https://faucet.devnet.endlesslabs.com/mint?amount=10000&address=0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6'

This means mint 10000 OCTA to address 0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6.

PreviousEndless Token OverviewNextEndless VSCode extension

Last updated 2 months ago

-- our standalone tool for local development against a known version of the codebase with no external network.

-- a shared resource for the community, data resets weekly, weekly update from endless-core main branch.

-- a shared resource for the community, data will be preserved, network configuration will mimic Mainnet.

-- a production network with real assets.

REST API:

REST API Spec:

Indexer API:

Indexer API Spec:

REST API:

REST API Spec:

Indexer API:

Indexer API Spec:

An account represents an entity on the Endless blockchain that can send transactions. Each account is identified by a particular 32-byte account address and is a container for Move modules and resources. On Endless, accounts must be created on-chain prior to any blockchain operations involving that account. The Endless framework supports implicitly creating accounts when transferring Endless coin via .

At creation, an contains:

Endless transactions are encoded in . Transactions contain information such as the sender’s account address, authentication from the sender, the desired operation to be performed on the Endless blockchain, and the amount of gas the sender is willing to pay to execute the transaction.

BCS-encoded transactions can be submitted to the /transactions endpoint but must specify Content-Type: application/x.endless.signed_transaction+bcs in the HTTP headers. This will return a transaction submission result that, if successful, contains a transaction hash in the hash .

JSON-encoded transactions can be generated via the , following these steps:

First construct an appropriate JSON payload with function generateTransactionPayload as demonstrated in the .

JSON-encoded transactions allow for rapid development and support seamless ABI conversions of transaction arguments to native types. However, most system integrators prefer to generate transactions within their own tech stack. Both the and support generating BCS transactions.

Both and support the generation of transactions that target entry points. This guide points out many of those entry points, such as endless_account::transfer and endless_account::create_account.

Most basic operations on the Endless blockchain should be available via entry point calls. While one could submit multiple transactions calling entry points in series, such operations benefit from being called atomically from a single transaction. A script payload transaction can call any public (entry) function defined within any module. Here's an example that uses a MultiAgent transaction to extract funds from two accounts and deposit them into two other accounts. This is a that uses the bytecode generated by compiling that script. Currently, there is limited support for script payloads in TypeScript.

Obtain transaction status by querying the API with the hash returned during the submission of the transaction.

The simulation API is a synchronous API that executes a transaction and returns the output inclusive of gas usage. The simulation API can be accessed by submitting a transaction to .

Both the and support the simulation API. Note the output and gas used may change based upon the state of the account. For gas estimations, we recommend that the maximum gas amount be larger than the amount quoted by this API.

Events and transactions pruning can be disabled via setting the to false. This is default behavior in Mainnet. In the near future, Endless will provide indexers that mitigate the need to directly query from a node.

Endless has a standard . Different types of fungible asset (FA) can be represented in this standard through the use of distinct metadata object.

FAs, including EDS, can be transferred between users' primary stores via the function. For any FungibleStores, would be invoked with FungibleStore object addresses.

Endless has a standard . Different types of coins can be represented in this type through the use of distinct structs that represent the type parameter or generic for Coin<T>.

Coins, including EDS, can be transferred between users via the function for all coins and for Endless coins.

This tutorial is for SDK and wallet developers who want to integrate with the . If you are a dapp developer, you should access the faucet through an existing SDK or CLI instead.

If you are building a client in JavaScript or TypeScript, you should make use of the package. This client is generated based on the OpenAPI spec published by the faucet service.

Generate a client from the .

Localnet
Devnet
Testnet
Mainnet
https://rpc.endless.link/v1
https://rpc.endless.link/v1/spec#/
https://idx.endless.link/v1
https://idx.endless.link/v1
https://rpc-test.endless.link/v1
https://rpc-test.endless.link/v1/spec#/
https://idx-testnet.endless.link/v1
https://idx-testnet.endless.link/v1
Typescript SDK
Golang SDK
Rust SDK
endless_account::transfer
Endless account
Binary Canonical Serialization (BCS)
field
REST API
Typescript SDK
TypeScript SDK
Rust SDK
Rust
TypeScript
Move script
Python example
/transactions/by_hash/{hash}
/transactions/simulate
Typescript SDK
Python SDK
enable_ledger_pruner
Transactions for an account
Transaction by version
Events by event handle
Fungible Asset
primary_fungible_store::transfer
fungible_asset::transfer
Coin type
endless_account::transfer_coins
endless_account::transfer
Endless Faucet
@endless-labs/endless-faucet-client
OpenAPI spec