/accounts/{accountId}/convert - Polkadot

This endpoint converts an account address between SS58 formats and its raw AccountId, using the given prefix and scheme.

On GetBlock's unified endpoint, Asset Hub is the default network. To call this endpoint against the Relaychain, add an /rc prefix to the path (for example, /rc/accounts/{accountId}/convert).

Endpoint

httpGET /accounts/{accountId}/convert

Path Parameters

ParameterTypeDescription
accountIdstringSS58 address or public key

Query Parameters

ParameterTypeRequiredDescription
schemestringNoSignature scheme (sr25519, ed25519, ecdsa)
prefixintegerNoTarget SS58 prefix (0 for Polkadot)
publicKeybooleanNoWhether the input is a public key

Request

bashcurl --location 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/accounts/15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5/convert?prefix=0'

example.js

javascriptconst response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/accounts/15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5/convert?prefix=0');
const data = await response.json();
console.log(data);

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/accounts/15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5/convert?prefix=0')
print(response.json())

Response

json{
  "ss58Prefix": "0",
  "network": "polkadot",
  "address": "15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5",
  "accountId": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
  "scheme": "sr25519",
  "publicKey": true
}

Response Fields

FieldTypeDescription
ss58PrefixstringThe SS58 prefix used
networkstringThe network name for the prefix
addressstringThe SS58-encoded address
accountIdstringThe raw 32-byte AccountId, hex-encoded

Use Cases

  • Address Conversion: Convert an address between chain prefixes
  • Cross-Chain UX: Show the same account across networks
  • Key Handling: Derive the AccountId from an address
  • Indexing: Normalize addresses to a canonical form