# 如何在Starknet上部署合约

By [bmlcwenwu](https://paragraph.com/@bmlcwenwu) · 2023-09-24

---

众所周知，Starknet用的是cairo语言，部署合约的教程相对较少，今天偶然看见一个推主发的一个教程，跟着做了一遍，中间遇到n多的问题，本来准备放弃了，没想到早起又试了下，居然成功了，看推主的说法是晚上网络拥堵，白天会好点儿。

原推的截图说明的不是很清楚，我做了简单的教程。

10gas的情况下，花费0.1u左右，增加一个合约交互数，一个tx。

*   原推：
    
    [https://x.com/mztacat/status/1705235286697848947?s=46&t=\_dVUX2-4tSuXeCnwxr-9Iw](https://x.com/mztacat/status/1705235286697848947?s=46&t=_dVUX2-4tSuXeCnwxr-9Iw)
    

**_下面开始_**
----------

*   打开网址：
    

[https://remix.ethereum.org/#activate=Starknet-cairo1-compiler&url=https://github.com/NethermindEth/StarknetByExample/blob/main/listings/ch00-introduction/counter/src/counter.cairo&lang=en&optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.18+commit.87f61d96.js](https://remix.ethereum.org/#activate=Starknet-cairo1-compiler&url=https://github.com/NethermindEth/StarknetByExample/blob/main/listings/ch00-introduction/counter/src/counter.cairo&lang=en&optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.18+commit.87f61d96.js)

### **_一：_**

点击：Accept，然后next、next、done。

![](https://storage.googleapis.com/papyrus_images/b93573ac0aba17c43c49ce4984d5e67706b4bc9a2cf9b04d1139acdb3dec9265.png)

**二：**

点击左下角：抽头图标

在搜索栏输入：stark

点击：Activate，根据网络情况，等个十几秒到一分钟时间不等。

![](https://storage.googleapis.com/papyrus_images/c8cf33a8424d5510f48f77c2c1450c6100b0b6b3627e6324b344d31e5623065e.png)

**三：**

左边：勾选

点击：Accept

![](https://storage.googleapis.com/papyrus_images/fc86cfc1c28ddb6f2ab58526128f0ab2e902c728c7d182fc7b48dfbc8ddcac8e.png)

**四：**

先点击左边starknet的图标

再左下角：点开Remote Devnet

然后选择：Wallet Selection

![](https://storage.googleapis.com/papyrus_images/4303b21e454d253b536e1e4421ec369e530db0f58d63323cfab51babdc3e438a.png)

**五：**

选择链接钱包

![](https://storage.googleapis.com/papyrus_images/b2325829278c62d657bce39f68c01293637649ce933a34ae05e068caeab5620e.png)

**六：**

点击：Compile Project（晚上大概率会失败，早起应该可以成功）

![](https://storage.googleapis.com/papyrus_images/785753c02dec94691e8c81e87590eb140ca620bd3c596fe04c3e3dd3e4a609a6.png)

**七：**

白天果然不卡了！

出现下面一串字就是合约编译OK了。

点击：Deploy，下拉菜单选第二个（第一个也可以，需要填写数字，不知道数字是啥意思）

![](https://storage.googleapis.com/papyrus_images/eddba7bdedcb1de7aadfb9fe2b798b5a80f4cc51e305504a59702e905b75430a.png)

**八：**

继续点击：Deploy，下面出现的一串字就是部署的合约地址。

最后钱包确认。合约部署完成。

![](https://storage.googleapis.com/papyrus_images/aa1728656e51439c1162df07e0cba68dee1c944517899cb717c8bc892c5a4102.png)

---

*Originally published on [bmlcwenwu](https://paragraph.com/@bmlcwenwu/starknet)*
