3.substrate开发配置

本文详细介绍了如何配置Substrate开发所需的Rust环境,包括稳定版和夜间版的安装与更新,以及crates.io代理的设置方法。此外还介绍了安装wasm压缩工具binaryen和cargo-contract插件的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

substrate开发配置

  1. 配置rust环境
  • 将stable版本设置为默认并更新rust
rustup default stable
rustup update

使用rustup show命令查看如下:

Default host: x86_64-apple-darwin
rustup home:  /Users/0x/.rustup

stable-x86_64-apple-darwin (default)
rustc 1.58.1 (db9d1b20b 2022-01-20)
  • 添加nightly toolchains并更新
rustup update nightly
  • 为nightly添加rust-src组件,添加WebAssembly(wasm)到target
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-unknown --toolchain nightly

使用rustup show命令查看如下:

Default host: x86_64-apple-darwin
rustup home:  /Users/0x/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.58.1 (db9d1b20b 2022-01-20)
  1. 配置crates.io代理
  • 参考链接
https://rsproxy.cn/
  • 修改~/.cargo/config文件,添加如下内容:
[source.crates-io]
replace-with = 'rsproxy'

[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"

[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"

[net]
git-fetch-with-cli = true
  1. 安装ink相关
  • 安装wasm压缩工具binaryen
brew install binaryen
  • 安装cargo-contract插件
cargo install cargo-contract --vers ^0.16 --force --locked
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值