⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

system_properties - JSON-RPC Method

Description#

Returns the chain properties including token decimals, token symbol, and SS58 address format. This JSON-RPC method provides essential configuration information needed for properly formatting addresses and token amounts in applications.

Parameters#

This method does not require any parameters.

Returns#

FieldTypeDescription
ss58FormatnumberSS58 address format for this chain
tokenDecimalsarrayArray of token decimal places
tokenSymbolarrayArray of token symbols

Request Example#

{
"jsonrpc": "2.0",
"method": "system_properties",
"params": [],
"id": 1
}

Response Example#

{
"jsonrpc": "2.0",
"result": {
"ss58Format": 0,
"tokenDecimals": [10],
"tokenSymbol": ["DOT"]
},
"id": 1
}

Code Examples#

import requests
import json
from decimal import Decimal

def get_system_properties():
url = "https://api-asset-hub-polkadot.n.dwellir.com"
headers = {
"Content-Type": "application/json"
}

payload = {
"jsonrpc": "2.0",
"method": "system_properties",
"params": [],
"id": 1
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
return response.json()["result"]

# Get and use chain properties
properties = get_system_properties()
decimals = properties["tokenDecimals"][0]
symbol = properties["tokenSymbol"][0]
ss58_format = properties["ss58Format"]

print(f"Token: {symbol}")
print(f"Decimals: {decimals}")
print(f"SS58 Format: {ss58_format}")

# Create formatter class
class TokenFormatter:
def __init__(self, decimals, symbol):
self.decimals = decimals
self.symbol = symbol
self.unit = Decimal(10) ** decimals

def format_amount(self, raw_amount):
amount = Decimal(raw_amount) / self.unit
return f"{amount:.4f} {self.symbol}"

def to_raw(self, amount):
return int(Decimal(amount) * self.unit)

# Usage
formatter = TokenFormatter(decimals, symbol)
print(formatter.format_amount(10000000000)) # 1.0000 DOT
print(formatter.to_raw(1.5)) # 15000000000

Common Chain Properties#

ChainSS58 FormatSymbolDecimals
Polkadot0DOT10
Kusama2KSM12
Westend42WND12
Generic Substrate42UNIT12

Address Formatting Example#

import { encodeAddress, decodeAddress } from '@polkadot/util-crypto';

async function formatAddressForChain(address) {
const properties = await getChainProperties();
const ss58Format = properties.ss58Format;

// Decode from any format
const decoded = decodeAddress(address);

// Re-encode with chain's format
const formatted = encodeAddress(decoded, ss58Format);

console.log(`Original: ${address}`);
console.log(`Formatted for chain: ${formatted}`);

return formatted;
}

// Example
const genericAddress = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const chainAddress = await formatAddressForChain(genericAddress);

Use Cases#

  1. UI Configuration: Set up correct token display in interfaces
  2. Address Formatting: Format addresses for the specific chain
  3. Balance Display: Show balances with correct decimals
  4. Transaction Creation: Calculate fees and amounts correctly
  5. Multi-chain Support: Handle different chains dynamically

Notes#

  • Properties are chain-specific and may vary
  • Some chains support multiple tokens
  • SS58 format determines address encoding
  • Always use these properties for formatting
  • Properties rarely change but should be fetched on init