diff --git a/content/concepts/joining-the-network.md b/content/concepts/joining-the-network.md index a1a3dbf8..e7d36d3a 100644 --- a/content/concepts/joining-the-network.md +++ b/content/concepts/joining-the-network.md @@ -12,23 +12,20 @@ The network is not currently accepting public/user-ran validator nodes. We will The process works something like this: 1. The new validator operates an Entropy chain node and a threshold server. -1. This new validator registers with the chain, and the chain then assigns it to a _signing subgroup_. -1. Once a new validator is aware of the subgroup it has joined, it requests the current validators in that group for a copy of the key-shares specific to that subgroup. To make this request, it sends a 'POST' request to 'validator/sync_kvdb' with the database keys of the shares it needs. -1. After the new validator has received all the shares, the node notifies the chain that it has successfully synchronized. +1. This new validator registers with the chain. +1. If the stake is enough and the node gets selected to be a validator, it will act as a relayer and be eligible to be added to the signer set. + ```mermaid sequenceDiagram title Joining The Network participant NV as New_Validator - participant CV as Current_Validator participant C as Chain NV->>NV: Spins up chain instance NV->>NV: Starts threshold server - C->>NV: Places validator in subgroup - NV->>CV: Contacts validator in subgroup asks for keys + C->>NV: Places NV in validator set CV->>NV: Validates validator's subgroup then encrypts and sends keys - NV->>C: Once all keys are received informs chain it has synced ``` ## Required information diff --git a/content/concepts/key-reshare.md b/content/concepts/key-reshare.md new file mode 100644 index 00000000..97cb1c39 --- /dev/null +++ b/content/concepts/key-reshare.md @@ -0,0 +1,16 @@ +--- +title: "Key Reshare" +lead: "This page covers the process where key shares held by signing validators in our network periodically subsitute signers in and out and swap keyshares" +--- + +The idea here is that when validators join the network they may be selected to the signing comittee. A smaller randomly selected group of validators that is responsible for holding the parent network key. Every session, which consists of 2400 blocks (equivalent to 4 hours), the chain will notify the TSSs (Threshold Signature Servers) that a reshare is taking place. The chain will also reandomly select a validator to join the netowrk and remove the oldest signer from the comittee. + +The selected TSSs will connect to each other and execute the key reshare protocol on the parent network key, generating a new set of key shares. This protocol is similar to the distributed key generation protocol used during jump starting the network. Upon receiving a new key share, the recipients will hold the new key share in a secondary slot and rotate them to the current parent network key when everyone in the signing group has agreed that the rotation was succeful. All previous key shares will be incompatible with the refreshed key shares. However, the public validating key of the parent network key signing keypair never changes. This means all child keys will also remain the same. + +```mermaid +sequenceDiagram + Entropy Chain->>+Validator TSS: Tells selected validator to do Reshare (with new signer to add and old to remove). + Validator TSS->>+Validator TSS: Does Reshare with other selected validators stores new share in holding slot. + Validator TSS->>+Entropy Chain: Tells chain everything was A-OK + Entropy Chain->>+Validator TSS: When everyone is done tells all signers to rotate their holding key to the new parent key. +``` diff --git a/content/concepts/proactive-refresh.md b/content/concepts/proactive-refresh.md deleted file mode 100644 index 5a39b417..00000000 --- a/content/concepts/proactive-refresh.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Proactive refresh" -lead: "This page covers the process where key shares held by validators in a network are periodically updated to maintain the security of the network." ---- - -The idea here is that when validators join or leave the network, their key shares should become invalid. Every session, which consists of 2400 blocks (equivalent to 4 hours), the chain will notify the TSS (Threshold Signature Scheme) servers that a proactive refresh is taking place. The network's registered keys will be divided in parts to avoid refreshing the entire network and putting unnecessary strain on the validators. One TSS server from each sub-group is chosen based on a deterministic process involving the current block number modulo the number of TSS servers in that subgroup, similar to the selection process for DKG (Distributed Key Generation) during registration. - -The selected TSS servers (one from each subgroup) will connect to each other and execute the proactive refresh protocol, generating a new set of key shares. This protocol is similar to the distributed key generation protocol used during registration. The selected TSS servers will send the new key shares to the other members of their subgroup. Upon receiving a new key share, the recipients will replace their existing key share in their key-value store with the new one. All previous key shares will be incompatible with the refreshed key shares. However, the public validating key of the distributed signing keypair never changes. The private access mode will have an individual trigger initiated by the user, although this feature has not been implemented yet. - -```mermaid -sequenceDiagram - Entropy Chain->>+Validator TSS: Tells selected validator to do Proactive Refresh (one validator in each subgroup). - Validator TSS->>+Validator TSS: Get partition of registered keys. - Validator TSS->>+Validator TSS: Does Proactive Refresh with other selected validators. - Validator TSS->>+Validator TSS: Sends new key share to rest of members of subgroup and store it. -``` diff --git a/content/concepts/registering.md b/content/concepts/registering.md index 610f6037..de9cdaa3 100644 --- a/content/concepts/registering.md +++ b/content/concepts/registering.md @@ -12,46 +12,11 @@ sequenceDiagram actor User participant Chain - participant Validator Alice - participant Validator Bob - participant Validator Charlie - participant Validator David - - box Subgroup 1 - participant Validator Alice - participant Validator Bob - end - - box Subgroup 2 - participant Validator Charlie - participant Validator David - end - - User ->> Chain: Informs chain of registration. - - Note over Chain: Selects validators for distributed-key-generation (DKG). - Chain ->> Validator Alice: Sends user information. - Chain ->> Validator Charlie: Sends user information. - - Note over Validator Alice, Validator Bob: Perform DKG. - Note over Validator Charlie, Validator David: Perform DKG. - Validator Alice ->> Validator Bob: Sends key-share to rest of subgroup. - Validator Charlie ->> Validator David: Sends key-share to rest of subgroup. - - Validator Alice ->> Chain: Confirms user is registered. - Validator Charlie ->> Chain: Confirms user is registered. - Note over Chain: User now in a registered state. + User ->> Chain: Informs chain of registration. And selects programs and configs associated with account + Chain ->> User: Selects user's derivation path and returns verifying key associated with that user ``` -1. The user registers with the Entropy chain by submitting a transaction from the 'signature request account' containing the 'Account Key', and initial 'ProgramsData'. +1. The user registers with the Entropy chain by submitting a transaction from any account containing the 'Account Key', and initial 'ProgramsData'. * ```ProgramsData``` - Is multiple Programs Instances. Which contain the ```program_pointer``` (the hash of the program you want to use) and the ```program_config``` for that program. On the evaluation of a signature request a threshold server will run all the programs and pass through the program config for that program. -1. The chain selects which nodes should perform a [distributed key generation (DKG)](https://docs.rs/synedrion/latest/synedrion/sessions/fn.make_key_gen_session.html) based on the current block number. -1. As each block is finalized, an off-chain worker makes an HTTP POST request to each selected threshold server with the signature request accounts of all users who have registered, as well as details of the other validator nodes in the signing subgroup. Specifically, the `/user/new` ([src](https://github.com/entropyxyz/entropy-core/blob/master/crypto/server/src/user/api.rs) [API](https://docs.rs/entropy-tss/latest/entropy_tss/#usernew---post)) endpoint is called with a [`OcwMessageDkg`](https://docs.rs/entropy-shared/latest/entropy_shared/types/struct.OcwMessageDkg.html). -1. All selected threshold servers: - 1. Connect to each other over websocket and make a [noise handshake](https://noiseprotocol.org/noise.html) to establish an encrypted channel for protocol messages. - 1. Perform a [DKG](https://docs.rs/synedrion/latest/synedrion/sessions/fn.make_key_gen_session.html) and store their [key-share](https://docs.rs/synedrion/latest/synedrion/struct.KeyShare.html) in their [encrypted key-value store](https://docs.rs/entropy-kvdb). - 1. Send the generated share to other members of their signing subgroup by POSTing to `/user/receive_key` ([src](https://github.com/entropyxyz/entropy-core/blob/master/crates/threshold-signature-server/src/user/api.rs) [API](https://docs.rs/entropy-tss/latest/entropy_tss/#for-other-instances-of-the-threshold-server)). - 1. They submit a transaction to the entropy chain to confirm the user has successfully registered. -1. On receiving a key-share via `receive_key`, the threshold server will check with the chain that the sender is in the correct subgroup, and if so store the key-share in their key-value store. -1. On receiving a confirmation transaction from all selected threshold server, the chain sets the user to a 'registered' state, making it possible to sign messages. +1. The chain selects a derivation path based on a running count and stores said user information in a mapping with the veryfying key for that user as the key in the mapping. The veryfying key will be the account that the edcsa signatures resolve to. diff --git a/content/concepts/signing.md b/content/concepts/signing.md index f9c85482..3c820875 100644 --- a/content/concepts/signing.md +++ b/content/concepts/signing.md @@ -8,35 +8,30 @@ lead: "Getting a signature from the network is the main purpose of Entropy. Once ```mermaid sequenceDiagram Alice->>Alice: Creates transaction. - Alice->>Validator Bob: Sends transaction through private means. - Alice->>Validator Charlie: Sends transaction through private means. - Validator Bob->> Validator Bob: Determines whether they are a member of the signing committee. - Validator Charlie->> Validator Charlie: Determines whether they are a member of the signing committee. - Validator Bob->> Signing Committee: Requires constraints pass and the transaction matches the hash to sign. - Validator Charlie->> Signing Committee: Requires constraints pass and the transaction matches the hash to sign. - Signing Committee->> Signing Committee: Generates signature. - Signing Committee->> Alice: Sends completed signature. + Alice->>Relayer Validator: Sends transaction through private means. + Relayer Validator->>Signing Validator Bob: Sends transaction through private means (requires constraint pass). + Relayer Validator->>Signing Validator Charlie: Sends transaction through private means. + Signing Validator Bob->> Signing Committee: Requires constraints pass + Signing Validator Charlie->> Signing Committee: Requires constraints pass + Signing Committee->> Signing Committee: Derives user's key based on their derivation path, Generates signature. + Signing Committee->> Relayer Validator: Sends completed signature. + Relayer Validator->> Alice: Sends completed signature. ``` -1. The user computes the hash of the message they wish to sign and selects a signing committee by deterministically selecting a member of each signing group based on this hash. They can get the details of the signing groups as they were published on-chain when the user [registered]({{< relref "./registering" >}}). -1. The user contacts all threshold servers in the signing committee and makes a POST to `/user/sign_tx` with the message to be signed (encrypted for that node). -1. On receiving a message, each node checks that it is a member of the signing committee for that message using the hash. -1. The Threshold server retrieves the latest version of the associated program from the entropy chain, and executes it with the message to be signed as input. Only on getting successful program output do they continue to the next step. +1. The user computes the message they wish to sign and selects a Relayer node to send their message to `/user/relay_tx`. A relayer node is a validator that is not a signer +1. The relayer nodes does some checks, then randomly selects T of the signing commitee to pass the message to. +1. The Relayer contacts all threshold servers in the signing committee and makes a POST to `/user/sign_tx` with the message to be signed (encrypted for that node). +1. On receiving a message, each node checks that it is a member of the signing committee and is being contactacted by a validator. +1. The Threshold server retrieves the latest version of the associated program from the entropy chain, and executes it with the message to be signed as input. Only on getting successful program output do they continue to the next step (this is also done by the relayer before relaying a message). 1. The Threshold server sets up websocket connections to or from the rest of the committee to use for threshold signing protocol messages. They decide whether to make an outgoing connection, or accept an incoming one by comparing account IDs. These connections are secured using the [noise protocol](https://noiseprotocol.org/noise.html). Signing protocol messages can be either 'broadcast' to all of the committee or 'p2p' to a specific member. 1. Once all members of the signing committee have subscribed, nodes participate in the signing protocol to produce a signature using the key-shares retrieved from their key-value store. 1. If the signing process fails, nodes broadcast who the malicious/faulty signer was, which is included in the next block. Following that, the next block contains details of a new signing committee. The misbehaving signer will be 'slashed' (not yet implemented). -1. If the process is successful, the signature is returned to the user. Currently, this requires the user to repeatedly poll POST `signer/signature` with the signature hash until it successfully retrieves a signature. +1. If the process is successful, the signature is returned to the relayer then the user. -The signing process can only take place when a user is already registered on Entropy. The process involves the user and a committee of validators collectively performing the signing. The committee requires one Validator from each signing group as well as the user. The current version of the program will be executed here to determine whether or not to proceed with the signing protocol. +The signing process can only take place when a user is already registered on Entropy. The process involves the user and a committee of validators collectively performing the signing. The current version of the program will be executed here to determine whether or not to proceed with the signing protocol. For details on how signatures are actually created, see [Threshold Signature Scheme]({{< relref "./threshold-signature-scheme.md" >}}). -## Signing Group Selection - -Signing groups are chosen and held on-chain. Every time a new validator joins or gets removed, the chain will place or remove them from a subgroup such that: - - Subgroups do not shuffle current validators. - - Subgroups remain the same size or off by one. - ## Messages Currently the only restrictions for a message is that it's content is less than `1 MB` in size.