Home·Validation Tools·Mantra Chain
Mantra Chain logo
By LavenderFive

Learn how to interact with mantrachain nodes using different endpoint types.

#Available Endpoints

ServiceEndpoint
REST APIhttps://testnet-rest.lavenderfive.com:443/mantrachain/
RPChttps://testnet-rpc.lavenderfive.com:443/mantrachain/
gRPCtestnet-mantrachain.lavenderfive.com:443/
WebSocketwss://testnet-rpc.lavenderfive.com:443/mantrachain/ws/
JSON-RPCNot available
WS-JSON-RPCNot available
    Some endpoints may require an API key for access. You can get one by signing up at https://lavenderfive.com.

#🌐 API Documentation

Interactive Swagger documentation for mantrachain endpoints is available at: https://testnet-rest.lavenderfive.com:443/mantrachain//swagger/

This documentation provides a comprehensive overview of all available endpoints, their parameters, and response formats. You can test API calls directly from the Swagger interface. It might however not be available for all networks due to how their RPC interface is coded.

#🌐 REST API Examples

#Cosmos SDK < v0.50

# Query Validators
curl -X GET "https://testnet-rest.lavenderfive.com:443/mantrachain//cosmos/staking/v1beta1/validators" \
  -H "x-api-key: your-api-key-uuid"

# Query Bank Balance
curl -X GET "https://testnet-rest.lavenderfive.com:443/mantrachain//cosmos/bank/v1beta1/balances/cosmos1..." \
  -H "x-api-key: your-api-key-uuid"

#Cosmos SDK >= v0.50

# Query Validators
curl -X GET "https://testnet-rest.lavenderfive.com:443/mantrachain//staking/validators" \
  -H "x-api-key: your-api-key-uuid"

# Query Delegations
curl -X GET "https://testnet-rest.lavenderfive.com:443/mantrachain//staking/validators/{{ prefix }}valoper1.../delegations/{{ prefix }}1..." \
  -H "x-api-key: your-api-key-uuid"
    Cosmos SDK v0.50+ removes the "v1beta1" prefix and "cosmos" namespace from endpoints for cleaner URLs. Both styles are shown above for compatibility.

#Query Account Balance (JavaScript)

const address = "cosmos1..."; // Your address
const endpoint = "https://testnet-rest.lavenderfive.com:443/mantrachain/";

async function getBalance() {
  // For SDK &gt;= v0.50
  const path = `/bank/balances/${address}`;
  // For SDK &lt; v0.50
  // const path = `/cosmos/bank/v1beta1/balances/${address}`;
  
  const response = await fetch(
    `${endpoint}${path}`,
    {
      headers: {
        'x-api-key': 'your-api-key-uuid'
      }
    }
  );
  const data = await response.json();
  console.log(data);
}

#Query Validators (Python)

import requests

def get_validators():
    headers = {
        'x-api-key': 'your-api-key-uuid'
    }
    # For SDK &gt;= v0.50
    endpoint = f"{api}/staking/validators"
    # For SDK &lt; v0.50
    # endpoint = f"{api}/cosmos/staking/v1beta1/validators"
    
    response = requests.get(endpoint, headers=headers)
    return response.json()

#🔄 RPC Examples

#Get Network Status (curl)

curl -X GET "https://testnet-rpc.lavenderfive.com:443/mantrachain//status" \
  -H "x-api-key: your-api-key-uuid"

#Get Latest Block (JavaScript)

const endpoint = "https://testnet-rpc.lavenderfive.com:443/mantrachain/";

async function getLatestBlock() {
  const response = await fetch(
    `${endpoint}/block`,
    {
      headers: {
        'x-api-key': 'your-api-key-uuid'
      }
    }
  );
  const data = await response.json();
  console.log(data.result);
}

#📡 gRPC Examples

#Query Validator Set (grpcurl)

# For SDK &gt;= v0.50
grpcurl -H "x-api-key: your-api-key-uuid" \
  testnet-mantrachain.lavenderfive.com:443/ \
  staking.Query/Validators

# For SDK &lt; v0.50
grpcurl -H "x-api-key: your-api-key-uuid" \
  testnet-mantrachain.lavenderfive.com:443/ \
  cosmos.staking.v1beta1.Query/Validators

#Query Bank Balance (Python with grpcio)

import grpc
# For SDK &gt;= v0.50
from staking import query_pb2, query_pb2_grpc
# For SDK &lt; v0.50
# from cosmos.bank.v1beta1 import query_pb2, query_pb2_grpc

def get_balance(address):
    credentials = grpc.metadata_call_credentials(
        lambda context, callback: callback([("x-api-key", "your-api-key-uuid")], None)
    )
    
    channel = grpc.secure_channel(
        "testnet-mantrachain.lavenderfive.com:443/", 
        grpc.composite_channel_credentials(
            grpc.ssl_channel_credentials(),
            credentials
        )
    )
    
    stub = query_pb2_grpc.QueryStub(channel)
    request = query_pb2.QueryBalanceRequest(address=address)
    
    response = stub.Balance(request)
    return response
    Remember to replace `your-api-key-uuid` with your actual API key in the examples above.

#🔑 Common Response Codes

CodeDescription
200Successful request
400Bad request / Invalid parameters
401Unauthorized / Invalid API key
404Resource not found
429Too many requests
500Internal server error
    Rate limits may apply to endpoints. Please use for testing and get a trial API-key to try out a fully unlimited api for 14 days.
Chain ID:
mantra-dukong-1
Latest Version:
v2.0.0
Github:
MANTRA-Finance
Public endpoints
REST/LCD
testnet-rest.lavenderfive.com:443/mantrachain
RPC
testnet-rpc.lavenderfive.com:443/mantrachain
gRPC
testnet-mantrachain.lavenderfive.com:443
WebSocket
wss://testnet-rpc.lavenderfive.com:443/mantrachain/ws
Lavender Five
© 2022 Lavender.Five Nodes. All rights reserved.
Terms of Service.Privacy policy.Cookies policy.