36 lines
1006 B
Markdown
36 lines
1006 B
Markdown
---
|
||
title: "Chainlink"
|
||
type: entity
|
||
tags: [oracle, defi, infrastructure]
|
||
sources: [blockchain-security-auditor]
|
||
last_updated: 2026-04-20
|
||
---
|
||
|
||
## 定义
|
||
Chainlink 是去中心化预言机网络(Oracle Network),为智能合约提供外部数据源,是防止 Oracle Manipulation 攻击的关键基础设施。
|
||
|
||
## 核心产品
|
||
- **Price Feeds**:资产价格数据(TWAP)
|
||
- **VRF**:可验证随机函数
|
||
- **CCIP**:跨链互操作协议
|
||
|
||
## 在安全审计中的意义
|
||
```solidity
|
||
// 安全使用 Chainlink Oracle
|
||
AggregatorV3Interface priceFeed;
|
||
(, int256 price, , uint256 updatedAt, ) = priceFeed.latestRoundData();
|
||
require(price > 0, "Invalid price");
|
||
require(updatedAt > block.timestamp - MAX_STALENESS, "Stale price");
|
||
```
|
||
|
||
## Oracle Manipulation 防护
|
||
- 时间加权平均价格(TWAP)
|
||
- 多数据源聚合
|
||
- 冗余预言机节点
|
||
- 偏差阈值检查
|
||
|
||
## Connections
|
||
- [[Oracle Manipulation]] ← prevents ← [[Chainlink]]
|
||
- [[DeFi Infrastructure]] ← provides ← [[Chainlink]]
|
||
|