8000 GitHub - Strata-Labs/bnsv2-api
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Strata-Labs/bnsv2-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BNS V2 API Documentation

Base URL

https://api.bnsv2.com

For testnet, prepend /testnet to any endpoint (e.g., /testnet/names instead of /names).

Core Endpoints

Names

  1. List All Names
GET /names
  1. List Valid Names
GET /names/valid
  1. List Expired Names
GET /names/expired
  1. List Revoked Names
GET /names/revoked

Address-Specific Name Queries

  1. List Valid Names for Address
GET /names/address/{address}/valid
  1. List Expired Names for Address
GET /names/address/{address}/expired
  1. List Names About to Expire for Address
GET /names/address/{address}/expiring-soon

Returns names expiring within 4320 blocks.

  1. List Revoked Names for Address
GET /names/address/{address}/revoked

Name Operations

  1. Get Name Details
GET /names/{full_name}
  1. List Names in Namespace
GET /names/namespace/{namespace}
  1. Resolve Name
GET /resolve-name/{full_name}
  1. Check Name Registration Availability
GET /names/{namespace}/{name}/can-register
  1. Get Name Renewal Status
GET /names/{full_name}/renewal
  1. Check Name Resolution Status
GET /names/{full_name}/can-resolve
  1. Get Name Owner
GET /names/{full_name}/owner

Token Operations

  1. Get Last Token ID
GET /token/last-id
  1. Get Token Owner
GET /tokens/{id}/owner
  1. Get Token ID from Name
GET /names/{full_name}/id
  1. Get Name from Token ID
GET /tokens/{id}/name
  1. Get Name Info from Token ID
GET /tokens/{id}/info

Namespace Operations

  1. List All Namespaces
GET /namespaces
  1. Get Namespace Details
GET /namespaces/{namespace}

Rarity System

  1. Get Name Rarity Metrics
GET /names/{full_name}/rarity
  1. Get Rarest Names in Namespace
GET /namespaces/{namespace}/rare-names

Subdomain Endpoints

Subdomain Operations

  1. Get All Subdomains
GET /subdomains/{full_name}

Response Format:

{
  "subdomains": {
    "sub1": {
      "owner": "SP2ZNGJ85ENDY6QRHQ5P2D4FXQJ6INMT00GBGJ2QX",
      "general": "General profile information",
      "twitter": "@example",
      "url": "https://example.com",
      "nostr": "npub...",
      "lightning": "lightning-address",
      "btc": "bc1..."
    }
  }
}
  1. Get Single Subdomain
GET /subdomain/{full_subdomain}
  1. Get Subdomain Owner
GET /subdomain/{full_subdomain}/owner

BTC Address Resolution

Get BTC Address

GET /btc-address/{full_name}

Response Format:

{
  "btc": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
}

Testnet Response:

{
  "network": "testnet",
  "btc": "tb1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
}

Common Parameters

All list endpoints support:

  • limit (default: 50)
  • offset (default: 0)

Rarity Scoring System

Scoring Factors

  1. Name Length

    • 1-3 characters: +10 points (Extremely Rare)
    • 4-5 characters: +30 points (Very Rare)
    • 6-7 characters: +50 points (Moderate)
    • 8-10 characters: +70 points (Common)
    • 11+ characters: +90 points (Very Common)
  2. Character Patterns (20% weight each)

    • Numeric-only names
    • Letter-only names
    • Special character presence
  3. Special Patterns

    • Palindromes: -10 points (increases rarity)
    • Repeating characters: +5 points (decreases rarity)

Rarity Classifications

Final Score (0-100):

  • 0-20: Ultra Rare
  • 21-40: Rare
  • 41-60: Uncommon
  • 61-80: Common
  • 81-100: Very Common

Error Responses

Common error responses for all endpoints:

404 Not Found

{
  "error": "Name not found, expired or revoked"
}

400 Bad Request

{
  "error": "Invalid zonefile format"
}

Integration Example

async function resolveBtcAddress(bnsName) {
  try {
    const response = await fetch(`https://api.bnsv2.com/btc-address/${bnsName}`);
    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.error || 'Failed to resolve BTC address');
    }
    const data = await response.json();
    return data.btc;
  } catch (error) {
    console.error('Error resolving BTC address:', error);
    throw error;
  }
}

// Usage example
resolveBtcAddress('satoshi.btc')
  .then(btcAddress => console.log('BTC Address:', btcAddress))
  .catch(error => console.error('Error:', error));

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0