Skip to content

Commit

Permalink
update: add note for 2024-09-13
Browse files Browse the repository at this point in the history
  • Loading branch information
Aris1024 committed Sep 13, 2024
1 parent 7c15dc6 commit d997dbd
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion Aris.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,43 @@ timezone: Australia/Sydney # 澳大利亚东部标准时间 (UTC+10)
<!-- Content_START -->

### 2024.09.13
> init

#### 学习内容
- 01HelloWeb3.sol 创建 helloWeb3 程序,并在 remix 上进行编译和部署
- 代码部分
- ```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
contract HelloWeb3 {
string public _string = "Hi Web3";
}
- 在根目录创建 contracts 目录,创建 .sol 文件,放入上面代码
- 使用 nodejs 安装 remixd
- ```
npm install -g @remix-project/remixd
- node 安装
- 下载地址: https://nodejs.org/en/download/prebuilt-installer/current
- 查看 node 仓库源 `npm config get registry`
- 修改 node 仓库源 `npm config set registry https://registry.npmmirror.com`
- 创建脚本`remix.sh`, 让 `https://remix.ethereum.org` 网站能关联本地文档
- ```
DIR=$(cd "$(dirname "$0")"; pwd)
contracts=${DIR}/contracts
echo '合约地址:' ${contracts}
remixd -s ${contracts} --remix-ide https://remix.ethereum.org
```
- 执行remix.sh
- ```
./remix.sh
- 编译和部署
- 使用Google Chrome打开`https://remix.ethereum.org`,左侧 workspace 中选择 `connect to localhost`
- 然后点击 `connect` 按钮,就会加载出本地 `contracts`目录下的 .sol 文件
- 点击 `01HelloWeb3.sol`进入文件,然后 `cmd + s`, 会进行编译
- 点击左侧 `deploy & run transactions` 按钮,点击 `高亮`的 Depoly 按钮
- 左侧会出现部署结果,点击 `_string` 出现 `'Hi Web3'`,表示成功.
- 也可以在 https://remix.ethereum.org直接编写代码,然后编译和部署,但是我习惯在本地编写代码^_^
###
Expand Down

0 comments on commit d997dbd

Please sign in to comment.