Skip to main content

system_properties - JSON-RPC Method

Description#

Returns the chain properties including token decimals, token symbol(s), 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 (Acala)#

{
"jsonrpc": "2.0",
"result": {
"ss58Format": 10,
"tokenDecimals": [12, 12, 10, 10],
"tokenSymbol": ["ACA", "AUSD", "DOT", "LDOT"]
},
"id": 1
}

Code Examples#

import requests
import json
from decimal import Decimal

def get_system_properties():
url = "https://api-acala.n.dwellir.com/YOUR_API_KEY"
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"]

properties = get_system_properties()
decimals = properties["tokenDecimals"][0]
symbol = properties["tokenSymbol"][0]
ss58_format = properties["ss58Format"]

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

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)

formatter = TokenFormatter(decimals, symbol)
print(formatter.format_amount(1000000000000))