XID is an open protocol that maps π usernames onchain, turning social handles into verifiable, interoperable Web3 identifiers. It enables 600M+ monthly active users on π to receive BNB Chain assets with just their handle β no wallet address required. Anyone β people, agents, brands, or projects β can use the XID Protocol to resolve π handles into onchain identities, enabling crypto to be sent directly to users through their social usernames.
- Social-to-Blockchain Mapping: Direct mapping of π usernames to BNB Chain addresses
- Soulbound NFTs: XID tokens are non-transferable, ensuring permanent association between addresses and usernames
- Mass Adoption Ready: Designed for 600M+ monthly active users on π
- No Wallet Required: Users can receive BNB Chain assets using just their π handle
- Interoperable: Open protocol that any project can integrate
- Registration System: Time-based registration with configurable expiration periods
- Renewal Capability: Extend registration periods for existing XIDs
- Signature-based Security: Secure minting process using cryptographic signatures
- Fee Management: Configurable minting and renewal fees with built-in collection
- Batch Operations: Support for batch username/address lookups
The XID Protocol consists of two main smart contracts deployed on BNB Chain:
The core ERC721 contract that manages the soulbound tokens:
- Stores π username-to-address mappings
- Handles token minting, burning, and renewal
- Enforces non-transferability through custom
_updatefunction - Manages registration expiration logic
- Provides lookup functions for username/address resolution
The controller contract that manages access and fees:
- Handles signature verification for secure minting
- Manages minting and renewal fees in BNB
- Controls fee collection and distribution
- Provides secure access control for XID operations
- Implements nonce-based replay protection
- Direct Payments: Send BNB and BEP-20 tokens directly to @username instead of wallet addresses
- Social Identity: Verifiable onchain identity linked to social media presence
- Cross-Platform Integration: Universal identifier across Web3 applications
- Brand Protection: Secure username registration for brands and projects
- Agent Integration: AI agents can use XID for seamless crypto transactions
- DeFi Integration: Use social handles as identifiers in DeFi protocols
- Clone the repository:
git clone https://github.com/XIDProtocol/XID-Contract.git
cd XID-Contract- Install dependencies:
forge install- Set up environment variables:
cp .env.example .env
# Edit .env with your BNB Chain configurationCreate a .env file with the following variables:
# BNB Chain Configuration
PRIVATE_KEY=your_private_key_here
RPC_URL=https://bsc-dataseed.binance.org/ # BNB Chain Mainnet
# Contract Configuration
SIGNER_ADDRESS=0x...
FEE_RECEIVER_ADDRESS=0x...
XID_ADDRESS=0x324b7497554Bece2b944EC50FEA1a474766bF893
XID_CONTROLLER_ADDRESS=0x2AC4EA2606114482e93a6f226Fe727A42E9c7D6b- Chain ID: 56
- RPC URL: https://bsc-dataseed.binance.org/
- Block Explorer: https://bscscan.com/
- Native Token: BNB
forge buildforge test- Deploy the contracts to BNB Chain:
forge script script/DeployContract.s.sol --rpc-url $RPC_URL --broadcast --verify- Configure the system (optional):
# Set token URI base
forge script script/SetBaseURI.s.sol --rpc-url $RPC_URL --broadcastThe repository includes several management scripts for BNB Chain:
SetMintFee.s.sol: Update minting fees (in BNB)SetFeeReceiver.s.sol: Change fee receiver addressWithdrawFee.s.sol: Claim accumulated feesGetUserData.s.sol: Query user informationGetTokenURI.s.sol: Retrieve token metadata
function mint(
string memory xUsername,
address user,
uint256 expireAt,
uint256 chainId,
uint8 isFree,
uint256 registrationYears,
bytes memory signature
) external payablefunction renew(
string memory xUsername,
uint256 renewalYears
) external payablefunction getAddressByUsername(string memory username) public view returns (address)
function getUsernameByAddress(address user) public view returns (string memory)
function isUsernameActive(string memory username) public view returns (bool)function getUsernamesByAddresses(address[] calldata users) external view returns (string[] memory)
function getAddressesByUsernames(string[] calldata usernames) external view returns (address[] memory)// Resolve username to address
const recipientAddress = await xidContract.getAddressByUsername("elonmusk");
// Send BNB directly
await signer.sendTransaction({
to: recipientAddress,
value: ethers.parseEther("0.1") // 0.1 BNB
});// Resolve multiple usernames at once
const usernames = ["elonmusk", "jack", "vitalik"];
const addresses = await xidContract.getAddressesByUsernames(usernames);- Private Key Security: Never hardcode private keys or commit them to repositories
- Environment Variables: Use environment variables for all sensitive configuration
- Signature Verification: Cryptographic signatures prevent unauthorized minting
- Soulbound Design: Non-transferable nature prevents trading/speculation
- Registration Expiration: Prevents indefinite username squatting
- Nonce Protection: Prevents replay attacks on signature-based operations
- Access Control: Only authorized signers can approve minting operations
- Minting Fee: Paid in BNB for registering new usernames
- Renewal Fee: Annual fee in BNB for extending registration periods
- Gas Fees: Standard BNB Chain transaction fees apply
- Free Minting: Supported for verified users with proper signatures
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Run the full test suite:
forge test -vvRun specific tests:
forge test --match-contract XIDTest
forge test --match-contract XIDControllerTest- XID Contract:
0x324b7497554Bece2b944EC50FEA1a474766bF893 - XIDController Contract:
0x2AC4EA2606114482e93a6f226Fe727A42E9c7D6b
This project is licensed under the MIT License - see the LICENSE file for details.
Applications built on the XID Protocol:
- XMoney: xmoney.to - Send crypto directly to X (Twitter) usernames using XID
- ClawMoney: clawmoney.ai - Social task marketplace with on-chain rewards distributed via XID/XMoney
- BNBot: github.com/bnbot-ai - AI-powered Chrome extension for Twitter/X with XID integration
- OpenClaw: openclaw.ai - AI agent framework powering the ClawMoney ecosystem
- Website: xid.so
- Twitter: @XIDProtocol
- GitHub: Issues and discussions