# 区块链安全概览

区块链作为一个去中心化的分布式账本系统，其安全性建立在密码学、共识机制和网络协议等多个层面的基础之上。然而，随着区块链应用的不断扩展，特别是智能合约的引入，安全挑战也日益复杂。

## 安全层级

区块链系统的安全可以从以下几个层级来理解：

1. **数据层安全**：主要依赖于哈希算法、数字签名、非对称加密等密码学技术，确保数据的机密性、完整性和不可篡改性。
2. **网络层安全**：涉及P2P网络的通信安全，防止拒绝服务攻击（DoS/DDoS）、日蚀攻击（Eclipse Attack）等。
3. **共识层安全**：确保分布式节点能够就账本状态达成一致，抵御51%攻击、双花攻击等。
4. **合约层安全**：随着以太坊等图灵完备公链的出现，智能合约代码的漏洞（如重入攻击、整数溢出）成为主要的安全隐患。
5. **应用层安全**：包括钱包安全、交易所安全、DApp前端安全等，涉及私钥管理、钓鱼攻击防护等。

## 安全挑战

* **技术复杂性**：区块链融合了多学科技术，任何一个环节的疏漏都可能导致系统安全崩溃。
* **不可篡改性的双刃剑**：区块链的不可篡改特性意味着一旦发生错误或被攻击，往往难以回滚，资金损失难以追回。
* **开源生态**：虽然开源有助于发现漏洞，但也使得黑客更容易分析代码寻找攻击点。
* **经济激励**：区块链系统直接承载价值，黑客攻击成功可获得巨大的经济利益，因此攻击动力极强。

本章后续小节将重点介绍智能合约漏洞、常见攻击向量以及安全审计等关键内容。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeasy.gitbook.io/blockchain_guide/05_crypto/security_intro.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
