GetChains will return the list of supported chains by Trails.
curl --request POST \
--url https://api.example.com/rpc/Trails/GetChains \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.example.com/rpc/Trails/GetChains"
payload = {}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.example.com/rpc/Trails/GetChains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/rpc/Trails/GetChains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/rpc/Trails/GetChains"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/rpc/Trails/GetChains")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/GetChains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"chains": [
{
"id": 123,
"name": "<string>",
"nativeCurrency": {
"name": "<string>",
"symbol": "<string>",
"decimals": 123
},
"logoUri": "<string>",
"blockExplorer": {
"name": "<string>",
"url": "<string>"
}
}
]
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Chains & Discovery
GetChains
POST
/
rpc
/
Trails
/
GetChains
GetChains will return the list of supported chains by Trails.
curl --request POST \
--url https://api.example.com/rpc/Trails/GetChains \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.example.com/rpc/Trails/GetChains"
payload = {}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.example.com/rpc/Trails/GetChains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/rpc/Trails/GetChains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/rpc/Trails/GetChains"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/rpc/Trails/GetChains")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/rpc/Trails/GetChains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"chains": [
{
"id": 123,
"name": "<string>",
"nativeCurrency": {
"name": "<string>",
"symbol": "<string>",
"decimals": 123
},
"logoUri": "<string>",
"blockExplorer": {
"name": "<string>",
"url": "<string>"
}
}
]
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Overview
TheGetChains endpoint retrieves a list of all blockchain networks supported by Trails. This is useful for building chain selection UIs, validating user inputs, and discovering which networks are available for cross-chain transactions.
Use Cases
- Build chain selection dropdowns in your UI
- Validate that user-selected chains are supported
- Display chain metadata (name, logo, native token)
- Filter chains by bridging support
- Identify testnet vs mainnet networks
- Get block explorer URLs for transaction links
Request Parameters
Optional Fields
- routeProvider (string): Filter chains by a specific route provider (e.g., “CCTP”, “RELAY”)
Response
The response includes:- chains (ChainInfo[]): Array of supported chain information
ChainInfo Object Structure
Each chain object contains:- id (number): The chain ID
- name (string): Human-readable chain name
- tokenName (string): Native token name (e.g., “Ether”)
- tokenSymbol (string): Native token symbol (e.g., “ETH”)
- tokenDecimals (number): Native token decimals
- isTestnet (boolean): Whether this is a testnet
- supportsBridging (boolean): Whether bridging is supported on this chain
- logoUri (string, optional): URL to chain logo
- blockExplorerUrl (string, optional): Block explorer base URL
Examples
Get All Supported Chains
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetChains', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({})
});
const { chains } = await response.json();
console.log('Supported chains:', chains.length);
chains.forEach(chain => {
console.log(`${chain.name} (${chain.id}): ${chain.tokenSymbol}`);
});
Filter by Route Provider
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetChains', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({
routeProvider: 'CCTP' // Get chains supported by Circle's CCTP
})
});
const { chains } = await response.json();
console.log('CCTP-supported chains:', chains.map(c => c.name));
Build Chain Selector UI
import { useEffect, useState } from 'react';
interface ChainInfo {
id: number;
name: string;
tokenSymbol: string;
logoUri?: string;
isTestnet: boolean;
supportsBridging: boolean;
}
export const ChainSelector = ({
onSelect,
excludeTestnets = true
}: {
onSelect: (chainId: number) => void;
excludeTestnets?: boolean;
}) => {
const [chains, setChains] = useState<ChainInfo[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetch('https://trails-api.sequence.app/rpc/Trails/GetChains', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({})
})
.then(res => res.json())
.then(({ chains }) => {
const filtered = excludeTestnets
? chains.filter((c: ChainInfo) => !c.isTestnet)
: chains;
setChains(filtered);
setLoading(false);
});
}, [excludeTestnets]);
if (loading) return <div>Loading chains...</div>;
return (
<select onChange={(e) => onSelect(Number(e.target.value))}>
<option value="">Select a chain</option>
{chains.map(chain => (
<option key={chain.id} value={chain.id}>
{chain.name} ({chain.tokenSymbol})
</option>
))}
</select>
);
};
Get Chains with Bridging Support
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/GetChains', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY'
},
body: JSON.stringify({})
});
const { chains } = await response.json();
// Filter to only chains that support bridging
const bridgableChains = chains.filter(chain => chain.supportsBridging);
console.log('Chains with bridging support:');
bridgableChains.forEach(chain => {
console.log(`- ${chain.name} (${chain.id})`);
});
Common Chain IDs
| Chain | Chain ID | Native Token |
|---|---|---|
| Ethereum | 1 | ETH |
| Polygon | 137 | MATIC |
| Arbitrum One | 42161 | ETH |
| Optimism | 10 | ETH |
| Base | 8453 | ETH |
| Avalanche | 43114 | AVAX |
| BNB Chain | 56 | BNB |
Chain support is continuously expanding. Use this endpoint to get the current list rather than hardcoding chain IDs.
Next Steps
GetTokenList
Get available tokens for selected chains
QuoteIntent
Request a quote for cross-chain transactions
Was this page helpful?