Görli(Goerli) 向け Raiden Network を建てる
Görli はゲリルって読めばいいのかな?ゴルリ?ゴリラと呼ばいいか。
Ethereum にはパブリックなテスト向けのネットワークが複数あって、最近できたのが Görli(Goerli) と呼ばれるもの。Afri Schoedon 氏が関わっていてその時知ったきりだったけど、DappNode が Raiden Network をサポートして名前が出てきたので使ってみた。
DappNode は結構便利だと思うんだけど、今の所検証に使うにはあまり向いていない。内部で Docker を使っていてこれの使い方が自分には分からないので細かい事をやるには面倒。Docker は便利そうなんだけど、検証機があれば別に要らないし。そこで今回、DappNode を利用せずに Raiden Network を建ててみた。
※ Docker をディスるつもりはなくて、仮想化技術はサービスインを迅速に行うとか、もちろん検証にも役立つと思うけど、自分が Docker 勉強するのが面倒に思うだけ。 便利だからみんなどんどん使えばいいよ
parity を Goerli に参加させる
Goerli は上述した github のページに全部集約されている。ここを見ればわかる。Goerli は geth も parity も他のいくつもの Ethereum ノードを参加させることができる。
最新版を手に入れていくつかオプションをつけて実行する。
$ parity --chain goerli --jsonrpc-cors=all --unsafe-expose
--chain goerli: これが goerli に参加するオプション。
--jsonrpc-cors=all --unsafe-expose: この parity にリモートのウォレットからアクセスさせたい場合に必要なオプション。ローカルホスト内で作業が完結できる場合は不要なオプション。今回の検証は 2台の PC を用意して、片方にウォレット(Metamask)とブラウザを、もう片方で parity と Raiden ノードを動かしている。前者をクライアント、後者をサーバと呼称しよう。クライアントから SSH でサーバへログインして作業をする。ウォレットから parity へアクセスするのに 8545 番ポートを開放する必要がある。
parity は Warp モードで動作する。goerli では 30分で最新ブロックの同期が開始された。
Raiden を Goerli 向けに建てる
parity で goerli 用のアカウントを作成する。これは後で Raiden で使う
$ parity --chain goerli account new
Linux なら ~/.local/share/io.parity.ethereum//keys/goerli に作成される。
Raiden の 最新版を手に入れていくつかオプションをつけて実行する。
$ raiden --network-id goerli --keystore-path ~/.local/share/io.parity.ethereum//keys/goerli/ --rpccorsdomain "*" --api-address "サーバのIPアドレス:5001" --environment-type development
--network-id goerli: が raiden を Goerli 向けに建てるオプション
--keystore-path: がさっきのアカウントを指定する
--rpccorsdomain "*" --api-address "サーバのIPアドレス:5001": この Raiden にリモートのブラウザからアクセスさせたい場合に必要なオプション。ローカルホスト内で作業が完結できる場合は不要なオプション。ブラウザからサーバへアクセスするのに 5001 番ポートを開放する必要がある。
--environment-type development: デフォルトが production でメインネット用の環境として動作してしまうので開発用にする。--network-id でスイッチできてもいいのに。。。production だと一部の API で 501 Not Implemented が発生する。
node@node-FMVNA6GM:~$ raiden-v0.100.3-linux-x86_64 --network-id goerli --keystore-path ~/.local/share/io.parity.ethereum//keys/goerli/ --rpccorsdomain "*" --api-address "192.168.0.110:5001" --environment-type development Welcome to Raiden, version 0.100.3! ---------------------------------------------------------------------- | This is an Alpha version of experimental open source software | | released as a test version under an MIT license and may contain | | errors and/or bugs. No guarantee or representations whatsoever is | | made regarding its suitability (or its use) for any purpose or | | regarding its compliance with any applicable laws and regulations. | | Use of the software is at your own risk and discretion and by | | using the software you acknowledge that you have read this | | disclaimer, understand its contents, assume all risk related | | thereto and hereby release, waive, discharge and covenant not to | | sue Brainbot Labs Establishment or any officers, employees or | | affiliates from and for any direct or indirect liability resulting | | from the use of the software as permissible by applicable laws and | | regulations. | | | | Privacy Warning: Please be aware, that by using the Raiden Client, | | among others, your Ethereum address, channels, channel deposits, | | settlements and the Ethereum address of your channel counterparty | | will be stored on the Ethereum chain, i.e. on servers of Ethereum | | node operators and ergo are to a certain extent publicly available.| | The same might also be stored on systems of parties running Raiden | | nodes connected to the same token network. Data present in the | | Ethereum chain is very unlikely to be able to be changed, removed | | or deleted from the public arena. | | | | Also be aware, that data on individual Raiden token transfers will | | be made available via the Matrix protocol to the recipient, | | intermediating nodes of a specific transfer as well as to the | | Matrix server operators. | ---------------------------------------------------------------------- Have you read, understood and hereby accept the above disclaimer and privacy warning? [y/N]:
y 入力して Enter。
2019-06-20 12:27:52.474188 [info ] Starting Raiden [raiden.ui.runners] architecture=x86_64 distribution=bundled python_implementation=CPython python_version=3.7.3 raiden=0.100.3 system=Linux 64bit_ELF 5.0.0-16-generic The following accounts were found in your machine: [ 0] - 0xfb855d8BfBdD135D95aFf768AB98E73C5FD5C1A4 Select one of them by index to continue:
0 入力して Enter。
Enter the password to unlock 0xfb855d8bfbdd135d95aff768ab98e73c5fd5c1a4:
parity --chain goerli account new で設定したパスワードを入力して Enter
Raiden is running in production mode Checking if the ethereum node is synchronized You are connected to the 'goerli' network and the DB path is: /home/node/.raiden/node_fb855d8b/netid_5/network_0b4d768c/v22_log.db 2019-06-20 12:29:41.234264 [info ] Automatically selecting matrix homeserver based on RTT [raiden.network.transport.matrix.utils] sorted_servers=['https://raidentransport.exchangeunion.com', 'https://raidentransport.mycryptoapi.com', 'https://persephone.raidentransport.digitalvirtues.com', 'https://raidentransport.ki-decentralized.com'] The Raiden API RPC server is now running at http://192.168.0.110:5001/. See the Raiden documentation for all available endpoints at http://raiden-network.readthedocs.io/en/stable/rest_api.html
これで起動完了。ログの中でさっきのアカウントへ入金しろ的な警告がでるので https://goerli-faucet.slock.it/ などで Faucet から GoETH を送金する。Ethereum 側のコントラクトを呼び出すときに ETH が必要になる。
で、ブラウザからサーバ側に建てた Raiden の Web UI にアクセスできる。
parity も Raiden も Ctrl + C で正常終了させられる。デーモンのように扱いたいなら nohup を利用すればいい。
まとめ
これで goerli でいろいろ検証もできるし、Raiden の動作確認もできるようになった。次回の記事では、Raiden でできることを確認したい。
Raiden Explorer が goerli Raiden のエクスプローラーになっている。メインネットより活発かも。