-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d82556
commit 3cec631
Showing
2 changed files
with
354 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
--- | ||
title: Ethereum 入門者が SepoliaETH を取得 | ||
tags: | ||
- Ethereum | ||
- DApps | ||
- testnet | ||
- sepolia | ||
private: false | ||
updated_at: '2024-09-02T16:29:09+09:00' | ||
id: 1782191dc5c2404b2fc6 | ||
organization_url_name: haw | ||
slide: false | ||
ignorePublish: false | ||
--- | ||
|
||
## はじめに | ||
|
||
Ethereum に入門すると、テストネットにデプロイしてみる演習課題がよくあります。テストネットを利用してガス代を支払うためには、テストネットで利用できる ETH トークンを事前に入手しておくことが必須となるため、初学者にとって避けては通れません。 | ||
|
||
ネット検索すると簡単にできるよと書かれているのですが、残高がゼロでそのアカウントを使って過去に何もしたことのない状態でやるとうまくいかず色々戸惑いました。 | ||
|
||
|
||
|
||
勉強した内容を簡単にまとめます。 | ||
|
||
## テストネット | ||
|
||
- 分散型アプリケーション (Dapps) をテストおよび開発するための安全な環境(開発者が実際の Ethereum 資金を危険にさらさない)を提供 | ||
- メインネットの動作環境を模倣するように設計されたブロックチェーン | ||
- メインネットとは別の台帳上に存在 | ||
|
||
## Sepolia テストネット | ||
|
||
- Ethereum コア開発者により設計されたテストネット | ||
- テストネットを利用してガス代を支払うためには、テストネットで利用できる ETH トークンを入手しておくことが必須 | ||
|
||
https://www.alchemy.com/overviews/sepolia-testnet | ||
|
||
## SepoliaETH | ||
|
||
- Sepolia テストネットでトランザクションを完了するために支払うために使用される通貨 | ||
- Sepolia テストネット用の Faucet から取得できる | ||
|
||
## Faucet | ||
|
||
ネット検索すると色んな Faucet から SepoliaETH を簡単に無償で入手できるとの情報がありますが、過去に Ethereum を使った活動を何もしていない人には利用できないものが多く有りました。Sepolia ETH を無料で取得できるまでに色んな条件が課せられます。ひょっとすると一昔前までは誰でも簡単に使えたのかもしれません。 | ||
|
||
うまくいっても、1 回あたりに入手できるトークンは少量で、72 時間に 1 回のみ利用可能などの制限を設けている Faucet が多いです。 | ||
|
||
- https://www.alchemy.com/faucets/ethereum-sepolia | ||
- https://faucet.quicknode.com/ethereum/sepolia | ||
- https://www.infura.io/faucet/sepolia | ||
- https://sepolia-faucet.pk910.de | ||
|
||
## Faucet から SepoliaETH を入手するための条件の例 | ||
|
||
以下に 2024 年 8 月末現在でうまく行かなった例をいくつか挙げます。 | ||
|
||
### Ethereum メインネット残高が必要 | ||
|
||
![alchemy-faucet-minimum-eth 2024-08-29 21-07-41.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/82804/1fc978d8-a6c8-353c-7c91-06f67ee6a7eb.png) | ||
|
||
https://www.alchemy.com/faucets/ethereum-sepolia | ||
|
||
> To prevent bots and abuse, this faucet requires a minimum Ethereum mainnet balance of 0.001 ETH on the wallet address being used. | ||
以下は Google 翻訳による日本語訳です | ||
|
||
> ボットや不正使用を防ぐため、このフォーセットでは、使用されているウォレット アドレスに最低 0.001 ETH の Ethereum メインネット残高が必要です。 | ||
### メインネットでの過去のアクティビティが十分にあること | ||
|
||
![infura-faucet-no-past-activity 2024-08-30 09-23-08.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/82804/684e99dc-ddc2-79d0-576f-20ccfc27794b.png) | ||
|
||
https://www.infura.io/faucet/sepolia | ||
|
||
> No Past Activity | ||
> | ||
> The address provided does not have sufficient historical activity on the Ethereum Mainnet. Please use a different address to proceed. Read the FAQ below for more information. | ||
以下は Google 翻訳による日本語訳です | ||
|
||
> 過去のアクティビティなし | ||
> | ||
> 指定されたアドレスには、Ethereum メインネットでの過去のアクティビティが十分にありません。続行するには、別のアドレスを使用してください。詳細については、以下の FAQ をお読みください。 | ||
![quick-node-faucet from 2024-09-02 10-44-07.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/82804/7fefca55-4fa3-2d1d-d972-a583e460be7c.png) | ||
|
||
https://faucet.quicknode.com/ethereum/sepolia | ||
|
||
> We require wallets to have a more established transaction history, your wallet does not currently meet this criteria. | ||
以下は Google 翻訳による日本語訳です | ||
|
||
> ウォレットにはより確立された取引履歴が必要ですが、現在、お客様のウォレットはこの基準を満たしていません。 | ||
### その他 | ||
|
||
- Faucet にはアカウント登録(サインアップ)する必要のあるものが多いです。 | ||
|
||
## できたこと1 | ||
|
||
友人が所持している SepoliaETH を送ってくださり、それを無事受け取ることができました。 | ||
|
||
おかげで Ethereum の演習課題に取り組むことができました。ありがとうございます! | ||
|
||
## できたこと2 | ||
|
||
- [MetaMask 拡張機能](https://metamask.io/download/)をプラウザにインストール | ||
- 暗号資産ウォレットである[MetaMask]で Ethereum のアカウントを作成 | ||
- [MetaMask]で Ethereum を少量購入 | ||
- [Alchemy]で Alchemy アカウント登録 | ||
- [Alchemy]の[Ethereum Sepolia Faucet]で SepoliaETH を取得 | ||
|
||
[MetaMask]: https://metamask.io/ | ||
[Alchemy]: https://www.alchemy.com/faucets/ethereum-sepolia | ||
[Ethereum Sepolia Faucet]: https://www.sepoliafaucet.com/ | ||
|
||
## おわりに | ||
|
||
以上、Ethereumに入門時のSepoliaETH取得の際につまずいたこと、氣が付いたことについてまとめました。 | ||
|
||
何か良い情報があればぜひお便りください :bow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
--- | ||
title: Linux Mint (LMDE6) で watchman をソースコードからビルドすることに挑戦 | ||
tags: | ||
- Linux | ||
- Debian | ||
- reactnative | ||
- watchman | ||
- LMDE6 | ||
private: false | ||
updated_at: '2024-09-12T19:46:19+09:00' | ||
id: 5bada235e79cee554daf | ||
organization_url_name: haw | ||
slide: false | ||
ignorePublish: false | ||
--- | ||
## はじめに | ||
|
||
Linux Mint (LMDE6) の PC に[watchman]をソースコードからビルドしてインストールしました。 | ||
|
||
2024 年 9 月初旬現在、わかりにくかったのでメモします。 | ||
|
||
[watchman]: https://facebook.github.io/watchman/ | ||
|
||
## 実行環境 | ||
|
||
- OS: [LMDE 6 (faye) x86_64](https://linuxmint.com/edition.php?id=308) | ||
|
||
## 公式インストール方法 | ||
|
||
[公式ドキュメント][Installation]によると、Debian 向けのやり方は複数あります。 | ||
|
||
- [Homebrew on Linux を使う](https://facebook.github.io/watchman/docs/install#homebrew) | ||
- [ソースコードからビルド](https://facebook.github.io/watchman/docs/install#-building-from-source) | ||
- [ビルド済みバイナリをダウンロード](https://facebook.github.io/watchman/docs/install#prebuilt-binaries-2) | ||
|
||
[Installation]: https://facebook.github.io/watchman/docs/install | ||
|
||
## ソースコードからビルドすることになった経緯 | ||
|
||
Homebrew は使っていないので除外することにしました。 | ||
|
||
まずビルド済みバイナリをダウンロードする方法を試してみました。 | ||
ところが、手順通りにインストールしましたが、エラーがでて使えませんでした。 | ||
|
||
> watchman: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory | ||
どうも Issues にもいくつか上がっているようですが、長い間解決していない問題のようです。 | ||
|
||
- https://github.com/facebook/watchman/issues/1241 | ||
- https://github.com/facebook/watchman/issues/1019 | ||
|
||
[Releases](https://github.com/facebook/watchman/tags) を見てみると、最近のリリースに Linux 版のバイナリが含まれていません。Linux 版のバイナリはあまりメンテナンスされていないのかもしれません。 | ||
|
||
そういう経緯があってソースコードからビルドしてみようということになりました。 | ||
|
||
## ソースコードをダウンロードする | ||
|
||
[最新リリース](https://github.com/facebook/watchman/releases/latest)からダウンロードするか、[GitHub リポジトリ](https://github.com/facebook/watchman/)からクローンします。 | ||
|
||
Git を使う場合は以下の通りです。 | ||
|
||
```bash | ||
git clone https://github.com/facebook/watchman | ||
``` | ||
|
||
そしてソースコードのディレクトリに移動します。 | ||
|
||
```bash | ||
cd watchman | ||
``` | ||
|
||
### install-system-packages.sh | ||
|
||
依存関係が公式ドキュメントには見当たらなかったですが、リポジトリを見た印象だと`install-system-packages.sh`スクリプトを実行すれば必要なものがインストールされる設計になっているようです。 | ||
|
||
残念ながら、執筆時点では Linux Mint には対応してないようでした。 | ||
|
||
```bash | ||
$ ./install-system-packages.sh | ||
++ dirname ./install-system-packages.sh | ||
+ python3 ./build/fbcode_builder/getdeps.py install-system-deps --recursive watchman | ||
I don't know how to install any packages on this system linux-lmde-6 | ||
``` | ||
Debian 12 の Docker コンテナで色々試しているときに遭遇したエラーメッセージをもとに必要なパッケージを見つけ出すことができました。 | ||
手動でインストールする方針で行きます。 | ||
### autogen.sh | ||
このスクリプトを実行するだけでビルドできるようです。 | ||
必要なパッケージがインストールされいない状態だと様々なエラーがでます。 | ||
## やってみる | ||
### 必要なパッケージをインストール | ||
システム上のパッケージリストを更新します。 | ||
```bash | ||
apt update -yqq | ||
``` | ||
Dockerコンテナ内で`./install-system-packages.sh`を実行したときにたまたま遭遇したエラーメッセージに以下のコードがありました。それをそのまま使います。ソースコードのどこかにあるのかもしれません。 | ||
```bash | ||
apt install -yqq \ | ||
autoconf \ | ||
automake \ | ||
binutils-dev \ | ||
cmake \ | ||
libboost-all-dev \ | ||
libbz2-dev \ | ||
libdouble-conversion-dev \ | ||
libdwarf-dev \ | ||
libevent-dev \ | ||
libfast-float-dev \ | ||
libffi-dev \ | ||
libgflags-dev \ | ||
libgmock-dev \ | ||
libgoogle-glog-dev \ | ||
libgtest-dev \ | ||
liblz4-dev \ | ||
liblzma-dev \ | ||
libncurses-dev \ | ||
libpcre2-dev \ | ||
libsnappy-dev \ | ||
libsodium-dev \ | ||
libtool \ | ||
libunwind-dev \ | ||
libzstd-dev \ | ||
ninja-build \ | ||
python3-all-dev \ | ||
zlib1g-dev | ||
``` | ||
更に、以下は様々なエラーに対処しているときにインストールしたものです。詳しくは覚えてません。 | ||
エラーメッセージをヒントに適宜足りないものをインストールしてください。 | ||
```bash | ||
apt install \ | ||
build-essential \ | ||
curl \ | ||
git \ | ||
libssl-dev \ | ||
m4 \ | ||
pkg-config \ | ||
python3 | ||
``` | ||
### ビルドを実行 | ||
ソースコードのディレクトリ内で`./autogen.sh`を実行します。 | ||
```bash | ||
./autogen.sh | ||
``` | ||
何度もエラーに遭遇しましたが、ほとんどの場合が依存関係の不備でした。 | ||
### ビルド結果を確認 | ||
`built`ディレクトリが生成され、その中にビルド結果が格納されます。以下は一例です。 | ||
```bash | ||
$ tree ./built | ||
./built | ||
├── bin | ||
│ ├── watchman | ||
│ └── watchmanctl | ||
└── lib | ||
├── libevent-2.1.so.7 | ||
├── libgflags.so.2.2 | ||
├── libglog.so.0 | ||
├── libsnappy.so.1 | ||
└── libunwind.so.8 | ||
3 directories, 7 files | ||
``` | ||
動作確認をします。 | ||
```bash | ||
./built/bin/watchman --version | ||
./built/bin/watchmanctl --help | ||
``` | ||
たしかこの時点では`./built/bin/watchman --version`の方でエラーがでたと記憶しています。 | ||
> ./built/bin/watchman: error while loading shared libraries: /usr/local/lib/libglog.so.0: cannot open shared object file: No such file or directory | ||
### 必要なファイルをつくり、ビルド結果を適切な場所にコピー | ||
- `./built/bin/*` → `/usr/local/bin/` | ||
- `./built/lib/*` → `/usr/local/lib` | ||
```bash | ||
sudo mkdir -p /usr/local/{bin,lib} | ||
sudo mkdir -p /usr/local/var/run/watchman | ||
cd path/to/watchman | ||
cp -iv built/bin/* /usr/local/bin/ | ||
cp -iv built/lib/* /usr/local/lib/ | ||
sudo chmod 755 /usr/local/bin/watchman | ||
sudo chmod 2777 /usr/local/var/run/watchman | ||
``` | ||
再度`./built/bin/watchman --version`を実行すると成功するはずです。 | ||
```bash | ||
$ ./built/bin/watchman --version | ||
20240905.175743.0 | ||
``` | ||
また、パスの通っている場所にコピーを置いたので、`watchman --version`も機能するはずです。 | ||
```bash | ||
$ watchman --version | ||
20240905.175743.0 | ||
``` | ||
## おわりに | ||
依存関係さえしっかりインストールされていれば、スクリプトを実行するだけで簡単にビルドできることがわかりました。 | ||
2024 年 9 月初旬現在、ドキュメント上ではわかりにくい部分があったので、このメモが何らかの一助になれば幸いです。 | ||
なにか情報があれば、ぜひお便りください :bow: |