> For the complete documentation index, see [llms.txt](https://kademliachain.gitbook.io/kad/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kademliachain.gitbook.io/kad/zhi-neng-he-yue/bu-shu-zhi-neng-he-yue.md).

# 部署智能合约

需要部署智能合约才能提供给KAD网络的用户使用。要部署一个智能合约，只需发送一个包含编译后的智能合约代码的KAD交易，而不需要指定任何收件人。

## 如何部署智能合约 <a href="#how-to-deploy-a-smart-contract" id="how-to-deploy-a-smart-contract"></a>

***

### 您所需要的 <a href="#what-youll-need" id="what-youll-need"></a>

* 您的合约字节码 – 这是通过编译获得的。
* 用作燃料的KAD – 像其他交易一样，您需要设定燃料限制，这样就知道部署合约比简单的KAD交易需要更多的燃料。
* 一个部署脚本或插件。
* 通过以下方式之一可以访问KAD节点：运行自己的节点、连接到公共节点或使用节点服务的应用程序接口应用程序接口密钥。

### 部署智能合约的步骤 <a href="#steps-to-deploy" id="steps-to-deploy"></a>

所涉及的具体步骤将取决于您使用的工具。 例如，查看[关于部署合约的安全帽文档(opens in a new tab)](https://hardhat.org/guides/deploying.html)或[关于网络和应用程序部署的 Truffle 文档(opens in a new tab)](https://www.trufflesuite.com/docs/truffle/advanced/networks-and-app-deployment)。 这是两个最受欢迎的智能合约部署工具，它们涉及到编写脚本来处理部署步骤。

一旦部署，您的合约将有一个以太坊地址，就像其它[帐户](/kad/kadkademliachain-zhang-hu.md)一样。

## 相关工具 <a href="#related-tools" id="related-tools"></a>

***

**Remix -&#x20;*****Remix 集成开发环境可以开发、部署和管理类似区块链的KAD智能合约。***

* [Remix(opens in a new tab)](https://remix.ethereum.org/)

**Tenderly -&#x20;*****Web3 开发平台，提供调试、可观测性和基础设施构建基块，用于开发、测试、监测和操作智能合约***

* [tenderly.co(opens in a new tab)](https://tenderly.co/)
* [相关文档(opens in a new tab)](https://docs.tenderly.co/)
* [GitHub(opens in a new tab)](https://github.com/Tenderly)
* [Discord(opens in a new tab)](https://discord.gg/eCWjuvt)

**安全帽 -&#x20;*****用于编译、部署、测试和调试您的KAD软件的开发环境***

* [hardhat.org(opens in a new tab)](https://hardhat.org/getting-started/)
* [关于部署合约的文档(opens in a new tab)](https://hardhat.org/guides/deploying.html)
* [GitHub(opens in a new tab)](https://github.com/nomiclabs/hardhat)
* [Discord(opens in a new tab)](https://discord.com/invite/TETZs2KK4k)

**Truffle -** ***开发环境、测试框架、部署通道及其他工具。***

* [trufflesuite.com(opens in a new tab)](https://www.trufflesuite.com/)
* [关于网络和应用部署的文档(opens in a new tab)](https://www.trufflesuite.com/docs/truffle/advanced/networks-and-app-deployment)
* [GitHub(opens in a new tab)](https://github.com/trufflesuite/truffle)

**thirdweb -&#x20;*****使用单一命令轻松地将任何合约部署到任何与 EVM 兼容的区块链*****。**

* [相关文档(opens in a new tab)](https://portal.thirdweb.com/deploy/)
