This document introduces how to use the API to retrieve the universal names on SPACE ID
Background
SPACE ID is a decentralized universal name service network that allows users to register .bnb domain name. In some use cases, people tend to use the universal names instead of the wallet address, which is usually composed of the prefix "0x" and hexadecimal characters. The wallet address is difficult to remember and recognize by most people, so that's why we need a universal name service to make it more efficient. NodeReal, as the Web3 infrastructure service provider, established this API to help you retrieve the names and addresses registered on SPACE ID easily.
Get started
The first thing you need to do is Create a MegaNode account and get your API key. You can find the latest SPACE ID API endpoint on our API marketplace.
Or, you can find the endpoint below, and then you can start to send requests to retrieve the data you need:
https://open-platform.nodereal.io/{apikey}/spaceid/domain/names/byOwners
https://open-platform.nodereal.io/{apikey}/spaceid/domain/names/byBinds
https://open-platform.nodereal.io/{apikey}/spaceid/domain/binds/byNames
How do I get the API key?
You can get the API key from your MegaNode BSC app. Please refer to this link.
Also, you will need to replace the {apikey} here with your BSC app API key.
Let me recap what you will need to access the data:
- Get a MegaNode account and create a BNB Smart Chain app
- Copy the API key
- Start sending requests with the endpoints
API specification
We provide 3 APIs to help you retrieve the names and addresses from SPACE ID.
- byOwners: Retrieve the names registered under the given address
- byBinds: Retrieve the names bound to the given address
- byNames: Retrieve the address by the bound name
Difference between byOwner and byBinds
In SPACE ID, the owner is the one who owns the universal name. The owner could map the name with other addresses. So you might get different results while sending the same payload in these two APIs.
byOwners
Parameter
- address: the owner's wallet address
Response
- address: the owner's wallet address
- nodeHash: the hash of this domain name
- bind: the binding address
- name: the domain name (you would need to add .bnb to get the full domain name)
- expires: the expiration time of this domain name
Example
[
"0x159bc0357b89301dbfb110bee5e05c42c9db3798"
]
{
"0x159BC0357B89301dbFb110Bee5e05C42C9dB3798": [
{
"nodeHash": "0xdb99baace34eab2e2213adcc9940080fdb70bfaa15abdbf28fc61fca28da1b14",
"bind": "0x159bc0357b89301dbfb110bee5e05c42c9db3798",
"name": "defichad",
"expires": "2023-08-24T20:36:26Z"
},
{
"nodeHash": "0xb492a756f29f6030e974b3fda71b255bd20c61e23e3977321d4a895833631628",
"bind": "0x159bc0357b89301dbfb110bee5e05c42c9db3798",
"name": "michaelsaylor",
"expires": "2023-08-24T20:35:59Z"
},
{
"nodeHash": "0x5431389acdea9db45b4d758954f139eb4d947c4e6293843b51ea0dbcd720620a",
"bind": "0x159bc0357b89301dbfb110bee5e05c42c9db3798",
"name": "win",
"expires": "2023-08-24T20:38:29Z"
}
]
}
byBinds
Parameter
- address: the wallet address to query
Response
- address: the wallet address to query
- nameArray: an array for all bound names (without .bnb)
Example
[
"0x159bc0357b89301dbfb110bee5e05c42c9db3798"
]
{
"0x159BC0357B89301dbFb110Bee5e05C42C9dB3798": [
"defichad",
"michaelsaylor",
"win"
]
}
byNames
Parameter
- name: the name to query (without .bnb)
Response
- address: the name to query (without .bnb)
- nodeHash: the hash of this domain name
- bind: the binding address
- name: the domain name (without .bnb)
- expires: the expiration time of this domain name
Example
[
"win"
]
{
"win": {
"nodeHash": "0x5431389acdea9db45b4d758954f139eb4d947c4e6293843b51ea0dbcd720620a",
"bind": "0x159bc0357b89301dbfb110bee5e05c42c9db3798",
"name": "win",
"expires": "2023-08-24T20:38:29Z"
}
}