The keyshare module is responsible for collecting all the keyshares from validators and aggregating it to one derived private key every block.

State

The x/keyshare module keeps state of the following primary objects:
  1. Validator information
  2. Submitted keyshares
  3. Aggregated keyshares
  4. Active & queued public key
  5. Authorized address
  6. Submit general keyshares
  7. Submit encrypted keyshares
  8. Keyshares encrypted with the validator’s public key

Params

proto/fairyring/keyshare/params.proto

Messages

MsgRegisterValidator

Register as a validator in the x/keyshare module validator set. proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Creator address staked token is less than minimum requirement
  • Creator address already registered as a validator in x/keyshare module

MsgDeRegisterValidator

Deregisters a validator from the x/keyshare module validator set. proto/fairyring/keyshare/tx.proto
The message will fail under the following condition:
  • Creator address is not a registered validator in the keyshare module

MsgSendKeyshare

Submit keyshare for target height proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Sender is not a registered validator in the validator set
  • Sender is not an authorized address
  • Block height does not equal the current block height
  • Keyshare index is incorrect
  • Keyshare is incorrect

MsgCreateLatestPubkey

Create master public key used for encrypting transactions. proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Sender is not a trusted address
  • A queued public key already exists
  • Commitments array is empty
  • encrypted keyshare array is empty
  • numberOfValidators is 0

MsgOverrideLatestPubkey

Override the latest master public key used for encrypting transactions. proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Sender is not a trusted address
  • A queued public key already exists
  • Commitments array is empty
  • encrypted keyshare array is empty
  • numberOfValidators is 0

MsgCreateAuthorizedAddress

Authorize the target address to submit keyshares for the sender address. proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Target address is invalid
  • Creator is not a validator in the x/keyshare validator set
  • Target address is already authorized
  • Target address is the same as sender address
  • Creator already authorized another address

MsgUpdateAuthorizedAddress

Update the status of the target authorized address proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Target is not authorized
  • Target is not authorized by the sender
  • Target address is the same as sender address

MsgDeleteAuthorizedAddress

Delete authorized address proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Target is not authorized
  • Sender is not the creator of the target authorized address and the authorized address itself

MsgSubmitGeneralKeyshare

Submit general keyshare proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Sender is not a validator in the validator set
  • Sender is not an authorized address
  • Keyshare is incorrect
  • ID type is not supported
  • Decryption Key Request (ID Value) not found

MsgSubmitEncryptedKeyshare

Submit encrypted keyshare proto/fairyring/keyshare/tx.proto
The message will fail under the following conditions:
  • Sender is not a validator in the validator set
  • Sender is not an authorized address
  • Encrypted keyshare is incorrect
  • Private Decryption Key Request (Identity) not found

Events

The keyshare module emits the following events:

Message Events

MsgRegisterValidator

MsgDeRegisterValidator

MsgSendKeyshare

When a valid keyshare is received: When enough keyshares are received & the derived private key is aggregated:

MsgCreateGeneralKeyshare

When a valid general keyshare is received: When enough keyshares are received & the derived private key is being aggregated:

MsgSubmitEncryptedKeyshare

When a valid encrypted keyshare is received:

MsgCreateLatestPubkey

MsgOverrideLatestPubkey

Client

CLI

User can query and interact with the keyshare module using the CLI.

Queries

The query commands allows users to query keyshare state. fairyringd query keyshare --help
list-decryption-keys
The list-decryption-keys command allows users to query all the decryption keys. fairyringd query keyshare list-decryption-keys [flags] Example: fairyringd query keyshare list-decryption-keys Example Output:
list-authorized-address
The list-authorized-address command allows users to query all the authorized addresses. fairyringd query keyshare list-authorized-address [flags] Example: fairyringd query keyshare list-authorized-address Example Output:
list-keyshares
The list-key-share command allows users to query all the keyshare submitted by validators. fairyringd query keyshare list-keyshares [flags] Example: fairyringd query keyshare list-keyshares Example Output:
list-general-keyshares
The list-general-keyshares command allow users to query all the general keyshare submitted by validators. fairyringd query keyshare list-general-keyshares [flags] Example: fairyringd query keyshare list-general-keyshares Example Output:
list-validator-set
The list-validator-set command allows users to query all the validators in the validator set. fairyringd query keyshare list-validator-set [flags] Example: fairyringd query keyshare list-validator-set Example Output:
params
The params command allows users to query current params of the keyshare module. fairyringd query keyshare params [flags] Example: fairyringd query keyshare params Example Output:
show-active-pub-key
The show-active-pub-key command allows users to query current active & queued public keys and encrypted key shares. fairyringd query keyshare show-active-pub-key [flags] Example: fairyringd query keyshare show-active-pub-key Example Output:
show-decryption-key
The show-decryption-key command allows users to query decryption key of the target height. fairyringd query keyshare show-decryption-key [height] [flags] Example: fairyringd query keyshare show-decryption-key 100000 Example Output:
show-authorized-address
The show-authorized-address command allows users to check if the target address is authorized. fairyringd query keyshare show-authorized-address [target] [flags] Example: fairyringd query keyshare show-authorized-address fairy1... Example Output:
show-commitments
The show-commitments command allows users to query all the active & queued commitments. fairyringd query keyshare show-commitments [flags] Example: fairyringd query keyshare show-commitments Example Output:
show-keyshare
The show-keyshare command allows users to query the keyshare submitted by the target validator on a particular height. fairyringd query show-keyshare [validator] [block-height] [flags] Example: fairyringd query keyshare show-keyshare fairy14qekdkj3mnmveb5ugh0n112a3pud23y8tcf9bb 100000 Example Output:
show-general-keyshare
The show-general-keyshare command allow users to query the target general keyshare submitted by its validator, id type and id value. fairyringd query show-general-keyshare [validator] [id-type] [id-value] [flags] Example: fairyringd query keyshare show-general-keyshare fairy14qekdkj3mnmveb5ugh0n112a3pud23y8tcf9bb private-gov-identity "1/rq" Example Output:
show-validator-set
The show-validator-set command allows users to check if the target address is in validator set. index is the target validator address. fairyringd query show-validator-set [index] [flags] Example: fairyringd query show-validator-set fairy14qekdkj3mnmveb5ugh0n112a3pud23y8tcf9bb Example Output:

Transactions

The tx commands allows users to interact with the keyshare module. fairyringd tx keyshare --help
create-authorized-address
The create-authorized-address command allow validators to authorize another address to submit keyshare for them. fairyringd tx keyshare create-authorized-address [target] [flags] Example: fairyringd tx keyshare create-authorized-address fairy1...
update-authorized-address
The update-authorized-address command allow validators to update the status of the authorized address. fairyringd tx keyshare update-authorized-address [target] [is-authorized] [flags] Example: fairyringd tx keyshare update-authorized-address fairy1... false
delete-authorized-address
The delete-authorized-address command allow validators / the authorized address itself to delete the authorized address. fairyringd tx keyshare delete-authorized-address [target] [flags] Example: fairyringd tx keyshare delete-authorized-address fairy1...
create-latest-pubkey
The create-latest-pubkey command allow trusted addresses to submit public key, commitments and encrypted key shares. fairyringd tx keyshare create-latest-pubkey [public-key] [commitments] [number-of-validators] [encrypted-key-shares] [flags] Example: fairyringd tx keyshare create-latest-pubkey "856ec61e4a6adc43f76262afbe503276e3798b35d7a329548322eac342f819f42466d92b81e7861e341326668f4f9a09" "856ec61e4a6adc43f76262afbe503276e3798b35d7a329548322eac342f819f42466d92b81e7861e341326668f4f9a09,a6f02f598d3b89c524792889b0b115cd229ba60aeb568c228de7db1e8c182fd07bb473fab5258564c26fe5164e287e35" 1 '[{"data": "XaMhXRlQ/wLVzXsQn4K/vwLKACBPV90koTC452UXPjgq1sSakgr33jLBNGFpzc71p7niKwAgfWc5Yd9ZupN3pcz9aC7EBG+Q2/ocxZerPR2rpbkq5NNAAnTY/yN7+xA7HcSm61fBFcv/ZPhthtvA8Qg+QYHfnQI8PouunWpHXjlOtWNY8g5GGFSqFSEkyHtaHOcC9OApPeosvv1o3Mrp+HenxURUqw==", "validator": "fairy18hl5c9xn5dze2g50uaw0l2mr02ew57zkynp0td"}]'
register-validator
The register-validator command allow validators to register as a validator in x/keyshare module validator set. fairyringd tx keyshare register-validator [flags] Example: fairyringd tx keyshare register-validator
deregister-validator
The deregister-validator command allow validators to deregister in x/keyshare module validator set. fairyringd tx keyshare deregister-validator [flags] Example: fairyringd tx keyshare deregister-validator
send-keyshare
The send-keyshare command allow validators to submit their keyshare for specific block height. fairyringd tx keyshare send-keyshare [message] [keyshare-index] [block-height] [flags] Example: fairyringd tx keyshare send-keyshare a7348fb8cf57c1adf655f8d27c79086a5fd356285a6f00c9aea05ea6d2a8da63e08ea27d10d91b83be0778fc652d9c920ed18690f5e776ec3fb57e2504949bbe31deef8648c488263d871f040d5d2781068a3c2f78b057fef57397310367fb7d 1 100000

gRPC

Users can query the keyshare module using gRPC endpoints.

Commitments

The Commitments endpoint allows users to query the active & queued commitments. fairyring.keyshare.Query/Commitments Example: grpcurl -plaintext localhost:9090 fairyring.keyshare.Query/Commitments Example Output:

Params

The Params endpoint allows users to query x/keyshare module params. fairyring.keyshare.Query/Params Example: grpcurl -plaintext localhost:9090 fairyring.keyshare.Query/Params Example Output:

ValidatorSet

The ValidatorSet endpoint allows users to query if the target address is in the validator set. fairyring.keyshare.Query/ValidatorSet Example:
Example Output:

ValidatorSetAll

The ValidatorSetAll endpoint allows users to query all validators in the validator set. fairyring.keyshare.Query/ValidatorSetAll Example: grpcurl -plaintext localhost:9090 fairyring.keyshare.Query/ValidatorSetAll Example Output:

Keyshare

The Keyshare endpoint allows users to query the keyshare submitted by target validator on particular block height. fairyring.keyshare.Query/Keyshare Example:
Example Output:

KeyshareAll

The KeyshareAll endpoint allows users to query all the submitted keyshares. fairyring.keyshare.Query/KeyshareAll Example: grpcurl -plaintext localhost:9090 fairyring.keyshare.Query/KeyshareAll Example Output:

DecryptionKey

The DecryptionKey endpoint allows users to query the decryption key on a particular height. fairyring.keyshare.Query/DecryptionKey Example:
Example Output:

DecryptionKeyAll

The DecryptionKeyAll endpoint allows users to query all decryption keys. fairyring.keyshare.Query/DecryptionKeyAll Example: grpcurl -plaintext localhost:9090 fairyring.keyshare.Query/DecryptionKeyAll Example Output:

Pubkey

The Pubkey endpoint allows users to query active & queued public keys and encrypted key shares. fairyring.keyshare.Query/Pubkey Example: grpcurl -plaintext localhost:9090 fairyring.keyshare.Query/Pubkey Example Output:

AuthorizedAddress

The AuthorizedAddress endpoint allows users to query target authorized address. fairyring.keyshare.Query/AuthorizedAddress Example:
Example Output:

AuthorizedAddressAll

The AuthorizedAddressAll endpoint allows users to query all authorized addresses. fairyring.keyshare.Query/AuthorizedAddressAll Example: grpcurl -plaintext localhost:9090 fairyring.keyshare.Query/AuthorizedAddressAll Example Output: