Skip to content

saurabh-7797/sns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SNS Registrar with Metadata URL Support

A Solana Name Service (SNS) Registrar program with enhanced metadata URL functionality, deployed on Gorbchain.

πŸš€ Live Deployment

  • Network: Gorbchain
  • Program ID: CySCGJK9kNNqM2eQSW9hGQ1FCZ51ZHetRfGsTLY1TTe9
  • RPC Endpoint: https://rpc.gorbchain.xyz
  • WS Endpoint: wss://rpc.gorbchain.xyz/ws/

🎯 Features

Core SNS Functionality

  • βœ… Domain registration and management
  • βœ… Reverse lookup (address β†’ domain name)
  • βœ… Domain ownership transfer
  • βœ… Subdomain support
  • βœ… Payment processing with multiple tokens

Enhanced Metadata URL Support ⭐ NEW

  • βœ… Metadata URL Storage: Domains can store optional metadata URLs
  • βœ… Metadata Updates: Update metadata URLs for existing domains
  • βœ… Backward Compatibility: Existing domains work unchanged
  • βœ… Rich Domain Information: Store profile data, business info, NFT metadata

πŸ“‹ New Instructions

Instruction ID Name Description
13 Create Create domain with optional metadata URL
14 UpdateMetadata Update metadata URL for existing domain

πŸ”§ Installation & Setup

Prerequisites

  • Rust 1.70+
  • Solana CLI 1.18+
  • Node.js 18+

Build Instructions

# Clone the repository
git clone <your-repo-url>
cd sns-registrar

# Build the program
cargo build-sbf --features devnet

# Install Node.js dependencies
npm install

Deployment

# Deploy to Gorbchain
node deploy-gorbchain-manual.js

πŸ§ͺ Testing

Run All Tests

# Basic functionality test
node test-metadata-functionality.js

# Detailed structure test
node detailed-metadata-test.js

# Real contract interaction test
node real-contract-test.js

# Transaction history
node transaction-history.js

# Domain operations
node domain-operations.js

πŸ“Š Usage Examples

Register Domain with Metadata

const domainName = "company.sol";
const metadataUrl = "https://arweave.net/company-metadata.json";

// Register domain with metadata
await snsClient.createDomainWithMetadata(domainName, metadataUrl);

Update Domain Metadata

const domainName = "company.sol";
const newMetadataUrl = "https://arweave.net/updated-company-metadata.json";

// Update metadata URL
await snsClient.updateMetadataUrl(domainName, newMetadataUrl);

Send Tokens to Domain

const domainName = "company.sol";
const amount = 0.1; // SOL

// Send tokens to domain (resolves to wallet address)
await snsClient.sendTokensToDomain(domainName, amount);

πŸ“ Project Structure

sns-registrar/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ lib.rs                 # Main program entry point
β”‚   β”œβ”€β”€ state.rs               # Data structures (includes metadata_url)
β”‚   β”œβ”€β”€ instruction_auto.rs    # Instruction definitions
β”‚   β”œβ”€β”€ processor.rs           # Instruction router
β”‚   β”œβ”€β”€ processor/
β”‚   β”‚   β”œβ”€β”€ create.rs          # Domain creation
β”‚   β”‚   β”œβ”€β”€ update_metadata.rs # NEW: Metadata updates
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ cpi.rs                 # Cross-program invocations
β”‚   └── utils.rs               # Utility functions
β”œβ”€β”€ tests/
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy-gorbchain-manual.js
β”‚   β”œβ”€β”€ test-metadata-functionality.js
β”‚   β”œβ”€β”€ detailed-metadata-test.js
β”‚   β”œβ”€β”€ real-contract-test.js
β”‚   β”œβ”€β”€ transaction-history.js
β”‚   └── domain-operations.js
└── docs/

πŸ”— Transaction History

Deployment Transaction

  • Hash: 63Y6KQxcLGU1H7ZTm624y6DHFRbJjTjuxo7mQsiY6BqdpN5PxRE2wceSBU7mMYaNzKjZoD6WyQFDAx9xVvHZJ2zP
  • Date: July 31, 2025
  • Status: βœ… Success

Domain Operations

  • Company.sol Registration: Domain registered with metadata URL
  • Token Transfer: 0.1 SOL sent to company.sol
  • Transaction: 3ECd6Z6CGyUBdUp7tjedrEVJn8cYS6UeMKNDCWw2WVrJxYp3Gp6KpfKDnGYLgmbucux7PoNCSKYy1bygjpZYA8JQ

πŸ“Š Data Structures

ReverseLookup with Metadata

#[derive(BorshDeserialize, BorshSerialize)]
pub struct ReverseLookup {
    pub name: String,
    pub metadata_url: Option<String>, // NEW FIELD
}

Metadata URL Examples

{
  "domain": "company.sol",
  "metadata_url": "https://arweave.net/company-metadata.json",
  "description": "Business domain with company info"
}

🌐 Supported Networks

  • βœ… Gorbchain (Primary deployment)
  • πŸ”„ Devnet (Testing)
  • πŸ”„ Mainnet (Future deployment)

πŸ”’ Security Features

  • βœ… Account ownership validation
  • βœ… Signer verification
  • βœ… Instruction parameter validation
  • βœ… Cross-program invocation security
  • βœ… Rent exemption handling

πŸ“ˆ Performance

  • Program Size: 309,568 bytes
  • Rent Exemption: 2.15548416 SOL
  • Transaction Fee: ~0.00001 SOL
  • Response Time: < 1 second

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

  • Issues: Create an issue on GitHub
  • Documentation: Check the docs/ folder
  • Testing: Run the test scripts for verification

πŸŽ‰ Acknowledgments

  • Solana Labs for the SNS foundation
  • Gorbchain for network support
  • Community contributors

Deployment Date: July 31, 2025
Version: 1.0.0 with Metadata URL Support
Status: βœ… LIVE ON GORBCHAIN

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages