Threshold Schnorr - Facilitating BRC-20 trading, Solana integration, certificate signing, and more

Tl:dr: We would like to integrate a new threshold-Schnorr protocol in ICP. This would allow:

  • Canisters to obtain their own Schnorr public keys/addresses
  • Canisters to request ICP to compute Schnorr signatures on arbitrary messages
  • Support both for BIP-340 and Ed25519

Summary

Schnorr-like digital signatures are popular in blockchains as they are simple in design, efficient, and allow for easier aggregate signatures, multi-signatures and threshold signatures. Enabling the support for threshold variants of Schnorr-like schemes on the IC can unlock canisters to host a broader range of crypto assets and opens up the possibility of direct integration with multiple chains. The most popular variants of Schnorr signatures in the crypto space are:

  • BIP340: this is the Schnorr variant used in Bitcoin, and also used in ordinals like BRC-20.
  • Ed25519: used in other chains like Solana, Cardano, Ripple, Polkadot, and others. This is also one of the most popular signature schemes outside of the blockchain space.

Working on this feature, we aim to capture the core implementation of threshold Schnorr-BIP340 and Ed25519 variants, as well as their integration on the Internet Computer. As a result of this, canisters would have public keys for the new signatures schemes, enabling them to derive addresses on other chains, and authorize transactions on those chains.

Status

Work has started

People Involved

@ais, @andrea, @domwoe, @eichhorl, @franzstefan, @JackLloyd

Timelines

  • One pager on forum (now)
  • t-ECDSA latency improvements (expected: early April)
  • t-ECDSA throughput improvement (expected: mid April)
  • First community conversation (expected: mid-late April)
  • Beta Implementation (people can already play with Dominic’s Schnorr canister)
  • Bounty Program
  • Second community conversation with test key demos (expected: June)
  • NNS Proposal
  • Integration
  • Launch (expected: Summer)

Description

Introducing t-Schnorr furthers ICP’s goal of decentralizing the web and decentralizing crypto. The first major block of work in this direction saw the t-ECDSA implementation integrated to ICP. This coupled with the native bitcoin integration, and the ethereum RPC canister allowed ICP canisters to read and write to Bitcoin and Ethereum. Integrating threshold Schnorr will allow further integrations (eg. with Solana and Cardano) and other cryptographic capabilities. The design principles used for t-ECDSA will largely be reused for t-Schnorr with two modifications:

  • Instead of taking a curve as input, the Schnorr variant is passed in as a parameter. Having variants requires that we also do a key derivation for the corresponding scheme.
  • Instead of creating a signature on the hash of the message (as in ECDSA), the signature is created on the message itself.

Furthermore, there are some improvements being made to t-ECDSA that will also be leveraged by the new schnorr implementation. These improvements are around throughput and latency and will be rolled out in the coming weeks.

High level objective

There are two main parts to getting t-Schnorr on ICP. First we need to implement the threshold cryptography, and then we need to do the system integration.

​​Part 1: Implement the threshold protocols:

  • Distributed Key Generation
    • The IDKG protocol implemented for t-ECDSA will largely be reused for t-Schnorr
  • Key Derivation
    • Will need to do a new KD for Ed25519, but can reuse the BIP32 KD implemented for t-ECDSA
  • Signature generation
    • New implementation

Part 2: Do the system integration:

  • Threshold keys are generated and backed up in subnets
  • Canisters can request signatures and public keys

Proposed API

The proposed API will likely look as follows:

type schnorr_algorithm = variant { bip340secp256k1; ed25519};

schnorr_public_key : (record {
    canister_id : opt canister_id;
    derivation_path : vec blob;
    key_id : record { algorithm: schnorr_algorithm; name: text };
}) -> (record { public_key : blob; chain_code : blob; });

sign_with_schnorr : (record {
    message : blob;
    derivation_path : vec blob;
    key_id : record { algorithm: schnorr_algorithm; name: text };
}) -> (record { signature : blob });

Potential Applications

Threshold Schnorr would unlock several potential multichain features/initiatives:

  • Support Bitcoin taproot tx on the IC:
    • Bitcoin inscriptions
    • Bitcoin fungible tokens like BRC-20
  • Holding of new set of crypto assets in Canisters: BRC-20, SOL, ADA, XRP, …
    • Massively relevant for the chain abstraction narrative and to enhance multichain wallets
  • Creation of more “twin” ck-tokens on the IC: ckBRC20, ckSOL,…
  • Direct integrations with other chains

Threshold Schnorr also has better efficiency than tECDSA:

  • Higher signature throughput.
  • Future iterations could leverage Schnorr-specific techniques to boost efficiency

Threshold Schorr is also widely used more broadly on the Internet:

  • Canisters could sign x.509 certificates and act like a decentralized Certificate Authority
  • GPG signing for software distribution would canisters to form the basis of decentralized repositories

Resources

Next Steps

We’d love to hear from you if you would like to use this or have built examples already, if you think there are interesting projects we should talk to, if there’s anything in particular you’d like us to cover in the community conversation, or any other questions or comments.

Super looking forward to this!

42 Likes

SLIP-0010 is a key derivation standard for Ed25519:

Many projects are using it, such as SUI:

, and our NS-Protocol:

According to the definition of BIP32, the derivation_path is actually an vec nat32.

Got it.

SLIP-0010 is already used in the IC in some places. For example, II may be using it to derive recovery keys. It is also used internally for P-256 key derivation.

However, when it comes to Ed25519, SLIP-0010 only specifies hardened key derivation. This means that you must know the secret key even to derive new public keys. In the threshold setting this is an issue as no single party ever knows the full secret key. It is technically possible to use generic MPC protocols to securely compute the evaluation of an hash on shares of a common input. However this is computationally really expensive, and it does not bring any advantage in practice. For example, it is not possible to publicly verify that an hardened key is derived from another, so a user cannot even tell if key derivation was used or whether the new key was generated at random.

4 Likes

How about limitations? For example ingress message size and data chunking?

1 Like

The x.509 signing is very interesting to me, for years it’s been a dream to have ICP be used as a decentralized certificate authority and to possibly build a decentralized DNS (maybe orthogonal project?).

7 Likes

Since Schnorr signatures require providing the entire message rather than just a hash of it, the size of messages that can be signed is bounded by the cross net canister call message limit of 2 MB. The exact limit on the message size will be somewhat less than this, since the xnet call must contain everything else about the signature request (such as the derivation path, key ID, caller information, etc).

2 Likes

Hello everyone, quick update on the status of the threshold Schnorr. The feature is code complete, and with the recent updates to the Replica and Registry we can consider it beta-released.

In this initial phase we propose generating a test key for the algorithm Schnorr-BIP340 on the application subnet 2fq7c, which also holds the ECDSA test key. This will unlock further testing and help us build confidence around operational tasks, such as key back-up and recovery. Once this phase is complete, we can propose a production key on the fiduciary subnet and officially release it as part of the Deuterium milestone, see roadmap.

The proposal for the generation of the test key is now up for voting. If this is approved, then another proposal can be submitted to enable signing on the subnet. Please use this key for testing purposes only and do not store any value on it. Keep in mind that we are still performing security reviews and that initially the key will not be backed up on other subnets, and therefore there is a higher risk of losing it.

14 Likes

Any chance that this leads to an overload on the subnet? Or is this a nice place to do a small stress-test with two separate keys being in use at the same time?

2 Likes

Any chance that this leads to an overload on the subnet?

Hopefully not :slight_smile: This is the subnet hosting the ECDSA key, so that’s the best place to test a configuration similar to what we will have in fiduciary subnet later on.

In terms of load, the expensive part of both the ECDSA and Schnorr protocols is related to running the IDKG sub-protocol to compute presignatures. The number of IDKG protocol instances a subnet runs in parallel is effectively bound by the configuration stored in the registry, and can therefore be adjusted. Currently the subnet can precompute up to 7 ECDSA presignatures, each of which requires 4 IDKG instances. Schnorr presignatures only require a single IDKG instance each, so by allowing up to 7 Schnorr presignatures we would increase the total number of IDKG instances that could run in parallel from 28 to 35.

Note also that as part of this effort we optimized the computation of ECDSA presignatures, which until few months ago required 5 IDKG instance each. So while we could observe an increase of the computational overhead on the subnet related to enabling Schnorr, the maximum overhead should still be comparable to what used to be until few months back.

7 Likes

What’s the latest? Live on a subnet for beta testing?

Also how related is the EdDSA work? In terms of effort?

3 Likes

Hey, yes! The test key is out and ready to play. Some links to get started

If you are planning to use threshold Schnorr in your project, or if you find anything interesting while playing around, let us know!

4 Likes

The IC-COSE project plans to use tSchnorr as the main signature algorithm.

Just deployed the first version to the mainnet:

It is found that the mainnet has not yet supported ed25519. And bip340secp256k1 needs to wait for k256@0.14.0 to be able to verify the signature.

2 Likes

I note there is a new proposal (131449) to disable the test keys on subnet 2fq7c and a set of proposals (131433, 131437, 131438, 131450) to reshare the Ed25519 test key and enable signing with test keys on subnet fuqsr. Are you able to give some further details on the background to these proposals?

4 Likes

My interpretation of this is that…

  • 2fq7c is the signing test key subnet
  • fuqsr is the backup test key subnet
  • 2fq7c generated a new key under 131391, and had it enabled for signing under 131392
  • Sharing the new key with the backup subnet came next using a catchup package (131433, 131437, 131438), which exercises the mechanism I expect would be employed if the backup was ever needed (disaster recovery)
  • The last two proposals (131449, 131450) switch the subnet roles so that the backup subnet (fuqsr) becomes the signing subnet. I expect this is to test the fidelity of the backup

This is my interpretation though, which could be wrong. I think these proposals could really do with elaborating the situation a little more in the summary (to explain the why and not just the what). @andrea, is there any chance of this? Would it also be possible to provide a notice of these sorts of proposals on a dedicated topic for each subnet in the future e.g. Subnet Management - 2fq7c (Application) - Developers - Internet Computer Developer Forum (dfinity.org) (similarly to how IC-OS proposals are announced)?

2 Likes

Are you able to give some further details on the background to these proposals?

I think these proposals could really do with elaborating the situation a little more in the summary

Hello both! Thanks for raising this, we will try to improve these proposal descriptions moving forward.

@Lorimer is correct in his assessment above. Here some additional context to these type of proposals:

Key generation
Key generation in a subnet happens with a single proposal, like 131391. When this proposal is executed, the registry canister adds the new key ID in the subnet record. Once the node see the new record, they engage in the key generation protocol.

Key Resharing
Key resharing between subnets is a bit more involved as the key material is delivered via catchup packages (CUP). Currently the only way to deliver a CUP to a subnet is by using the recovery proposal, which involves 3 steps:

  • The subnet receiving the key is halted at a CUP height, like in 131433. This means that the subnet will continue until the next CUP is created and then it will stop.
  • In the second step the registry is updated with a recovery CUP. If the proposal contains key IDs, like 131437, the registry will request the specified subnet to reshare the keys, and these shares are then included in the CUP. If the height of the CUP is larger than the height of the local CUP, then the nodes of the subnet will fetch it from the registry and store it locally.
  • The subnet is then restarted, like in proposal 131438. The nodes will restart from the CUP with larger height. Once the subnet is operational again, the nodes will complete the key resharing protocol initiated by the other subnet and obtain a share of the key.

Regarding the current proposals (131449, 131450), the idea is to enable signing on the backup subnet to test that things work correctly there as well. This is the last test we planned, after which we could propose to generate (and backup) the production key. As a side note, switching subnets for the test key seems also a good idea in general because subnet 2fq7c is has a lot of canisters and thus may be better to offload the signing to subnet fuqsr for the foreseeable future.

Would it also be possible to provide a notice of these sorts of proposals on a dedicated topic for each subnet in the future e.g. Subnet Management - 2fq7c (Application) - Developers - Internet Computer Developer Forum (dfinity.org)

I was not aware of these threads, but it sounds like a good idea in general.

3 Likes

Thanks @andrea and @Lorimer. The explanations are much appreciated and certainly give a clearer context to the proposals. :slight_smile:

2 Likes

Quick update:

With proposal 132383 also the Ed25519:key_1 (aka “production” key) was enabled for signing. This means that both BIP340 and Ed25519 threshold signatures are now live and operational, and that the Schnorr feature is now complete.

13 Likes

thanks,we can sign taproot transactions