For the complete documentation index, see llms.txt. This page is also available as Markdown.

/accounts/{accountId}/convert - Polkadot

Example code for the /accounts/{accountId}/convert REST method. Complete guide on how to use /accounts/{accountId}/convert REST in GetBlock Web3 documentation.

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

GET /accounts/{accountId}/convert

Path Parameters

Parameter
Type
Description

accountId

string

SS58 address or public key

Query Parameters

Parameter
Type
Required
Description

scheme

string

No

Signature scheme (sr25519, ed25519, ecdsa)

prefix

integer

No

Target SS58 prefix (0 for Polkadot)

publicKey

boolean

No

Whether the input is a public key

Request

curl --location 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/accounts/15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5/convert?prefix=0'
example.js
const 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
import requests

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

Response

Response Fields

Field
Type
Description

ss58Prefix

string

The SS58 prefix used

network

string

The network name for the prefix

address

string

The SS58-encoded address

accountId

string

The 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

Last updated

Was this helpful?