Shamir Secret Sharing with Zero Knowledge proofs proving the correct operations were performed. gnark is used to create the ZKP.
This uses a similar approach to https://github.com/hashcloak/shamir-rs, and adds zero knowledge proofs at the points where a calculation is done by a party.
go run . -port=8080 -otherPorts=8081,8082
go run . -port=8081 -otherPorts=8080,8082
go run . -port=8082 -otherPorts=8080,8081
echo "TEST" | nc 127.0.0.1 8080
Run tests:
go test
Handle command with given functionality:
- SEND_SHARES - calculate shares and send RECEIVE_SHARE to other parties
- RECEIVE_SHARE - store received share
- SUM_AND_DISTRIBUTE - sum received shares, create ZKP and send both the share and the ZKP to other parties with RECEIVE_SUM_AND_PROOF
- RECEIVE_SUM_AND_PROOF - verify proof and if it checks out, store sum. Otherwise, store an error (?)
- GIVE_RESULT - give result if there was no error
Research & fix: the zkp can only handle small numbers, not random numbers.
Optional:
- generate https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr from goff