KIP 113: BLS public key registry Source

AuthorIan, Ollie, Joseph, and Aidan
Discussions-Tohttps://github.com/klaytn/kips/issues/113
StatusDraft
TypeStandards Track
CategoryCore
Created2023-05-22

Simple Summary

A design of simple BLS12-381 registry.

Abstract

This standard defines an interface for BLS12-381 registry, which enables nodes or smart contracts to access and view all the public keys of the associated addresses.

Motivation

A standard interface allows developers to associate an address with a BLS public key. The objective is to design a simple registry interface, enabling Klaytn nodes to read BLS keys, each of which is associated with a node ID.

Specification

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

Registry contract must implement the IKIP113 interface:

pragma solidity ^0.8.19;

/// @title KIP-113 BLS public key registry
/// @dev See https://github.com/klaytn/kips/issues/113
interface IKIP113 {
    struct BlsPublicKeyInfo {
        /// @dev compressed BLS12-381 public key (48 bytes)
        bytes publicKey;
        /// @dev proof-of-possession (96 bytes)
        ///  must be a result of PopProve algorithm as per
        ///  draft-irtf-cfrg-bls-signature-05 section 3.3.3.
        ///  with ciphersuite "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_"
        bytes pop;
    }

    /// @dev Returns all the stored addresses, public keys, and proof-of-possessions at once.
    ///  _Note_ The function is not able to verify the validity of the public key and the proof-of-possession due to the lack of [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537). See [validation](https://kips.klaytn.foundation/KIPs/kip-113#validation) for off-chain validation.
    function getAllBlsInfo() external view returns (address[] memory nodeIdList, BlsPublicKeyInfo[] memory pubkeyList);
}

Definitions

The terms public key and proof-of-possession (hereinafter referred to as pop) are from the ciphersuite BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_. Things to note:

  • Public key: 48 bytes.
  • Proof-of-possession (pop): 96 bytes.

Smart Contracts Overview

The proposed smart contract must be implemented in Solidity and must be compatible with the Ethereum Virtual Machine (EVM).

The smart contract must have the following features:

  • View the registered public keys

Methods

getAllBlsInfo

Returns all the stored addresses, public keys, and proof-of-possessions at once.

Note The contract is not able to verify the validity of the public key and the proof-of-possession due to the lack of EIP-2537. See validation for off-chain validation.

function getAllBlsInfo() external view returns (address[] nodeIdList, BlsPublicKeyInfo[] pubkeyList)

Validation

After reading from IKIP113, users must perform the following validations:

JSON-RPC API

The following JSON-RPC method for the Klaytn node should be added to provide the registered BLS public keys.

  • Name: klay_getBlsInfos
  • Description: Returns all registered BLS public keys and proof-of-possessions of the validators.
  • Parameters:
    • number - (optional) integer or hexadecimal block number, or the string “pending” or “latest”.
  • Returns: A map of the addresses and their associated BLS public keys, proof-of-possessions and verify error.
    • publicKey - The compressed BLS12-381 public key in hex string.
    • pop - The proof-of-possession in hex string.
    • verifyErr - The error message of the verification. If the verification is successful, it returns null.
  • Example
      // Request
      curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"klay_getBlsInfos", "params":["latest"],"id":1}' http://localhost:8551
      // Response
      {
          "jsonrpc":"2.0",
          "id":1,
          "result":{
              "0x18a80d0d3a8b7348277c497105cc2163b242799a":{
                  "publicKey":"8247754efd7aa2b02b30b6db8e1c24bb8c4207f5600470c2dafde1b46270a6c8c3fe9e7f8b939965d6a59dbe2ebd0cf7",
                  "pop":"8c35987399eab7a98ad24e869a7d7225bdb95203167e6aa20b3db73c0a91317e805e48d33c606484b1e9db3d8c8d64b60f0c6a8816b219f43747bf201dd65193ade23434270c78441e370a95d7632a6a76f1f3a62842425f76ebc4a041fc1dbb",
                  "verifyErr":null
              },
              "0x527d6d61f53305c1e1d3680b23393c3c13c8db9e":{
                  "publicKey":"a16153b81453a9e3099728ff1d3aac3d3fca32b3594407277ec0b8df4aa66cba743916d9f2098707aecc350954b0cd4e",
                  "pop":"a92c7ba586a12a38e3a7bbfed7f7a311664cb0dc66a7bd26ee79bed4755e7652850dff1cfabf39acd58ea8efe24ff7c217f1d5c2ac3fe948016056e99b03bc26aa8c59b89cfc9ee961bf8cfd1802295d4ff07852f93d0607a53655f15665aad9",
                  "verifyErr":null
              },
              "0xa72ccdf72dc401df79805013a42b74f12b43caa1":{
                  "publicKey":"883eb2c623a19671461bc0dadcfa17384198ff06b2e2c9cd1ca539ff554c377256624e9f5f69d27e17e4635080938d9a",
                  "pop":"ac1bb19588b2ec7e1452486b8a4afe0ecb27847bca04b7e4919a9d6b70c1342dcfb1a6983788d3756607b84d3d7a009118246ed5b3b3449638e591ab9fe2c4ec5cafb64ddc12a5dcf48cbcf305175d5dddb48845e80f7cb9a32d5f2e67ca2163",
                  "verifyErr":null
              }
          }
      }
    

    Backwards Compatibility

This does not affect the backward compatibility as this is a newly deployed contract.

Copyright and related rights waived via CC0.