Skip to content

Latest commit

 

History

History
479 lines (361 loc) · 15.9 KB

run-keep-ecdsa.adoc

File metadata and controls

479 lines (361 loc) · 15.9 KB

Run ECDSA Keep

1. System Considerations

The Keep Network expects certain capabilites for each node running on the network. To help attain these capabilities consider the following criteria:

  • It is paramount that Keep nodes remain available to the Keep Network. We strongly encourage a stable and redundant internet connection.

  • A connection to a production grade self-hosted or third party Ethereum node deployment.

  • Persistent and redundant storage that will survive a VM or container rotation, and disk failure.

  • Each Keep ECDSA client running on the network requires a unique Ethereum operator account.

  • Each Keep ECDSA client running on the network requires a unique IP address or a unique application port running under the same IP.

  • Recommended machine types by provider:

Your operating environment will ultimately dictate what machine type to go with. This is particulary relevant if you’re running a containerized solution where multiple applications are sharing VM resources. The below types are sufficient for running at least one instance of the Keep ECDSA client.

Cloud Provider Machine Type

Google Cloud

n2-highcpu-2

AWS

c5.large

Azure

F2s v2

Self-hosted

2 vCPU / 2 GiB RAM / 1 GiB Persistent Storage

2. Configuration

2.1. Network

Default port mappings.

Egress Port

Ethereum Network

TCP: 8545 / 8546

Keep Network

TCP: 3919

Ingress Port

Keep Network

3919

If you set a different port in your keep-ecdsa configuration, or configure peers with non-default ports configured, firewall rules will need to be adjusted accordingly.

2.2. Application

Application configurations are stored in a .toml file and passed to the application run command with the --config flag.

2.2.1. Sample

# This is a TOML configuration file.

# Connection details of ethereum blockchain.
[ethereum]
  URL = "ws://127.0.0.1:8545"
  URLRPC = "http://127.0.0.1:8546"

[ethereum.account]
  KeyFile = "/Users/someuser/ethereum/data/keystore/UTC--2018-03-11T01-37-33.202765887Z--AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAA"

# Addresses of contracts deployed on ethereum blockchain.
[ethereum.ContractAddresses]
  BondedECDSAKeepFactory = "0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"

# Addresses of applications approved by the operator.
[SanctionedApplications]
  Addresses = [
    "0xDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
    "0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
  ]

[Storage]
  DataDir = "/my/secure/location"

[LibP2P]
  Peers = ["/ip4/127.0.0.1/tcp/3919/ipfs/njOXcNpVTweO3fmX72OTgDX9lfb1AYiiq4BN6Da1tFy9nT3sRT2h1"]
  Port = 3919
  # Uncomment to override the node's default addresses announced in the network
  AnnouncedAddresses = ["/dns4/example.com/tcp/3919", "/ip4/80.70.60.50/tcp/3919"]

[TSS]
# Timeout for TSS protocol pre-parameters generation. The value
# should be provided based on resources available on the machine running the client.
# This is an optional parameter, if not provided timeout for TSS protocol
# pre-parameters generation will be set to `2 minutes`.
  PreParamsGenerationTimeout = "2m30s"

2.2.2. Parameters

ethereum Description Default Required

URL

The Ethereum host your keep-ecdsa will connect to. Websocket protocol/port.

""

Yes

URLRPC

The Ethereum host your keep-ecdsa will connect to. RPC protocol/port.

""

Yes

ethereum.account Description Default Required

KeyFile

The local filesystem path to your Keep operator Ethereum account keyfile.

""

Yes

ethereum.ContractAddresses Description Default Required

BondedECDSAKeepFactory

Hex-encoded address of the BondedECDSAKeepFactory Contract.

""

Yes

SanctionedApplications Description Default Required

Addresses

Comma delimited hex-encoded list of application addresses authorized to bond for a given operator.

[""]

Yes

LibP2P Description Default Required

Peers

Comma separated list of network peers to boostrap against.

[""]

Yes

Port

The port to run your instance of Keep on.

3919

Yes

AnnouncedAddresses

Multiaddr formatted hostnames or addresses annouced to the Keep Network. More on multiaddr format in the libp2p reference.

[""]

No

Storage Description Default Required

DataDir

Location to store the Keep nodes group membership details.

""

Yes

TSS Description Default Required

PreParamsGenerationTimeout

Timeout for TSS protocol pre-parameters generation.

"2m"

No

3. Build from Source

See the building section in our developer docs.

4. Docker

4.1. Get Image

Latest: docker pull keepnetwork/keep-ecdsa-client

Tag: docker pull keepnetwork/keep-ecdsa-client:<tag-version>

4.2. Run Image

This is a sample run command for illustration purposes only.

export KEEP_ECDSA_ETHEREUM_PASSWORD=$(cat .secrets/eth-account-password.txt)
export KEEP_ECDSA_CONFIG_DIR=$(pwd)/config
export KEEP_ECDSA_PERSISTENCE_DIR=$(pwd)/persistence

docker run -d \
--entrypoint /usr/local/bin/keep-ecdsa \
--volume $KEEP_ECDSA_PERSISTENCE_DIR:/mnt/keep-ecdsa/persistence \
--volume $KEEP_ECDSA_CONFIG_DIR:/mnt/keep-ecdsa/config \
--env KEEP_ETHEREUM_PASSWORD=$KEEP_ECDSA_ETHEREUM_PASSWORD \
--env LOG_LEVEL=debug \
-p 3919:3919 \
keepnetwork/keep-ecdsa-client:<version> --config /mnt/keep-ecdsa/config/keep-ecdsa-config.toml start

5. Deployment Considerations

5.1. Kubernetes

At Keep we run on GCP + Kube. To accommodate the aforementioned system considerations we use the following pattern for each of our environments:

  • Regional Kube cluster.

  • 5 ECDSA clients, each running minimum stake required by the network.

  • A LoadBalancer Service for each client.

  • A StatefulSet for each client.

You can see our Ropsten Kube configurations here

6. Logging

Below are some of the key things to look out for to make sure you’re booted and connected to the network:

6.1. Configurable Values

LOG_LEVEL=DEBUG
IPFS_LOGGING_FMT=nocolor
GOLOG_FILE=/var/log/keep/keep.log
GOLOG_TRACING_FILE=/var/log/keep/trace.json

6.2. Startup

▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  ▓▓▓▓▓▓    ▓▓▓▓▓▓▓▀    ▐▓▓▓▓▓▓    ▐▓▓▓▓▓   ▓▓▓▓▓▓     ▓▓▓▓▓   ▐▓▓▓▓▓▌   ▐▓▓▓▓▓▓
  ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀      ▐▓▓▓▓▓▓▄▄▄▄         ▓▓▓▓▓▓▄▄▄▄         ▐▓▓▓▓▓▌   ▐▓▓▓▓▓▓
  ▓▓▓▓▓▓▓▓▓▓▓▓▓▀        ▐▓▓▓▓▓▓▓▓▓▓         ▓▓▓▓▓▓▓▓▓▓▌        ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  ▓▓▓▓▓▓▀▀▓▓▓▓▓▓▄       ▐▓▓▓▓▓▓▀▀▀▀         ▓▓▓▓▓▓▀▀▀▀         ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▀
  ▓▓▓▓▓▓   ▀▓▓▓▓▓▓▄     ▐▓▓▓▓▓▓     ▓▓▓▓▓   ▓▓▓▓▓▓     ▓▓▓▓▓   ▐▓▓▓▓▓▌
▓▓▓▓▓▓▓▓▓▓ █▓▓▓▓▓▓▓▓▓ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓▓▓

Trust math, not hardware.

-----------------------------------------------------------------------------------------------
| Keep ECDSA Node                                                                             |
|                                                                                             |
| Port: 3919                                                                                  |
| IPs : /ip4/127.0.0.1/tcp/3919/ipfs/16Uiu2HAmCcfVpHwfBKNFbQuhvGuFXHVLQ65gB4sJm7HyrcZuLttH    |
|       /ip4/10.102.0.112/tcp/3919/ipfs/16Uiu2HAmCcfVpHwfBKNFbQuhvGuFXHVLQ65gB4sJm7HyrcZuLttH |
-----------------------------------------------------------------------------------------------

Bonus: If you want to share your LibP2P address with others you can get it from the startup log. When sharing remember to substitute the /ipv4/ address with the public facing IP of your client if you’re running on a private machine, or replace the entire /ipv4/ segment with a DNS entry if you’re using a hostname.

6.3. Peer Connections

21:19:47.129 DEBUG keep-net-w: connected to [1] peers:[16Uiu2HAm3eJtyFKAttzJ85NLMromHuRg4yyum3CREMf6CHBBV6KY]

7. ETH Networks

7.1. Mainnet

7.1.1. Boostrap Peers

"/dns4/bst-a01.ecdsa.keep.boar.network/tcp/4001/ipfs/16Uiu2HAkzYFHsqbwt64ZztWWK1hyeLntRNqWMYFiZjaKu1PZgikN",
"/dns4/bst-b01.ecdsa.keep.boar.network/tcp/4001/ipfs/16Uiu2HAkxLttmh3G8LYzAy1V1g1b3kdukzYskjpvv5DihY4wvx7D",
"/dns4/keep-boot-validator-0.prod-us-west-2.staked.cloud/tcp/3920/ipfs/16Uiu2HAmDnq9qZJH9zJJ3TR4pX1BkYHWtR2rVww24ttxQTiKhsaJ",
"/dns4/keep-boot-validator-1.prod-us-west-2.staked.cloud/tcp/3920/ipfs/16Uiu2HAmHbbMTDDsT2f6z8zMgDtJkTUDJQSYsQYUpaJjdMjiYNEf",
"/dns4/keep-boot-validator-2.prod-us-west-2.staked.cloud/tcp/3920/ipfs/16Uiu2HAmBXoNLLMYU9EcKYH6JN5tA498sXQHFWk4heK22RfXD7wC",
"/ip4/54.39.179.73/tcp/4001/ipfs/16Uiu2HAkyYtzNoWuF3ULaA7RMfVAxvfQQ9YRvRT3TK4tXmuZtaWi",
"/ip4/54.39.186.166/tcp/4001/ipfs/16Uiu2HAkzD5n4mtTSddzqVY3wPJZmtvWjARTSpr4JbDX9n9PDJRh",
"/ip4/54.39.179.134/tcp/4001/ipfs/16Uiu2HAkuxCuWA4zXnsj9R6A3b3a1TKUjQvBpAEaJ98KGdGue67p",

7.1.2. Contracts

Contract addresses needed to boot a Keep ECDSA client:

Bonding

BondedECDSAKeepFactory

0x18758f16988E61Cd4B61E6B930694BD9fB07C22F

Sanctioned Applications

0x41A1b40c1280883eA14C6a71e23bb66b83B3fB59 (tBTC’s system contract)

tBTC Sortition pool (for authorization)

0x4b558ff45f08198e00cc13de2ccefb9998e0290e

7.2. Testnet

Keep uses the Ethereum Ropsten Testnet.

7.2.1. Faucet

The KEEP faucet will will issue a 300k KEEP token grant for the provided Ethereum account. You can use the faucet from your web browser or via a terminal using curl.

To use the faucet you need to pass your Ethereum account to the faucet endpoint with the parameter ?account=<eth-account-address>.

Curl Example:

curl 'https://us-central1-keep-test-f3e0.cloudfunctions.net/keep-faucet-ropsten?account=0x0eC14BC7cCA82c942Cf276F6BbD0413216dDB2bE'

Browser Example:

https://us-central1-keep-test-f3e0.cloudfunctions.net/keep-faucet-ropsten?account=0x0eC14BC7cCA82c942Cf276F6BbD0413216dDB2bE

Once you’ve got your KEEP token grant you can manage it with our token dashboard.

7.2.2. Bootstrap Peers

Bootstrap peers will come and go on testnet. As long as at least one of your configured peers is up, there is no need to worry.

"/dns4/bootstrap-1.ecdsa.keep.test.boar.network/tcp/4001/ipfs/16Uiu2HAmPFXDaeGWtnzd8s39NsaQguoWtKi77834A6xwYqeicq6N",
"/dns4/ecdsa-2.test.keep.network/tcp/3919/ipfs/16Uiu2HAmNNuCp45z5bgB8KiTHv1vHTNAVbBgxxtTFGAndageo9Dp",
"/dns4/ecdsa-3.test.keep.network/tcp/3919/ipfs/16Uiu2HAm8KJX32kr3eYUhDuzwTucSfAfspnjnXNf9veVhB12t6Vf",

7.2.3. Contracts

Contract addresses needed to boot a Keep ECDSA client:

Bonding

BondedECDSAKeepFactory

0xe7BF8421fBE80c3Bf67082370D86C8D81D1D77F4

Sanctioned Applications

0x25B60668E7a0967a86223828D20f93714D91Ee4B (tBTC’s system contract)

tBTC Sortition pool (for authorization)

0x787fE59d9EefAf4c1214D6d6F547318Fcad54EE9

8. Staking

8.1. Terminology

address

Hexadecimal string consisting of 40 characters prefixed with "0x" uniquely identifying Ethereum account; derived from ECDSA public key of the party. Example address: 0xb2560a01e4b8b5cb0ac549fa39c7ae255d80e943.

owner

The address owning KEEP tokens or KEEP token grant. The owner’s participation is not required in the day-to-day operations on the stake, so cold storage can be accommodated to the maximum extent.

operator

The address of a party authorized to operate in the network on behalf of a given owner. The operator handles the everyday operations on the delegated stake without actually owning the staked tokens. An operator can not simply transfer away delegated tokens, however, it should be noted that operator’s misbehaviour may result in slashing tokens and thus the entire staked amount is indeed at stake.

beneficiary

the address where the rewards for participation and all reimbursements are sent, earned by an operator, on behalf of an owner

delegated stake

an owner’s staked tokens, delegated to the operator by the owner. Delegation enables KEEP owners to have their wallets offline and their stake operated by operators on their behalf.

operator contract

Ethereum smart contract handling operations that may have an impact on staked tokens.

authorizer

the address appointed by owner to authorize operator contract on behalf of the owner. Operator contract must be pre-approved by authorizer before the operator is eligible to use it and join the specific part of the network.

8.2. Delegating tokens

KEEP tokens are delegated by the owner. During the delegation, the owner needs to appoint an operator, beneficiary, and authorizer. Owner may delegate owned tokens or tokens from a grant. Owner may decide to delegate just a portion of owned tokens or just a part of tokens from a grant. Owner may delegate multiple times to different operators. Tokens can be delegated using Tokens page in KEEP token dashboard and a certain minimum stake defined by the system is required to be provided in the delegation. The more stake is delegated, the higher chance to be selected to relay group.

Delegation takes immediate effect but can be cancelled within one week without additional delay. After one week operator appointed during the delegation becomes eligible for work selection.

8.3. Authorizations

Before operator is considered as eligible for work selection, the authorizer appointed during the delegation needs to review and perform the following authorizations:

BondedECDSAKeepFactory operator contract

Allows the factory to slash tokens on misbehaviour and makes the operator eligible for work selection. This is an operator contract much like the KeepRandomBeaconOperator contract. Uses tokenStaking.authorizeOperatorContract.

Bond Access for tBTC

Allows for the authorized application (tBTC) to bond from the available bond value stored in the KeepBonding contract. Uses keepBonding.authorizeSortitionPoolContract.

These smart contracts can be authorized using the KEEP token dashboard. As always, authorized operator contracts may slash or seize tokens in case of operator misbehavior. Contracts authorized for bonding are set in SanctionedApplications.Addresses in the config file. The operator must explicitly register as a candidate for selection, as a safeguard against choosing clients that have not yet booted up; the sanctioned applications list allows the client software to automatically register as a candidate on startup.