###### tags: `日本實習`
clockify
https://app.clockify.me/tracker
---
Tech writer 的話,目前需要的是比較 research 類型的,這個需要理解到的程度是例如 how bundler, different paymaster implementation works 這種
形式是 tutorial + 簡易 working 的GitHub 範例,類似你這次實習最後做的那份,只是題目不同
https://github.com/pimlicolabs/erc20-paymaster-contracts
___
hardhat
install dependencies
> npm instal
Install failed,run the following the command:
> npm audit fix
> npm audit fix --force
> npm audit
> npm install
run test
> Npx hardhat test
An unexpected error occurred,run:
> npm install --force

將../../typechain-types改成../../node_modules/typechain-types


,安装缺失的依赖项:
> npm install chai @types/chai chai-as-promised @types/chai-as-promised
並且導入模塊和類型
> import { expect } from 'chai';
> import chaiAsPromised from 'chai-as-promised';

--

--



--



---
# [Z <> Nero 實習進度](https://hackmd.io/@zinstitute/HktIQ3yH2)(Eda)
- [x] 看懂[Celestia](https://celestia.org/what-is-celestia/)&[OP Stack](https://stack.optimism.io/#the-op-stack-tomorrow)
-[Note](https://hackmd.io/Vhhz3ACeR_GsL_ppAWDlKg)
- [x] 照著幣安鏈的框架弄一個 Nero 的 [gitbook](https://nero-3.gitbook.io/nero-chain-documentation/)頁面,參考資料[BNB Chain Documentation](https://docs.bnbchain.org/docs/binance/)
- user guide 的概念,就是教其他用戶(開發者)該怎麼跟我們現在的測試鏈互動,思考如何撰寫文章說明 + 用法截圖。
-[gitbook目前進度](https://app.gitbook.com/o/MwJBzVZ9EvXF7YrUaKAt/s/DqXJFhDm0P6PZWpl9ovG/overview/guides/develop):有先完成部署和驗證合約教學
- [API](https://api.nerochain.io/api/v1/#/)寫一份簡單的 end to end 操作教學?
- https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/block-service#txsvo
- [製作表格](https://docs.google.com/spreadsheets/d/1lCNN2AWO9gTlkJjIdVm9Sn5ToAgWZvKVJyBo93bjEEs/edit#gid=0)
- [x] 重製[Leo](https://hackmd.io/@LeoLi/Nero-Internship)在測試網上部署一個簡易 ERC20 合約
- [ ] API end to end 的 tutorial,分成不同 use case,學習資料[Handle GET and POST Request in Express](https://codeforgeek.com/handle-get-post-request-express-4/)
- [ ] https://github.com/nerochain
- [x] use case 1 可以是「如何儲存字串訊息到鏈上到查看已推送的交易(使用到兩個 api)」
- 第一個是領faucet 第二個是儲存字串到鏈上並且拿到transaction hash
- ~~use case 2 可以是「創建新用戶到能使用某種特定功能的過程」~~
- [x] 照[這個](https://codeforgeek.com/handle-get-post-request-express-4/)做然後再用自己的話寫
- [x] [白皮書](https://hackmd.io/ItDFDPMIQi2nud-Qc0CDSQ)
- [ ] dailyGoal建立
- [ ] CREATE ? https://www.nerochain.io/token-creation
- [ ] STAKING
- [ ] ACCESS
- [ ] https://github.com/yijunlindev/nero-api-demo 要放gitbook?要
---
### [保存區](https://hackmd.io/zsseDL30TjKnHoIkJO5vCA)
---
# 任務一
* 先去 安裝 Homebrew 是一種在 macOS 和 Linux 上安裝軟體的套件管理器。這裡是如何在 macOS 上安裝 Homebrew 的步驟:
輸入以下命令:
```
bash
Copy code
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
* 安裝套件
* [Docker setup](https://docs.blockscout.com/for-developers/information-and-settings/docker-integration-local-use-only)
* Run本地geth
```
geth --syncmode full --gcmode archive --http --http.vhosts='*' --http.addr '0.0.0.0' --http.port 8545 --http.api 'net,debug,eth,web3,txpool' --http.corsdomain '*' --ws --ws.addr '0.0.0.0' --ws.port 8546 --ws.api 'net,debug,eth,web3,txpool' --ws.origins '*'
```

* 接著`cd /Users/linyijun/my-projects/blockscout`
```
docker-compose up --build
```

```
softwareupdate --install-rosett2
```
修改

```
docker-compose up --build
```
z
在 docker-compose.yml 中添加這個設定
![Uploading file..._a3foakd5a]()
然後執行`docker image prune -a`
再執行`docker-compose up --build`

___
# 任務二
### [OP Stack and Celestia tutorial](https://docs.celestia.org/developers/optimism/)
1. #### Environment setup and Golang installation
Install wget and jq
```
brew install wget && brew install jq
```
Install Golang
```
ver="1.20.2"
cd $HOME
wget "https://golang.org/dl/go$ver.darwin-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.darwin-amd64.tar.gz"
rm "go$ver.darwin-amd64.tar.gz"
```
Now we need to add the /usr/local/go/bin directory to $PATH:
```
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
```
確認安裝成功
```
go version
```
2. #### Clone repository
```
cd $HOME
git clone https://github.com/celestiaorg/optimism
cd optimism
git checkout celestia-develop
```
3. ### asdf
Open a new Terminal and input:
```
cd $HOME
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
```
Set the path:
```
export PATH=$PATH:~/.asdf/bin/
```
確認安裝
```
asdf
```
Install nodejs 16.16.0:
```
asdf plugin add nodejs
asdf install nodejs 16.16.0
asdf local nodejs 16.16.0
source ~/.bashrc
curl -L https://foundry.paradigm.xyz/ | bash
source /Users/linyijun/.zshenv
foundryup
```
4. #### Build devnet
```
cd $HOME
cd optimism
make build-ts
export SEQUENCER_BATCH_INBOX_ADDRESS=0xff00000000000000000000000000000000000000
export L2OO_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8
```
5. ### Start devnet
```
make devnet-up
```
出現錯誤訊息如下:

根據提示把重複定義過的值(140-142行)隱蔽或刪除

成功畫面

5. ### Stop devnet
```
make devnet-down
make devnet-clean
```

---
如果已安裝node.js但出現下面畫面:

降版本
`open -e ~/.zshrc`會跳出`.zshrc `文件,輸入:
```
export NVM_DIR=/Users/linyijun/.nvm
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
```
如下

run
```
source ~/.zshrc
nvm --version
node --version
```
降版本成功!

Run `npx hardhat` 創建出智能合約的架構,引入 ERC20 創建簡易的代幣合約
修改 hardhat.config.js & scripts/deploy.js 並使用 npx hardhat deploy 指令將合約部署到測試網 L1: http://139.162.97.228:8545, ChainID: 900 / L2: http://139.162.97.228:9545, ChainID: 901
`npx hardhat compile`一直`Nothing to compile`,後來`npx hardhat help compile`再compile一次就開始Downloading compiler能編譯成功了
```
L1_PROVIDER_URL=http://localhost:8545
L1_PRIVATE_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
L2_PROVIDER_URL=http://localhost:9545
L2_PRIVATE_KEY=bf7604d9d3a1c7748642b1b7b05c2bd219c9faa91458b370f85e5a40f3b03af7
```
暫時先使用水龍頭帳戶進行部署 (LINK)
–
[hardhat plugin](https://docs.blockscout.com/for-users/verifying-a-smart-contract/hardhat-verification-plugin) 驗證
部署成功後,但未驗證前畫面
合約地址0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9

在 `hardhat.config.js` 中添加 `require("@nomiclabs/hardhat-etherscan");`
到`.env` 中加入 API key(etherscan 申請)同時加入hardhat.config.js 相關設定(拿文件範例改編)
使用 npx hardhat verify --list-networks 確認自定義的 network 添加成功
輸入指令開始驗證 npx hardhat verify --network <network-name> <deployed-contract-address>
----


