Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
398 changes: 398 additions & 0 deletions website/src/data/faqs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,398 @@
export interface FAQItem {
question: string;
answer: string;
keywords: string[];
}

export const faqs: FAQItem[] = [
{
question: 'What is XDC Network?',
answer:
'XDC Network is an enterprise-ready, open-source blockchain optimized for trade finance and tokenization. It combines public and private blockchain features with delegated proof of stake (XDPoS) consensus, delivering 2,000+ TPS, near-instant finality, and sub-cent transaction costs.',
keywords: ['xdc', 'network', 'what is', 'blockchain', 'intro', 'overview', 'xinfin'],
},
{
question: 'How do I deploy a smart contract on XDC?',
answer:
'Deploy smart contracts on XDC using Solidity with Hardhat, Remix, Foundry, or Truffle. XDC is EVM-compatible, so Ethereum tooling works out of the box. Set the RPC to `https://erpc.xinfin.network` and chain ID to `50`. See the Smart Contract Development section for full guides.',
keywords: ['deploy', 'smart contract', 'solidity', 'hardhat', 'remix', 'truffle', 'foundry', 'evm', 'compile'],
},
{
question: 'What is XDC Subnet?',
answer:
'XDC Subnet lets you create private, scalable, customizable blockchain networks anchored to the XDC mainnet. It is ideal for enterprise use cases that need privacy and high throughput while inheriting XDC security.',
keywords: ['subnet', 'private blockchain', 'enterprise', 'scalability', 'xdc subnet', 'private'],
},
{
question: 'How do I run an XDC node?',
answer:
'Run a full node, masternode, or subnet node by following the node operator guides in the XDC Chain section. Requirements include stable hardware (4+ CPUs, 8GB RAM, 1TB SSD), a public IP, and staking XDC for masternodes.',
keywords: ['node', 'masternode', 'validator', 'run', 'staking', 'operator', 'full node'],
},
{
question: 'What wallets support XDC?',
answer:
'Popular wallets include XDCPay (recommended), MetaMask (custom RPC: `https://erpc.xinfin.network`, chain ID `50`), DCent, Ledger, and Trust Wallet. Always verify official sources at xinfin.org.',
keywords: ['wallet', 'xdc pay', 'metamask', 'ledger', 'trust wallet', 'store', 'xdcpay'],
},
{
question: 'Where can I find the XDC RPC endpoints?',
answer:
'Public RPC endpoints:\n- **Mainnet**: `https://erpc.xinfin.network` (Chain ID: 50)\n- **Apothem Testnet**: `https://erpc.apothem.network` (Chain ID: 51)\n\nBoth support HTTPS and WebSocket. See the API Reference section for the full list.',
keywords: ['rpc', 'endpoint', 'api', 'mainnet', 'apothem', 'websocket', 'json rpc', 'chain id'],
},
{
question: 'How do I stake XDC?',
answer:
'XDC uses delegated proof of stake (XDPoS). You can stake by running a masternode (requires 10M XDC) or delegating to an existing masternode via the staking portal. Rewards are distributed proportionally.',
keywords: ['stake', 'staking', 'delegate', 'rewards', 'masternode', 'governance', 'xdpos'],
},
{
question: 'Is XDC secure?',
answer:
'XDC uses XDPoS consensus with double validation and has passed multiple security audits. Developer and operator best practices are documented in the Security section.',
keywords: ['security', 'audit', 'safe', 'secure', 'xdpos', 'consensus', 'double validation'],
},
{
question: 'What are gas fees on XDC?',
answer:
'XDC gas fees are typically less than $0.001 per transaction. The minimum gas price on mainnet is 0.25 Gwei, making XDC highly cost-effective for enterprise use.',
keywords: ['gas', 'fee', 'cost', 'gwei', 'transaction fee', 'cheap', 'affordable'],
},
{
question: 'How do I get testnet XDC?',
answer:
'Request free testnet XDC from the Apothem faucet at faucet.apothem.network. The Apothem testnet uses Chain ID 51 and mirrors mainnet functionality.',
keywords: ['faucet', 'testnet', 'apothem', 'test tokens', 'test xdc', 'free'],
},
{
question: 'What token standards does XDC support?',
answer:
'XDC supports EVM-compatible standards:\n- **XRC-20** — fungible tokens\n- **XRC-721** — NFTs\n- **XRC-1155** — multi-token contracts\n\nSee the Smart Contract Tokens section for implementation guides.',
keywords: ['token', 'xrc20', 'xrc721', 'nft', 'erc20', 'erc721', 'token standard', 'fungible'],
},
{
question: 'What is ISO 20022 on XDC?',
answer:
'XDC is ISO 20022 compatible, the global messaging standard for financial transactions. This enables integration with SWIFT, central bank systems, and traditional finance infrastructure.',
keywords: ['iso 20022', 'swift', 'trade finance', 'standard', 'enterprise', 'banking', 'finance'],
},
{
question: 'How do I bridge assets to XDC?',
answer:
'XDC offers bridge solutions for assets from Ethereum and other chains. The Interoperability section covers official bridges and cross-chain transfer guides. Always verify contracts from official sources.',
keywords: ['bridge', 'cross chain', 'interoperability', 'transfer', 'ethereum', 'assets'],
},
{
question: 'What consensus mechanism does XDC use?',
answer:
'XDC uses XinFin Delegated Proof of Stake (XDPoS). A set of elected masternode validators produces and validates blocks, with double validation for added security.',
keywords: ['consensus', 'xdpos', 'delegated proof of stake', 'validator', 'masternode', 'election'],
},
{
question: 'What is XDPoS 2.0?',
answer:
'XDPoS 2.0 is the next-generation consensus upgrade for XDC Network, designed to improve security, finality, and performance while remaining compatible with existing tooling.',
keywords: ['xdpos 2.0', 'consensus upgrade', 'finality', 'security', 'performance'],
},
{
question: 'How is XDC different from Ethereum?',
answer:
'XDC is EVM-compatible like Ethereum but optimized for enterprise trade finance with faster finality, lower fees, and a delegated proof-of-stake model.',
keywords: ['ethereum', 'evm', 'difference', 'compare', 'fees', 'finality'],
},
{
question: 'What is the XDC token used for?',
answer:
'XDC is used for transaction fees, staking, masternode collateral, and governance participation on the XDC Network.',
keywords: ['xdc token', 'use case', 'gas', 'staking', 'collateral', 'governance'],
},
{
question: 'How do I add XDC to MetaMask?',
answer:
'Open MetaMask, add a custom network with RPC `https://erpc.xinfin.network`, Chain ID `50`, symbol `XDC`, then import the token contract if needed.',
keywords: ['metamask', 'add network', 'wallet configuration', 'chain id', 'rpc'],
},
{
question: 'What is XDCPay?',
answer:
'XDCPay is a browser extension wallet built specifically for XDC Network, similar to MetaMask but tailored for XDC dApps and assets.',
keywords: ['xdcpay', 'wallet', 'browser extension', 'dapp', 'xdc pay'],
},
{
question: 'How do I verify a smart contract on XDC?',
answer:
'Verify contracts through XDC block explorers that support Solidity verification by submitting the source code, compiler version, and optimization settings used during deployment.',
keywords: ['verify', 'contract verification', 'explorer', 'solidity', 'source code'],
},
{
question: 'What are XRC20, XRC721, and XRC1155?',
answer:
'These are XDC token standards analogous to ERC20, ERC721, and ERC1155. XRC20 is for fungible tokens, XRC721 for NFTs, and XRC1155 for multi-token contracts.',
keywords: ['xrc20', 'xrc721', 'xrc1155', 'token standards', 'nft', 'fungible'],
},
{
question: 'How do I create an XRC20 token?',
answer:
'Create an XRC20 token by writing a Solidity contract that follows the XRC20 interface, then deploy it using Remix, Hardhat, or Foundry on XDC.',
keywords: ['xrc20', 'create token', 'deploy token', 'solidity', 'remix', 'hardhat'],
},
{
question: 'What development tools work with XDC?',
answer:
'Use Remix, Hardhat, Foundry, and Truffle. XDC is EVM-compatible, so most Ethereum tools work with minor RPC configuration.',
keywords: ['tools', 'remix', 'hardhat', 'foundry', 'truffle', 'solidity', 'ide'],
},
{
question: 'How do I connect to the XDC mainnet?',
answer:
'Use public mainnet RPC endpoints with Chain ID 50 and currency symbol XDC. The API Reference lists current endpoints.',
keywords: ['mainnet', 'connect', 'rpc', 'chain id', 'api'],
},
{
question: 'How do I connect to the Apothem testnet?',
answer:
'Use Apothem testnet RPC endpoints with Chain ID 51 and symbol XDC. Faucet links are available in the developer guides.',
keywords: ['apothem', 'testnet', 'rpc', 'chain id 51', 'faucet'],
},
{
question: 'What is the XDC Block Explorer?',
answer:
'XDC Block Explorers let you search transactions, addresses, blocks, and verify contracts. Examples include XDCScan and BlocksScan.',
keywords: ['explorer', 'block explorer', 'xdcscan', 'transactions', 'blocks'],
},
{
question: 'How do I run a masternode?',
answer:
'Running a masternode requires 10 million XDC collateral, a stable server, a public IP, and following the masternode setup guide in the Node Operators section.',
keywords: ['masternode', 'run', 'collateral', '10 million', 'validator', 'node'],
},
{
question: 'What are the masternode staking requirements?',
answer:
'A masternode candidate must lock 10 million XDC and maintain reliable uptime. Delegators can also stake behind masternodes to earn rewards.',
keywords: ['masternode', 'staking requirements', '10 million', 'collateral', 'delegate'],
},
{
question: 'How do I deploy an XDC Subnet?',
answer:
'Deploy a subnet using the XDC Subnet generator and deployment guides. You will configure subnet nodes, relayers, and checkpoint contracts to anchor to mainnet.',
keywords: ['deploy subnet', 'subnet generator', 'relayer', 'checkpoint', 'setup'],
},
{
question: 'What is SubSwap?',
answer:
'SubSwap is a cross-chain swap component that lets assets move between XDC mainnet and XDC subnets through secure relayers.',
keywords: ['subswap', 'cross-chain', 'swap', 'subnet', 'bridge'],
},
{
question: 'What is XDC Zero?',
answer:
'XDC Zero is a cross-chain interoperability framework that enables secure message and asset transfers between XDC Network and other chains.',
keywords: ['xdc zero', 'cross-chain', 'interoperability', 'bridge', 'message passing'],
},
{
question: 'How do I become a validator on XDC?',
answer:
'To become a validator, run a masternode candidate, lock the required collateral, and get elected by the community. See the Validator Handbook for details.',
keywords: ['validator', 'become validator', 'masternode', 'candidate', 'election'],
},
{
question: 'What are XDC subnet checkpoints?',
answer:
'Checkpoints are periodic commits of subnet state to the XDC mainnet, providing finality, security, and a recovery anchor for subnet operations.',
keywords: ['checkpoint', 'subnet', 'finality', 'security', 'anchor'],
},
{
question: 'How do I set up a subnet faucet?',
answer:
'Subnet deployment guides include faucet setup so users can request test tokens. Configure the faucet service and expose it through your subnet UI.',
keywords: ['faucet', 'subnet', 'test tokens', 'setup', 'deployment'],
},
{
question: 'What is RWA tokenization?',
answer:
'Real-world asset (RWA) tokenization represents physical assets such as commodities, invoices, or real estate as digital tokens on XDC.',
keywords: ['rwa', 'real world asset', 'tokenization', 'assets', 'enterprise'],
},
{
question: 'What are private subnets?',
answer:
'Private subnets are permissioned XDC-based networks for enterprises that need privacy, custom rules, and controlled access while still anchoring to XDC mainnet.',
keywords: ['private subnet', 'permissioned', 'enterprise', 'privacy', 'access control'],
},
{
question: 'How does XDC support trade finance?',
answer:
'XDC supports trade finance through fast settlement, ISO 20022 messaging, tokenized documents, and smart-contract automation of letters of credit and invoices.',
keywords: ['trade finance', 'invoice', 'letter of credit', 'iso 20022', 'settlement'],
},
{
question: 'How do I optimize smart contract gas?',
answer:
'Optimize gas by minimizing storage writes, using efficient data types, batching operations, and following the Gas Optimization guide in the Smart Contract section.',
keywords: ['gas optimization', 'smart contract', 'storage', 'efficiency', 'cost'],
},
{
question: 'What is delegated proof of stake?',
answer:
'Delegated proof of stake lets token holders vote for validators (masternodes) that secure the network and produce blocks, combining direct staking with governance.',
keywords: ['delegated proof of stake', 'xdpos', 'validator', 'vote', 'consensus'],
},
{
question: 'How do I set up a full node with Docker?',
answer:
'The Node Operators section provides a Docker guide that pulls the official XDC client image, mounts volumes, and configures ports for mainnet or testnet sync.',
keywords: ['docker', 'full node', 'setup', 'container', 'sync'],
},
{
question: 'What is the XDC one-click installer?',
answer:
'The one-click installer simplifies deploying an XDC node or subnet by automating dependencies, configuration, and service setup.',
keywords: ['one click installer', 'installer', 'node setup', 'easy deploy', 'automation'],
},
{
question: 'How do I back up an XDC node?',
answer:
'Back up the node data directory, keystore, and configuration files regularly. The DevOps and Node Operators guides cover backup strategies and restoration.',
keywords: ['backup', 'node', 'restore', 'devops', 'data directory'],
},
{
question: 'What are XDC governance proposals?',
answer:
'Governance proposals let the XDC community vote on protocol changes, masternode parameters, and treasury actions through on-chain voting.',
keywords: ['governance', 'proposal', 'vote', 'dao', 'protocol change'],
},
{
question: 'How can I get XDC tokens?',
answer:
'Get XDC through exchanges, the official Get XDC page, or testnet faucets for development on Apothem.',
keywords: ['get xdc', 'buy', 'exchange', 'faucet', 'tokens'],
},
{
question: 'What is slashing in XDC?',
answer:
'Slashing penalizes masternodes for malicious behavior or prolonged downtime by reducing rewards or removing them from the validator set.',
keywords: ['slashing', 'penalty', 'masternode', 'downtime', 'malicious'],
},
{
question: 'How do I use hardware wallets with XDC?',
answer:
'Hardware wallets like Ledger can store XDC through compatible wallet software. Add the XDC app and manage keys securely offline.',
keywords: ['hardware wallet', 'ledger', 'secure', 'keys', 'wallet'],
},
{
question: 'What are flash loans on XDC?',
answer:
'Flash loans are uncollateralized loans that must be borrowed and repaid within a single transaction, enabling arbitrage, liquidations, and collateral swaps on XDC DeFi protocols.',
keywords: ['flash loan', 'defi', 'arbitrage', 'liquidation', 'collateral swap'],
},
{
question: 'How do oracles work on XDC?',
answer:
'Oracles bring off-chain data such as prices and events onto XDC. You can use existing oracle providers or build custom oracle solutions for your dApp.',
keywords: ['oracle', 'price feed', 'off-chain data', 'custom oracle', 'vrf'],
},
{
question: 'What are XDC subgraphs?',
answer:
'Subgraphs index XDC blockchain data into queryable GraphQL APIs, making it easier to build performant frontends for dApps.',
keywords: ['subgraph', 'the graph', 'graphql', 'indexing', 'data'],
},
{
question: 'How do I store files on IPFS with XDC?',
answer:
'Store files on IPFS and reference their content identifiers (CIDs) in XDC smart contracts or dApps. The Storage section covers IPFS integration patterns.',
keywords: ['ipfs', 'storage', 'cid', 'files', 'decentralized storage'],
},
{
question: 'What security practices should I follow on XDC?',
answer:
'Follow best practices such as using multisig wallets, auditing contracts, managing keys offline, validating inputs, and keeping nodes updated.',
keywords: ['security', 'best practices', 'multisig', 'audit', 'key management'],
},
{
question: 'How do I report a security vulnerability?',
answer:
'Report vulnerabilities through the official XDC bug bounty or security contact channels described in the Security section. Do not disclose publicly before a fix.',
keywords: ['vulnerability', 'bug bounty', 'report', 'security', 'disclosure'],
},
{
question: 'Where can I find the XDC whitepaper?',
answer:
'The XDC whitepaper is available in the Whitepaper section of this documentation site and on the official XDC website.',
keywords: ['whitepaper', 'paper', 'documentation', 'official', 'xdc'],
},
];

const normalizedQuestionMap = new Map<string, FAQItem>();
for (const faq of faqs) {
normalizedQuestionMap.set(normalize(faq.question), faq);
}

function normalize(text: string): string {
return text
.toLowerCase()
.replace(/[^a-z0-9\s]/g, '')
.replace(/\s+/g, ' ')
.trim();
}

export function findFAQ(query: string): FAQItem | null {
const q = normalize(query);
if (!q) return null;

// Exact or near-exact match.
const exact = normalizedQuestionMap.get(q);
if (exact) return exact;

// Query contains a full FAQ question, or vice versa.
for (const faq of faqs) {
const nq = normalize(faq.question);
if (q.includes(nq) || nq.includes(q)) return faq;
}

// Keyword scoring (ignore stopwords; require strong keyword matches).
const stopwords = new Set([
'what', 'whats', 'how', 'why', 'when', 'where', 'which', 'who', 'is', 'are', 'was', 'were',
'a', 'an', 'the', 'and', 'or', 'but', 'if', 'then', 'else', 'of', 'at', 'by', 'for', 'with',
'about', 'against', 'between', 'into', 'through', 'during', 'before', 'after', 'above', 'below',
'to', 'from', 'up', 'down', 'in', 'out', 'on', 'off', 'over', 'under', 'again', 'further',
'then', 'once', 'here', 'there', 'all', 'any', 'both', 'each', 'few', 'more', 'most', 'other',
'some', 'such', 'no', 'nor', 'not', 'only', 'own', 'same', 'so', 'than', 'too', 'very', 'can',
'will', 'just', 'should', 'now', 'does', 'do', 'did', 'has', 'have', 'had', 'having', 'i', 'my',
'me', 'we', 'our', 'us', 'you', 'your', 'it', 'its', 'this', 'that', 'these', 'those', 'they',
'them', 'their', 'he', 'she', 'his', 'her', 'him', 'be', 'been', 'being', 'am', 'are', 'was',
'xdc', 'xinfin',
]);
const terms = q.split(/\s+/).filter((t) => t.length > 2 && !stopwords.has(t));
let best: FAQItem | null = null;
let bestScore = 0;

for (const faq of faqs) {
const text = `${faq.question} ${faq.answer} ${faq.keywords.join(' ')}`.toLowerCase();
let score = 0;
for (const term of terms) {
if (faq.keywords.some((k) => k.includes(term))) score += 3;
else if (faq.question.toLowerCase().includes(term)) score += 2;
else if (text.includes(term)) score += 1;
}
if (score > bestScore) {
bestScore = score;
best = faq;
}
}

const threshold = Math.max(4, Math.ceil(terms.length * 1.2));
return bestScore >= threshold ? best : null;
}

// Static suggestion chips shown when no user messages exist yet.
export const SUGGESTION_CHIPS = [
'What is XDC Network?',
'RPC endpoints',
'Deploy a contract',
'Gas fees',
'Get testnet XDC',
'Token standards',
];