Golemのインストール方法

# 概要

ブロックチェーン技術を使って余っているCPUを貸すことで報酬を受け取るサービスのGolemをUbuntu serverにインスタンスする  
https://golem.network/

# 前提条件
- OS: Ubuntu16.04 server (まだ18も20も公式にはサポートしてない)
- CPU: 2Core以上
- Memory:2GB以上
- Storage: 20GB以上
- Port: 40102, 40103, 3282を開けられること(ポート転送でも可)
- Global IP: 1個


# インストール


- dockerのインストール

```
$ sudo apt-get update
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22

$ sudo apt-add-repository "deb [arch=amd64] https://download.dock
er.com/linux/ubuntu $(lsb_release -cs) stable"

$ sudo apt update
$ sudo apt install docker-ce
$ sudo usermod -a -G docker $USER
```

- golemのインストール

```
$ wget https://raw.githubusercontent.com/golemfactory/golem/develop/Installer/Installer_Linux/install.sh

$ ls
install.sh

$ chmod +x install.sh
$ ./install.sh
Golem Linux Installer version 0.1.0
 * Downloading manifest +
 * Downloading install script for extension 'gvisor' +
 * Downloading runsc +
 * Downloading runsc hash +
 * Checking runsc hash +
 * Installing runsc +
 * Downloading install script for extension 'linuxmint' +
 * Downloading install script for extension 'nvidia' +
/tmp/nvidia_docker_extension.sh: line 24: lspci: command not found
WARNING: Not supported: nvidia-container-runtime: incompatible device
 * Removing obsolete docker +
 * Installing docker dependencies +
 * Adding docker repository GPG key +
 * Adding docker repository +
 * Updating packages +
 * Installing docker-ce +
 * Add user to docker group. +
 * Restarting docker +
 * Testing docker is running +
 * Updating apt repositories +
 * Installing dependencies +
 * Downloading release 0.23.1 +
 * Extracting release archive golem-0.23.1-linux.tar.gz to /opt/golem/0.23.1 +
 * Symlinking golemapp to /usr/local/bin +
 * Downloading install component cli +
 * Extracting component archive golemcli-linux-v0.3.2.tar.gz to /opt/golem/0.23.1/ +
 * Symlinking golemcli to /usr/local/bin +
 * Downloading install component gui +
 * Extracting component archive golem-electron-beta-linux-0.2.6.tar.gz to /opt/golem/0.23.1/electron +
 * Symlinking golem to /usr/local/bin +
 * Downloading install component hyperg +
 * Extracting component archive hyperg_0.3.6_linux-x64.tar.gz to /opt/golem/0.23.1/ +
 * Symlinking hyperg to /usr/local/bin +
Golem has been installed succesfully.
```

- 1回再起動

```
$ sudo reboot
```

- golemappをmainnetに接続

```
$ golemapp --mainnet
INFO     [golemapp                           ] GOLEM Version: 0.23.1
INFO     [golemapp                           ] Protocol Version: 32
INFO     [golemapp                           ] golem_messages Version: 3.15.0
INFO     [golemapp                           ] system: Linux, release: 4.15.0-1045-oracle, version: #49~16.04.1-Ubuntu SMP Fri Jun 5 09:30:16 UTC 2020, machine: x86_64
INFO     [golemapp                           ] cpu: AuthenticAMD AMD EPYC 7551 32-Core Processor, 2 cores
INFO     [golemapp                           ] memory: 981.9 MiB, swap: 0 Bytes
INFO     [golemapp                           ] Ethereum chain: mainnet
INFO     [golemapp                           ] Concent url: https://main.concent.golem.network
INFO     [golemapp                           ] Concent public key: 465b03a8ab5b98d4d424f8e10f4792a1b2ef2ac5607db532aa551fd48b09b53d725c8c0741608c1a83013e409b87178d2ffc0ba5e1802e9d6dbc519368521f36
INFO     [golem.ethereum.web3.providers      ] GETH: connecting to remote RPC interface at https://1.geth.golem.network:55555
INFO     [golem.hardware.presets             ] updating config: name: custom, num_cores: 1, max_memory_size: 1.0 GiB, max_resource_size: 42.5 GiB


INFO     [golem.rpc.session                  ] Client connected, starting WAMP-Ticket challenge.
INFO     [golem.rpc.session                  ] WAMP-Ticket challenge received.
INFO     [golem.node                         ] New account, waiting for password to be set. Run `golemcli account unlock` and enter your password.
INFO     [golem.node                         ] Terms of use must be accepted before using Golem. Run `golemcli terms show` to display the terms and `golemcli terms accept` to accept them.
WARNING  [apps.core.nvgpu                    ] NVGPU Docker environment is not supported: FileNotFoundError(2, "No such file or directory: 'lspci'")
WARNING  [golem.docker.manager               ] Image golemfactory/nvgpu:1.7 is not supported
WARNING  [apps.core.nvgpu                    ] NVGPU Docker environment is not supported: FileNotFoundError(2, "No such file or directory: 'lspci'")
WARNING  [golem.docker.manager               ] Image golemfactory/blender_nvgpu:1.7 is not supported
WARNING  [golem.docker.manager               ] Docker: pulling image 'golemfactory/base:1.8'
INFO     [golem.node                         ] New account, waiting for password to be set. Run `golemcli account unlock` and enter your password.
INFO     [golem.node                         ] Terms of use must be accepted before using Golem. Run `golemcli terms show` to display the terms and `golemcli terms accept` to accept them.
INFO     [golem.node                         ] New account, waiting for password to be set. Run `golemcli account unlock` and enter your password.
```

- ctl + cで一回止める

- バックグラウンドで実行

```
$ nohup golemapp --mainnet &
```

# 利用規約に同意

- 利用規約を表示する

```
$ golemcli terms show
(略)
The current version of the Privacy Policy is available at
[https://golem.network/privacy][4].

[1] https://www.gnu.org/licenses/gpl.html
[2] https://www.gnu.org/licenses/gpl-3.0.de.html
[3] https://stats.golem.network/show
[4] https://golem.network/privacy
```

- 利用規約の承認

```
$ golemcli terms accept
Enable monitor (Y/n): Y
         monitor will be ENABLED
Enable talkback (Y/n): Y
         talkback will be ENABLED
Terms of use have been accepted.
```

# コマンド

- インタラクティブモード

```
$ golemcli -i
>>
```

- パスワード設定して、アンロックする

```
>> account unlock
account locked
No account found, generate one by setting a password
Password:
Confirm password:
Waiting for server start

>> account unlock
Unlock your account to start golem
Password:
Account unlock success
```

- アカウントの詳細取得

```
>> account info
---
Golem_ID: e4ec578c07a3e2f6d08a359862ec79098a912f9ac4e460a000637e033a9b4d739765a87c2fd78a10058623a2c9c050f924decbca9553a3a23ac4b0d644d7681f
node_name: ""
requestor_reputation: 0
provider_reputation: 0
finances:
  eth_address: 0x7cB301C33B0396E5C09BcfA56593547ac6dAB3E7
  eth_available: 0 ETH
  eth_locked: 0 ETH
  gnt_available: 0 GNT
  gnt_locked: 0 GNT
  gnt_unadopted: 0 GNT
  deposit_balance: ~
```

- ネットワーク情報確認

```
>> network show
lqqqqqqqqqqqqqqqqqqqwqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqk
x  ip               x  port   x  id                                   x  name              x
tqqqqqqqqqqqqqqqqqqqnqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqu
x  64.201.233.144   x  40102  x  654003d5a24a4dcb...32e8065f399cf91c  x  beta.etakmit      x
x  71.81.231.5      x  40102  x  9da4e2f04cbc8a94...211af2bf3648ebd1  x  DGRIGG1           x
x  93.103.19.13     x  40102  x  364fd5af249d5ec3...6e775ae85434e061  x  DedoGolem         x
x  212.107.134.162  x  40102  x  3ec2a24cc27e9186...98ef9eabfdf65975  x  ewishrog          x
x  37.48.84.26      x  40102  x  dc6942cfa676bf31...004ecf56fe07cd85  x  obad-hai          x
x  84.10.50.51      x  40102  x  258ab76a7ca7e49f...de44f18b65073c78  x  tiger-zoo         x
x  35.158.208.82    x  40102  x  d7ce2191b85b2e78...40b8e4fe4128cdbd  x  mainnet-gf-0 git  x
x  18.196.204.0     x  40102  x  1f8e0cdf9006ad7b...0bbe58cccf6c3ba6  x  TastyDoe          x
x  64.201.233.144   x  40104  x  33450cd2cf95fdf4...87dc2b554f2e0f59  x  alpha.etakmit     x
x  18.197.86.211    x  40102  x  0c706778f7442d63...7beb2cebbddcba13  x  mainnet-gf-1 git  x
mqqqqqqqqqqqqqqqqqqqvqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqj
```


# 秘密鍵の場所

- ここにありました。出金とかする時はこの鍵をウォレットに渡せばいいのかな？

```
$ ls ~/.local/share/golem/default/mainnet/keys/keystore.json
/home/ubuntu/.local/share/golem/default/mainnet/keys/keystore.json
```