Threshold Encryption
Decentralized Key Generation (DKG)
The DKG mechanism in Neo X enables a fully decentralized key generation process among consensus members. Before each epoch change, the upcoming consensus group must successfully complete a DKG round to establish a new threshold public-private key pair. This process ensures that no single participant controls the decryption or signing capabilities.
DKG Process
Each DKG round consists of three key steps:
Share – The next consensus group generates n distributed secret shares and a global public key, where n is the number of Neo X consensus nodes.
Reshare – The current consensus group (if available) transfers the previous round’s secret to the next group.
Recover (Optional) – If up to f secret shares are lost, the remaining 2f+1 shares reconstruct the secret to complete the transition.
Starting from v0.3.0, the DKG module automates the entire process, except for setting up the initial Anti-MEV keystore with a secret passphrase.
Share Phase
Each participant executes the following steps:
Take a random polynomial f(x)=a0+a1x+a2x2+⋯+at−1xt−1 as their local secret, where t=2f+1 (the threshold for consensus).
Compute f1,f2,...,fn where fi=f(i) and share them with corresponding participants, where i is the index of different participants of
Share.Accept all fi from other participants as f1(i),f2(i),...,fn(i), where i is the index of receiver, and compute si=∑fi to get the final secret key.
Generating the Global Public Key
The global public key is generated using Publicly Verifiable Secret Sharing (PVSS):
Each participant uploads F(x)=f(x)G1 within his PVSS to the KeyManagement contract.
The contract verifies each PVSS and computes S=∑i=1nFi(0) as the global public key.
A well-constructed PVSS includes:
F(x)=f(x)G1 as the sender’s local secret commitment.
rG1,rG2 as a pair of commitments for a random scalar r.
F=(F(1),F(2),...,F(n)) as the commitment share messages.
The KeyManagement contract validates F(1),F(2),...,F(n), and verifies scalar r. Recipients validate their received shares using e(r1f(i),g2)=e(F(i),r2).
Future Enhancement: Zero-Knowledge Proofs (ZKPs) will be integrated to enhance encryption verification.
Reshare Phase
Each participant executes the following steps:
Regenerate his local secret f′(x)=a0+a1′x+a2′x2+⋯+at−1′xt−1 while preserving the constant term a0.
Follow the step 2 and 3 in the Share phase, but send the shares to the next consensus group.
The KeyManagement contract ensures F(0)=F′(0), preserving the global public key unchanged and preventing leakage of the original secret shares.
Recover Phase (Optional)
If some secret shares are lost, the remaining consensus members help restore them:
The current consensus group forwards all received shares fi from the lost index i to its successor.
The recipient reconstructs the original local secrets using Lagrange interpolation.
Security Note:
Recoverexposes at most f of the original secrets, so it is only allowed when the index i is confirmed absent fromReshare.
Threshold Public Key Encryption (TPKE)
Neo X's DKG enables a Threshold Public Key Encryption (TPKE) scheme, ensuring that encrypted transactions can only be decrypted if at least 2f+1 consensus nodes cooperate. This mechanism is crucial for preventing premature exposure of transaction details.
Neo X TPKE utilizes the BLS12-381 curve, encoding any secret to G1 for encryption and any message to G2 for signature generation.
Encryption
For a given secret message msg, the encryption process follows these steps:
A random point G1 point P is chosen as a seed to generate an AES key. The encrypted ciphertext is computed as C1=AES(Hash(P),msg).
To ensure security, a random scalar r is selected to encrypt P as C2=P+rS
where:
r is a random scalar,
S is the global public key.
The final encrypted message C, which is broadcasted across the network, consists of C=(C1,C2).
Decryption
To recover the original msg, the Neo X consensus network must decrypt C1 to recover P. The decryption process follows:
Each CN computes and shares siR, where:
R is the commitment of the random scalar r,
si is the local secret key.
Since validator indices (DKG indices) are publicly known within Neo X Governance, these shares can be aggregated and solved using a Vandermonde matrix.
Once the seed P is recovered, the original message msg can be decrypted using AES.
Signature
For a given message msg, Neo X generates a signature through the following process:
The message is encoded to G2 as Q=HashToG2(msg)
A signature share is computed as siH where si is the local secret key.
After collecting enough broadcasted shares, CNs aggregate and get the final signature with Vandermonde matrix in the same way as TPKE decryption.
Last updated