Onchain Data đ Resolve Identitiesđ 0x AddressLearn how to use Airstack to universally resolve and reverse resolve 0x addresses to Solana addresses, Farcaster, and ENS Domains (including offchain Namestone & cb.id).
Table Of Contents
In this guide, you will learn how to use Airstack to:
Pre-requisites
Basic knowledge of GraphQL
Get Started
JavaScript/TypeScript/Python
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
npm yarn pnpm pip
React
Copy npm install @airstack/airstack-react
Node
Copy npm install @airstack/node
React
Copy yarn add @airstack/airstack-react
Node
Copy yarn add @airstack/node
React
Copy pnpm install @airstack/airstack-react
Node
Copy pnpm install @airstack/node
Then, add the following snippets to your code:
React Node Python
Copy import { init, useQuery } from "@airstack/airstack-react";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const Component = () => {
const { data, loading, error } = useQuery(query);
if (data) {
return <p>Data: {JSON.stringify(data)}</p>;
}
if (loading) {
return <p>Loading...</p>;
}
if (error) {
return <p>Error: {error.message}</p>;
}
};
Copy import { init, fetchQuery } from "@airstack/node";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const { data, error } = await fetchQuery(query);
console.log("data:", data);
console.log("error:", error);
Copy import asyncio
from airstack.execute_query import AirstackClient
api_client = AirstackClient(api_key="YOUR_AIRSTACK_API_KEY")
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main():
execute_query_client = api_client.create_execute_query_object(
query=query)
query_response = await execute_query_client.execute_query()
print(query_response.data)
asyncio.run(main())
Other Programming Languages
To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
Get All Solana Addresses Connected To 0x Address
You can get all the solana addresses connected to a given 0x addresss by using the Wallet
API:
Try Demo
Code
Query Response
Copy query MyQuery {
Wallet(
input: {identity: "0xe0235804378c31948e81441f656d826ee5998bc6", blockchain: ethereum}
) {
farcaster: socials(input: {filter: {dappName: {_eq: farcaster}}}) {
connectedAddresses { # Fetch all SOL connected addresses from Farcaster (if any)
address
chainId
blockchain
timestamp
}
}
domains {
multiChainAddresses { # Fetch all SOL address registered with ENS (if any)
address
symbol
}
}
}
}
Copy {
"data": {
"Wallet": {
"farcaster": [
{
"connectedAddresses": [ // No SOL address connected in FC
{
"address": "0xe0235804378c31948e81441f656d826ee5998bc6",
"chainId": "1",
"blockchain": "ethereum",
"timestamp": "2023-07-04T18:54:04Z"
}
]
}
],
"domains": [
{
"multiChainAddresses": [
{
// This is the SOL address registered by user in ENS
"address": "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV",
"symbol": "SOL"
},
{
"address": "0xe0235804378c31948E81441f656D826eE5998Bc6",
"symbol": "ETH"
}
]
}
]
}
}
}
Get All 0x Addresses Connected To Solana Address
You can get all the 0x addresses connected to a given solana addresss by using the Wallet
API:
Try Demo
Code
Query Response
Copy query MyQuery {
Wallet(
input: {
identity: "GJQUFnCu7ZJHxtxeaeskjnqyx8QFAN1PsiGuShDMPsqV"
blockchain: ethereum
}
) {
addresses
}
}
Copy {
"data": {
"Wallet": {
"addresses": ["0xe0235804378c31948e81441f656d826ee5998bc6"]
}
}
}
Get All Farcaster and ENS Domains Resolved From An Array of 0x addresses
You can resolve an array of 0x addresses to their Farcaster account and ENS Domains (including offchain domains, e.g. Namestone & cb.id) using the Socials
and Domains
API:
Try Demo
Code
Query Response
Copy query MyQuery {
# Get All Farcaster accounts
Socials(
input: {
filter: {
identity: {
_in: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]
}
},
blockchain: ethereum
}
) {
Social {
userAssociatedAddresses
dappName
profileName
}
}
# Get All ENS domains, including offchain Namestone & cb.id
Domains(
input: {
filter: {
resolvedAddress: {
_in: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]
}
},
blockchain: ethereum
}
) {
Domain {
resolvedAddress
name
isPrimary
}
}
}
Copy {
"data": {
"Socials": {
"Social": [
{
"userAssociatedAddresses": [
"0xadd746be46ff36f10c81d6e3ba282537f4c68077",
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
],
"dappName": "farcaster",
"profileName": "vitalik.eth" // Farcaster fname
}
]
},
"Domains": {
"Domain": [
{
"resolvedAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"name": "quantumdapps.eth",
"isPrimary": false
},
{
"resolvedAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"name": "vitalik.eth",
"isPrimary": true // This indicates that this is the primary ENS
},
// Other ENS domains
]
}
}
}
Get All The 0x addresses from a given ENS name(s)
You can get the 0x addresses of ENS names by using the Domains
API:
Try Demo
Code
Query Response
Copy query GetUserDetailsFromENS {
Domains(
input: {
filter: {
name: {
# Add more ENS Domains into the array
_in: ["vitalik.eth"]
}
},
blockchain: ethereum
}
) {
Domain {
resolvedAddress
name
}
}
}
Copy {
"data": {
"Domains": {
"Domain": [
{
"resolvedAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"name": "vitalik.eth"
}
]
}
}
}
Get All The 0x addresses from a given Namestone Subdomain or cb.id (Offchain)
You can get the 0x addresses of offchain domains (Namestone/cb.id) by using the Domains
API:
Try Demo
Code
Query Response
Copy query GetCbDotID {
Domains(
input: {
filter: {
name: {
# Add more namestone subdomains/cb.ids into the array
_in: ["yosephks.cb.id"]
}
},
blockchain: ethereum
}
) {
Domain {
resolvedAddress
name
}
}
}
Copy {
"data": {
"Domains": {
"Domain": [
{
"resolvedAddress": "0xc7486219881c780b676499868716b27095317416",
"name": "yosephks.cb.id"
}
]
}
}
}
Get All 0x addresses of Lens profile(s)
You can resolve an array of Lens profile(s) to their 0x addresses by using Socials
API:
Try Demo
Code
Query Response
Copy query GetAddressesOfLens {
Socials(
input: {
filter: {
identity: { _in: ["lens/@nader", "lens_id:0x0187b3"] }
dappName: { _eq: lens }
}
blockchain: ethereum
}
) {
Social {
profileName
profileTokenId
profileTokenIdHex
userAssociatedAddresses
}
}
}
Copy {
"data": {
"Socials": {
"Social": [
{
"profileName": "lens/@nader",
"profileTokenId": "10402",
"profileTokenIdHex": "0x028a2",
"userAssociatedAddresses": [
"0xb2ebc9b3a788afb1e942ed65b59e9e49a1ee500d"
]
},
{
"profileName": "lens/@vitalik",
"profileTokenId": "100275",
"profileTokenIdHex": "0x0187b3",
"userAssociatedAddresses": [
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
]
}
]
}
}
}
Get All 0x addresses of Farcaster user(s)
You can resolve an array of Farcaster user(s) to their 0x addresses by using Socials
API:
Try Demo
Code
Query Response
Copy query GetAddressesOfFarcasters {
Socials(
input: {
filter: {
identity: {
# Add more Farcaster fname or fid into the array
_in: ["fc_fname:dwr.eth", "fc_fid:1"]
}
}
blockchain: ethereum
}
) {
Social {
userAssociatedAddresses
}
}
}
Copy {
"data": {
"Socials": {
"Social": [
{
"userAssociatedAddresses": [
"0x8773442740c17c9d0f0b87022c722f9a136206ed",
"0x86924c37a93734e8611eb081238928a9d18a63c0"
]
},
{
"userAssociatedAddresses": [
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2"
]
},
{
"userAssociatedAddresses": [
"0xb877f7bb52d28f06e60f557c00a56225124b357f",
"0xa14b4c95b5247199d74c5578531b4887ca5e4909",
"0xd7029bdea1c17493893aafe29aad69ef892b8ff2",
"0x74232bf61e994655592747e20bdf6fa9b9476f79"
]
}
]
}
}
}
Developer Support
If you have any questions or need help regarding resolving 0x address(es), please join our Airstack's Telegram group.
More Resources
Last updated 5 months ago