1---2name: chainlink3description: Assist with Chainlink LINK tokens, oracle integrations, staking, and price feed usage.4---56## LINK Token Basics7- LINK is an ERC-20 token on Ethereum — standard wallet and exchange support8- Also available on multiple chains — Arbitrum, Optimism, Polygon, Avalanche, BSC9- Bridging LINK between chains uses official Chainlink bridge — verify bridge address before using10- Different chains have different LINK contract addresses — verify correct address per network1112## Token Transfers13- Standard ERC-20 transfer rules apply — gas paid in native token (ETH, MATIC, etc.)14- Some DeFi protocols accept LINK as collateral — Aave, Compound15- LINK has no special transfer restrictions — no tax tokens, no rebasing16- Decimals: 18 — same as ETH, standard precision1718## Staking (v0.2)19- Community staking allows LINK holders to stake — earn rewards for securing network20- Staking has capacity limits — pool may be full, waitlist exists21- Unbonding period applies — can't withdraw instantly after unstaking22- Rewards in LINK — automatically added to staked balance23- Slashing risk exists — node operators can lose stake for misbehavior2425## Price Feeds (For Developers)26- Chainlink price feeds are the standard for DeFi — Aave, Synthetix, and most protocols use them27- Feed addresses differ per network and pair — always verify on docs.chain.link28- Feeds update based on deviation threshold and heartbeat — not every block29- Check `latestRoundData()` not just `latestAnswer()` — includes timestamp and round info30- Stale data check critical — verify `updatedAt` timestamp is recent3132## Oracle Integration Patterns33- Direct consumer: your contract calls feed directly — simplest approach34- Chainlink Automation (Keepers): trigger actions based on conditions — no server needed35- VRF (Verifiable Random Function): provably fair randomness — for NFT mints, games, lotteries36- Functions: connect to any API — custom off-chain computation37- CCIP: cross-chain messaging — official Chainlink interoperability protocol3839## VRF Usage40- Request/receive pattern: request randomness, receive in callback — not synchronous41- Each request costs LINK — fund subscription or pay per request42- Confirmation blocks add security but delay — more confirmations = more secure43- Randomness is verifiable on-chain — anyone can verify it wasn't manipulated4445## Common Developer Mistakes46- Hardcoding feed addresses — use address registry or config47- Not checking for stale data — price feeds can stop updating48- Assuming instant updates — deviation thresholds mean prices can be slightly stale49- Not handling VRF callback failures — callback can revert, losing the randomness50- Insufficient LINK for subscriptions — requests fail silently when underfunded5152## Network Comparisons53- Ethereum mainnet: highest security, highest gas costs54- L2s (Arbitrum, Optimism): lower cost, same security model55- Alt-L1s (Polygon, Avalanche): native integration, different trust assumptions56- Testnets: Sepolia for Ethereum, network-specific for others5758## Security Considerations59- Only use official Chainlink feeds — verify contract addresses on docs.chain.link60- Monitor for feed deprecation — Chainlink announces deprecated feeds61- Multi-oracle pattern for critical systems — don't rely on single source62- Circuit breakers for extreme price movements — protect against oracle manipulation6364## CCIP (Cross-Chain)65- Send messages and tokens across chains — official Chainlink bridge66- Lane availability varies — not all chain pairs supported67- Fee estimation before sending — paid in LINK or native token68- Message finality depends on source and destination chains6970## Ecosystem71- Node operators earn LINK for providing data — professional infrastructure required72- BUILD program for projects integrating Chainlink — access to resources and support73- Extensive documentation at docs.chain.link — primary reference for developers74- Community resources: Discord, Stack Overflow, GitHub