# Chainlink — Decentralized Oracle Network for Smart Contracts > Chainlink is a decentralized oracle network that connects smart contracts to real-world data, external APIs, and off-chain computation, enabling blockchain applications to interact with data feeds, verifiable randomness, and cross-chain messaging. ## Install Save as a script file and run: # Chainlink — Decentralized Oracle Network for Smart Contracts ## Quick Use ```solidity // Solidity example: reading a Chainlink price feed import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; contract PriceConsumer { AggregatorV3Interface internal priceFeed; constructor() { priceFeed = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419); } function getLatestPrice() public view returns (int) { (, int price,,,) = priceFeed.latestRoundData(); return price; } } ``` ## Introduction Chainlink provides a decentralized network of oracle nodes that fetch off-chain data and deliver it to on-chain smart contracts. Since blockchains cannot natively access external data, Chainlink bridges this gap by aggregating responses from multiple independent node operators and delivering tamper-resistant data to contracts on Ethereum, Polygon, Arbitrum, and dozens of other chains. ## What Chainlink Does - Delivers decentralized price feeds for DeFi protocols covering crypto, forex, and commodity pairs - Provides Verifiable Random Function (VRF) for provably fair on-chain randomness - Enables Automation (formerly Keepers) to trigger smart contract functions based on conditions - Supports Cross-Chain Interoperability Protocol (CCIP) for secure cross-chain messaging and token transfers - Offers Functions for connecting smart contracts to any external API with custom JavaScript execution ## Architecture Overview Chainlink uses a network of independent node operators who stake LINK tokens as collateral. For price feeds, multiple nodes fetch data from premium data providers, aggregate results off-chain using the Off-Chain Reporting (OCR) protocol, and submit a single aggregated transaction on-chain. This reduces gas costs while maintaining decentralization. Each data feed has a proxy contract that consumers reference. ## Self-Hosting & Configuration - Run a Chainlink node using the official Docker image `smartcontract/chainlink` - Configure the node with a `.env` file specifying the Ethereum client URL and database connection - Nodes require a PostgreSQL database for job and run storage - Fund the node address with ETH for gas and LINK for staking - Define external adapters for custom data source integrations ## Key Features - Decentralized data aggregation prevents single points of failure in oracle delivery - Off-Chain Reporting (OCR) reduces on-chain gas costs by aggregating off-chain before submitting - Multi-chain support covers Ethereum, Arbitrum, Optimism, Polygon, Avalanche, BNB Chain, and more - CCIP enables secure token transfers and arbitrary messaging across blockchain networks - Proof of Reserve provides on-chain verification of off-chain or cross-chain asset backing ## Comparison with Similar Tools - **Band Protocol** — similar oracle network but smaller node operator set; Chainlink has broader chain coverage - **API3** — first-party oracles run by data providers themselves; Chainlink uses third-party node operators - **Pyth Network** — low-latency price feeds primarily for Solana; Chainlink covers more chains and data types - **UMA** — optimistic oracle with dispute resolution; Chainlink provides real-time data without dispute periods - **Tellor** — community-driven oracle with mining; Chainlink uses staked professional node operators ## FAQ **Q: What is the LINK token used for?** A: LINK is used to pay oracle node operators for their services and as staking collateral to ensure data quality. **Q: Which blockchains does Chainlink support?** A: Chainlink operates on Ethereum, Arbitrum, Optimism, Polygon, Avalanche, BNB Chain, Base, and many others. **Q: Can I run my own Chainlink node?** A: Yes. The node software is open source and anyone can run a node, though serving official data feeds requires meeting quality requirements. **Q: How does Chainlink ensure data accuracy?** A: Multiple independent nodes fetch data from different sources, and OCR aggregates results. Outliers are filtered and nodes risk their staked LINK for incorrect data. ## Sources - https://github.com/smartcontractkit/chainlink - https://docs.chain.link/ --- Source: https://tokrepo.com/en/workflows/asset-80078a3f Author: Script Depot