bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 36쪽 중 5쪽
--------------------- |
| AWS | c5.large |
| Azure | F2s v2 |
| Google Cloud | n2-highcpu-2 |
| Self-hosted | 2 vCPU / 2 GB RAM / 1 GiB Persistent Storage |
### **Ethereum API**
A Keep Node requires a connection to a WebSocket Ethereum API. You should obtain a WS API URL from a service provider (e.g. [Alchemy](https://www.alchemy.com/), [Infura](https://www.infura.io/), [Ankr](https://www.ankr.com/rpc-service/)) or run your own Ethereum node (e.g. [Geth](https://geth.ethereum.org/)).
### Bitcoin API
Starting from version `v2.0.0-m3` , the Keep Node interacts with the Bitcoin network through an Electrum protocol server. You can use one of the publicly available servers or run your own. The URL of the chosen server should be passed under the `bitcoin.electrum` section of the configuration. If no Electrum server is set explicitly in the `bitcoin.electrum` configuration section, the Keep Node will randomly pick one server from its embedded server list, appropriate for the Bitcoin network the Keep Node is currently running against.
### Configuration
The client expects configuration options to be passed as CLI flags or specified in a [config file](/tbtc-signer-nodes/tbtc-v2-node-setup/advanced-options/config-file). If you specify an option by using a parameter on the command line, it will override the value read from the configuration file.
# Operator Account
Prepare your machine to install the tBTC v2 client
The client requires an Ethereum Key File of an Operator Account to connect to the Ethereum chain. This account is created in a subsequent step using Geth (GoEthereum).
The Ethereum Key File is expected to be encrypted with a password. The password has to be provided in a prompt after the client starts or configured as a `KEEP_ETHEREUM_PASSWORD` environment variable.
The Operator Account has to maintain a positive Ether balance at all times. We strongly advise you monitor the account and top-up when its balance gets below 0.5 Ether.
### Install Geth (GoEthereum)
To create a new Ethereum account, [install Geth](https://geth.ethereum.org/docs/getting-started/installing-geth) (GoEthereum) and create a new account using the command below. This account will subsequently be referred to as the Operator Account.
<pre class="language-bash"><code class="lang-bash"><strong>geth account new --keystore /home/$USER/.operator-key
</strong></code></pre>
When prompted, provide a password to protect the operator key file. 
{% hint style="info" %}
Use a password manager to generate a strong password and store it safely. It will be needed again during setup.
{% endhint %}
{% hint style="warning" %}
Avoid passwords that contain the following characters: ', ", \`, $\
These characters may be interpreted as part of the configuration which can lead to undesirable outcomes that may be extremely time intensive to correct.
{% endhint %}
Once the process completes, your public key will be displayed. Take note of your Operator Account public key.
{% hint style="danger" %}
DO NOT LOSE THE PASSWORD TO THE OPERATOR ACCOUNT.
{% endhint %}
### Funding your Operator Account
Your Operator Account will need to maintain a positive ETH balance at all times to ensure proper operation and availability of your tBTC v2 node.
# Network Configuration
Required network configuration for the tBTC v2 client.
### Required Ports
The node has to be accessible publicly to establish and maintain connections with bootstrap nodes and discovered peers. The node exposes metrics and diagnostics services for network health monitoring purposes. Update firewall rules as necessary, including application level firewalls for the following ports
| Purpose | Config Property | Protocol | Default |
| ------- | --------------- | -------- | ------- |
| Network | network.port | TCP | 3919 |
| Status | clientInfo.port | TCP | 9601 |
{% hint style="warning" %}
The network port must be exposed publicly for peers to connect to your node.
{% endhint %}
{% hint style="warning" %}
The status port must be exposed publicly for rewards allocation.
{% endhint %}
### **Announced Addresses**
An Announced Address is a layered addressing information (`multiaddress`/`multiaddr`) announced to the Threshold Network that is used by peers to connect with your node, e.g.: `/dns4/bootstrap-0.test.keep.network/tcp/3919` or `/ip4/104.154.61.116/tcp/3919`.
If the machine you’re running your node is not exposing a public IP (e.g. it is behind NAT) you should set the `network.AnnouncedAddresses` (flag: `--network.announcedAddresses`) configuration property to addresses (`ip4` or `dns4`) under which your node is reachable for the public.
To read more about `multiaddress` see the [libp2p documentation](https://docs.libp2p.io/reference/glossary/#multiaddr).
# Data Storage
Setup persistent data directories for the client.
The client requires two persistent directories. These directories will store configuration files and data generated and used by the client. It is highly recommended to create frequent backups of these directories. Loss of these data may be catastrophic and may lead to slashing.
{% hint style="warning" %}
It is crucial to ensure that the data directory is persisted and backed up regularly.
{% endhint %}
#### Create folders for tBTC v2 client
```bash
cd /home/$USER/
mkdir keep
cd keep
mkdir storage config
```
The tBTC v2 client will create two subdirectories within the storage directory: `keystore` and `work`. You do not need to create these. 
The `keystore` subdirectory contains sensitive key material data generated by the client. Losing the `keystore` data is a serious protocol offense and leads to slashing and potentially losing funds.
{% hint style="danger" %}
It is the operator’s responsibility to ensure the keystore data is not lost under any circumstances.
{% endhint %}
The `work` directory contains data generated by the client that should persist through client restarts or relocations. If the `work` data are lost, the client will be able to recreate them, but it is inconvenient due to the time needed for the operation to complete, and may lead to losing rewards.
### **Copy the Operator keystore file**
Assuming [Geth was installed](/tbtc-signer-nodes/tbtc-v2-node-setup/operator-account) for the root user with the command provided in the [Operator Account creation](/tbtc-signer-nodes/tbtc-v2-node-setup/operator-account) step, the operator-key file should be located in the `/.operator-key` directory.
```bash
cd /home/$USER/.operator-key
```
Contained within the `operator-key` directory is the account key file (operator key file), its name will be similar to the following: \
`UTC--2018-11-01T06-23-57.810787758Z--fa3da235947aab49d439f3bcb46effd1a7237e32`
**Copy (not move!)** this account key file to the `config` directory created above
```bash
ls -la
cp name_of_account_key_file /home/$USER/keep/config/name_of_account_key_file
```
# Installation
A tBTC v2 node can be set up using either a docker or binary installation.
The next pages cover the complete setup process for a tBTC v2 node. Two installation methods are supported, Docker and binary, each with its own configuration flow. Choose the method that aligns with your infrastructure standards, then follow the step-by-step instructions to bring your node online and connect it to the Threshold Network.
# Docker Installation
This page will guide you through Docker setup steps.
### Install Docker
Install or update Docker to the latest version. Visit the [Official Docker website](https://docs.docker.com/engine/install/ubuntu/) for detailed instructions. Use the command below to find your installed version if needed:
```bash
docker --version
```
### Docker and Security Best Practices
General best practices recommend against running the tBTC v2 client as the `root` user as a security precaution. One security-minded approach is to [Run the Docker daemon as a non-root user](https://docs.docker.com/engine/security/rootless/) (Rootless mode). 
Next, choose ONE of the following options:\
**Docker Compose** makes managing the container simple, but requires an additional step to ensure the container starts after a reboot.\
The **tBTC v2 Service** option configures the client to run as a service in order to ensure that the client is restarted automatically, should your machine reboot.\
The **Docker Launch Script** is faster to setup, but won't start the client if your machine reboots.
{% tabs %}
{% tab title="Docker Compose" %}
Navigate to `cd /home/$USER/keep/`
Create a file named `docker-compose.yaml`
Copy the the template below into the file and replace the \<Placeholders> with respective details.
```
version: '3'
services:
keep-client:
image: keepnetwork/keep-client:latest
container_name: keep-client
restart: on-failure
ports:
- "3919:3919"
- "9601:9601"
volumes:
- /home/$USER/keep/config/:/mnt/keep/config
- /home/$USER/keep/storage/:/mnt/keep/storage
environment:
- KEEP_ETHEREUM_PASSWORD=<Operator Account keyfile password>
- LOG_LEVEL=info
logging:
options:
max-size: "100m"
max-file: "3"
command: start --ethereum.url "<Ethereum API WS URL>" --ethereum.keyFile "/mnt/keep/config/<Operator Account keyfile name>" --storage.dir "/mnt/keep/storage" --network.announcedAddresses "/ip4/<PUBLIC_IP_OF_MACHINE>/tcp/3919"
```
Save and close the file when finished.
To start the tBTC client `sudo docker compose up`
tBTC will start up with the console output on screen. Verify that the client is running correctly, then press `CTRL` + `c` to stop the client.
Restart the client with the 'detach' flag: `sudo docker compose up -d`
To stop the container at a later time, use `sudo docker compose down`
#### Starting Container Automatically After Reboot
To ensure the tBTC container starts after a server reboot, use the template below to create a service in `/etc/systemd/system/` called `docker-compose-app.service`
```
# /etc/systemd/system/docker-compose-app.service
[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service
StartLimitIntervalSec=60
[Service]
WorkingDirectory=/home/$USER/keep/
ExecStart=/usr/local/bin/docker-compose up
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0
Restart=on-failure
StartLimitBurst=3
[Install]
WantedBy=multi-user.target
```
Adjust the `WorkingDirectory` to the path of your tBTC folder. Save and close the file when finished.
use `sudo systemctl enable docker-compose-app` to enable the service.
{% endtab %}
{% tab title="Systemd Service" %}
Create the tbtcv2.service file:
```bash
cd /etc/systemd/system/
nano tbtcv2.service
```
Paste the following in the tbtcv2.service file:
<pre class="language-bash"><code class="lang-bash"><strong>[Unit]
</strong>Description=tBTC v2 client
After=network.target
Wants=network.target
[Service]
Environment="ETHEREUM_WS_URL=<Ethereum API WS URL>"
Environment="OPERATOR_KEY_FILE_NAME=<Operator Account keyfile name>"
Environment="OPERATOR_KEY_FILE_PASSWORD=<Operator Account keyfile password>"
Environment="PUBLIC_IP=/ip4/<PUBLIC_IP_OF_MACHINE>/tcp/3919"
Environment="CONFIG_DIR=/home/<user name>/keep/config"
Environment="STORAGE_DIR=/home/<user name>/keep/storage"
# These items only apply if you setup rootless-mode.
# Do not enable unless using rootless mode. Don't forget to adjust user UID.
#Environment="XDG_RUNTIME_DIR=/run/<user name>/<user UID>/"
#Environment="DOCKER_HOST=unix:///run/<user name>/<user UID>/docker.sock"
Type=simple
WorkingDirectory=/home/$USER
ExecStart=/usr/bin/docker run \
--volume ${CONFIG_DIR}:/mnt/keep/config \
--volume ${STORAGE_DIR}:/mnt/keep/storage \
--env KEEP_ETHEREUM_PASSWORD=${OPERATOR_KEY_FILE_PASSWORD} \
--env LOG_LEVEL=info \
--log-opt max-size=100m \
--log-opt max-file=3 \
-p 3919:3919 \
-p 9601:9601 \
keepnetwork/keep-client:latest \
start \
--ethereum.url ${ETHEREUM_WS_URL} \
--ethereum.keyFile /mnt/keep/config/${OPERATOR_KEY_FILE_NAME} \
--storage.dir /mnt/keep/storage \
--network.announcedAddresses $PUBLIC_IP
Restart=always
RestartSec=15s
[Install]
WantedBy=default.target
</code></pre>
Replace the placeholders inside the <> brackets, remove the <> brackets but be sure to not edit anything further.
When done, save and close the file.
Next, test to make sure your configuration works:
```bash
sudo systemctl start tbtcv2
```
There will be no console output because it will be running in the background. Use systemctl to get the status of the service:
```bash
sudo systemctl status tbtcv2
```
If the service failed, go back and double check your configuration. 
Another option is to see if the Docker container is running:
```bash
docker ps
```
If everything is running as intended, enable the service:
```bash
systemctl enable tbtcv2
```
Now, with the service running, you should make sure that your configuration will tolerate a reboot and start up again automatically.
```bash
reboot now
```
Log back in to your machine and check that the service is running. If it is, you're done. If not, go back and review your work.
{% endtab %}
{% tab title="Docker Container" %}
### Docker Launch Script
To launch the tBTC v2 client, several configuration flags and environmental values need to be set. For simplicity, a bash script can be used rather than typing or pasting all the flags into the console.
Create the launch script:
```
nano keep.sh
```
And paste the following:
```bash
# Keep tBTC v2 Client
#
# Ethereum endpoint WebSocket URL
# This can be a provider such as Infura, Alchemy, Ankr, etc or your own Geth Nodeq
# ETHEREUM_WS_URL="wss://mainnet.infura.io/ws/v3/redacted_credentials"
# note: only replace characters inside the " ". The Quotation marks must be retained
ETHEREUM_WS_URL="<Ethereum API WS URL>"
# copied to home/keep/config earlier
OPERATOR_KEY_FILE_NAME="<Operator Account keyfile name>"
# password set during Operator Account Address creation
OPERATOR_KEY_FILE_PASSWORD="<Operator Account keyfile password>"
# To configure your node with a Public IP, enter it below.
PUBLIC_IP="<PUBLIC_IP_OF_MACHINE>"
# Alternatively, you can use DNS.
# To configure DNS, modify the last line of the script
# and add your DNS in the following format:
# /dns4/bootstrap-1.test.keep.network/tcp/3919
# Setup configuration and storage directories
# THESE MUST BE PERSISTENT STORAGE
CONFIG_DIR="/home/$USER/keep/config"
STORAGE_DIR="/home/$USER/keep/storage"
docker run \
--detach \
--restart on-failure \
--volume $CONFIG_DIR:/mnt/keep/config \
--volume $STORAGE_DIR:/mnt/keep/storage \
--env KEEP_ETHEREUM_PASSWORD=$OPERATOR_KEY_FILE_PASSWORD \
--env LOG_LEVEL=info \
--log-opt max-size=100m \
--log-opt max-file=3 \
-p 3919:3919 \
-p 9601:9601 \
keepnetwork/keep-client:latest \
start \
--ethereum.url $ETHEREUM_WS_URL \
--ethereum.keyFile /mnt/keep/config/$OPERATOR_KEY_FILE_NAME \
--storage.dir /mnt/keep/storage \
--network.announcedAddresses /ip4/$PUBLIC_IP/tcp/3919
```
Save and close the file, and make it executable:
```bash
sudo chmod +x keep.sh
```
To launch the tBTC v2 client, execute:
<pre class="language-bash"><code class="lang-bash"><strong>sudo bash keep.sh
</strong></code></pre>
{% hint style="info" %}
The `--detach` property will prevent the status messages from the client to be printed to the console. Review the Docker logs for detailed status information.
{% endhint %}
{% endtab %}
{% endtabs %}
{% hint style="danger" %}
The path shown in the example configuration will differ from yours. Make sure it is configured correctly.
{% endhint %}
## Client Startup and Logs
Unless the `--detach` flag was removed from the startup script, there will be no console output. In order to check your node, retrieve the Docker logs.
First, find your Docker instance identification, it'll be a random combination of words, e.g. `stinky_brownie`:
```bash
sudo docker ps
```
Use your specific identification and substitute:
```
sudo docker logs stinky_brownie >& /path/to/output/file
```
Scroll down about half a page, and you should see the following:
<pre><code><strong>
</strong>▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▀▀▓▓▓▓▓▓▄ ▐▓▓▓▓▓▓▀▀▀▀ ▓▓▓▓▓▓▀▀▀▀ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▀
▓▓▓▓▓▓ ▀▓▓▓▓▓▓▄ ▐▓▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌
▓▓▓▓▓▓▓▓▓▓ █▓▓▓▓▓▓▓▓▓ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓
Trust math, not hardware.
-----------------------------------------------------------------------------------
| Keep Client Node |
| |
| Version: Version: vX.X.X-XX (4d745f6d0) |
| |
| Operator: 0x_your_operator_address |
| |
| Port: 3919 |
| IPs : /ip4/111.222.333.444/tcp/3919/ipfs/redacted |
| |
| Contracts: |
| RandomBeacon : 0x5499f54b4A1CB4816eefCf78962040461be3D80b |
| WalletRegistry : 0x46d52E41C2F300BC82217Ce22b920c34995204eb |
| TokenStaking : 0x01B67b1194C75264d06F808A921228a95C765dd7 |
-----------------------------------------------------------------------------------
</code></pre>
Congratulations, your node is up and running. 
# Binary Installation
This page will guide you through Binary setup steps.
{% hint style="warning" %}
Choose either Docker installation OR Binary installation.
{% endhint %}
### Download the Binary
See GitHub for the latest release: <https://github.com/threshold-network/keep-core/releases>
Under Assets, copy the path to the compressed binary and use the command below to download the file. Make relevant adjustments to the version as necessary:
{% code overflow="wrap" %}
```bash
cd /home/keep
wget https://github.com/threshold-network/keep-core/releases/download/XX.X.X-XX/keep-client-mainnet-XX.X.X-XX-linux-amd64.tar.gz
```
{% endcode %}
After the download completes, use the command below to display the contents of the folder:
```bash
ls -la
```
Extract the compressed file:
```bash
tar xzvf downloaded-file-name-here.tar.gz
```
{% hint style="info" %}
You can save some time and prevent misspelling a file name by typing the first few letter of the file name and pressing the Tab key. This will autocomplete the file name. Be sure to verify the file name prior to pressing the enter key.
{% endhint %}
### Configure tBTC v2 Client
To launch the tBTC v2 client, several configuration flags and environmental values need to be set. For simplicity, a bash script can be used rather than typing or pasting all the flags into the console. 
The following flags must be set at a minimum:
```bash
--ethereum.url "wss://mainnet-ETH-enpoint-here"
--storage.dir "/home/keep/storage"
--ethereum.keyFile "/home/keep/config/UTC--Your-Operator-Key-Name"
# to configure your node to use your machine's public IP
--network.announcedAddresses "/ip4/your.ipv4.address.here/tcp/3919"
# to configure your node to use DNS, provide your DNS in the following
# format
# /dns4/bootstrap-1.test.keep.network/tcp/3919
```
For a complete list of client commands and flags, see [CLI Options](/tbtc-signer-nodes/tbtc-v2-node-setup/advanced-options/cli-options).
To launch the client, execute the following:
{% code overflow="wrap" %}
```bash
./keep-client start --ethereum.url "wss://mainnet-ETH-enpoint-here" --storage.dir "/home/keep/storage" --ethereum.keyFile "/home/keep/config/UTC--Your-Operator-Key-Name" --network.announcedAddresses "/ip4/your.ipv4.address.here/tcp/3919"
```
{% endcode %}
If everything is configured correctly, the client will request the password for the Operator Account. Supply the password and press Enter. 
You should see the following shortly:
```
▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐프로젝트로 돌아가기