Multisig ECDSA Challenge

Recover four of the seven keys behind this record

  • Gabriel Antonio Videtta
  • Lorenzo Lami
  • Jules Hamou
  • Filippo Giugie

Seven signers hold one private key each, and a Solidity contract stores 672 signed messages of theirs, called heartbeats. Find four of the seven keys, which is the threshold, and prove to the contract that you know them.

Download the challenge How it works Specification

All the values are in heartbeats.json and, as hexadecimal words, in instance.flat.json.

How the challenge works

Each signer has one private key. Once per epoch, every signer publishes a heartbeat, which shows that the key is still in use. The organiser writes all the heartbeats to the contract and seals them, so that nobody can change them afterwards. From then on anyone can read the record and submit a proof.

How the challenge works Seven signers publish one heartbeat per epoch. The organiser stores the record of 672 heartbeats in the contract and seals it. The participant reads the record, recovers four private keys, builds a threshold proof and calls verifyAndExecute. The contract checks the proof and records the first solver. Organiser Contract Participant Seven signers 96 epochs The sealed record First solver Proof verifier Read the record Recover four keys Build a proof One key each One heartbeat each 672 heartbeats Address stored Accepts or rejects Public data The threshold is 4 For your address publish, then seal read verifyAndExecute
How the challenge works Seven signers publish one heartbeat per epoch. The organiser stores the record of 672 heartbeats in the contract and seals it. The participant reads the record, recovers four private keys, builds a threshold proof and calls verifyAndExecute. The contract checks the proof and records the first solver. Organiser Contract Participant Contract Seven signers 96 epochs The sealed record Read the record Recover four keys Build a proof Proof verifier First solver One private key each One heartbeat each 672 heartbeats Public data The threshold is 4 For your address Accepts or rejects Address stored publish, seal read verifyAndExecute
StageWho actsWhat happens in the contract
OpenOrganiserThe contract is deployed with the seven public keys. Heartbeats are added in batches of 16, with publishHeartbeats
SealedEveryoneAfter sealRecord the record is frozen and proofs are accepted
SolvedParticipantThe first valid call to verifyAndExecute stores the address of the caller as firstSolver

The parts

PartWhat it doesFile
ContractHolds the seven public keys and the record, and decides whether you have wonsrc/MultisigChallenge.sol
RecordThe 672 heartbeats, 96 from each signerdata/heartbeats.json
Proof verifierChecks that you know four of the seven keys. It does not learn the keys, or which four they aresrc/crypto/CDSThreshold.sol
Curve computationScalar multiplication on secp256k1, through ecrecoversrc/crypto/Secp256k1.sol
Deployment scriptDeploys the contract, uploads the record and seals itscript/DeployChallenge.s.sol
Tests23 tests of the contract and the proof, with a prover written in Solidity that you can readtest/

What is in a heartbeat

A heartbeat has two halves. The first is an ECDSA signature on the message hash of the epoch, which is the same for all seven signers.

The second is a liveness point. The signer takes a public base point C and publishes Y = dC, where d is the private key, as in a Diffie-Hellman exchange.

FieldMeaning
epochFrom 0 to 95
msg_hashThe 32 bytes that are signed
v, r, sThe signature, in Ethereum's format
cx, cyThe base point C
yx, yyThe liveness point Y

What it takes to win

You win when the contract accepts your call to verifyAndExecute. The call carries a proof that you know four of the seven private keys, which is the threshold, and a message of your choice.

The contract stores the address of the first caller who succeeds. Others can still submit a proof of their own afterwards.

The instanceValue
Curvesecp256k1
Signers7
Keys needed4
Epochs96
Chain id31337, a local Anvil chain
Contract address0x5FbDB2315678afecb367f032d93F642f64180aa3
Size of a proof11 numbers modulo N

How four keys become one proof

Publishing four private keys would let anyone copy them. The contract asks for a zero-knowledge proof instead, due to Cramer, Damgård and Schoenmakers.

The proof has one challenge per signer, and the seven challenges lie on a polynomial of degree three. Its value at 0 comes from a hash that the prover cannot control. Three more values are free. That fixes the polynomial, so the other four challenges have to be taken as they come, and each can be answered only with that signer's key.

The hash covers the address of the caller, the chain, the contract and a counter. A proof copied by somebody else fails, and an accepted proof cannot be sent twice. The specification has the full protocol.

The challenge polynomial A cubic curve through the abscissas 0 to 7. The value at 0 is fixed by a hash. The prover chooses three of the other seven values. The four that remain are forced. X = 0 1 2 3 4 5 6 7 signer i sits at X = i + 1 fixed by the hash chosen by the prover (3) forced, needs the key (4)
The challenge polynomial A cubic curve through the abscissas 0 to 7. The value at 0 is fixed by a hash. The prover chooses three of the other seven values. The four that remain are forced. fixed by the hash chosen by the prover (3) forced, needs the key (4) 0 1 2 3 4 5 6 7 X, with signer i at X = i + 1
The polynomial, drawn over the real numbers. The contract works modulo the group order N. Nothing in the proof shows which keys the prover knows.

Take part

The archive contains the contract, its tests, the deployment script, the record and the specification. The instructions go from the download to a submitted proof.

Download the challenge Read the instructions