diff --git a/example/README.md b/example/README.md index 65d5dbb3..db4e54cf 100644 --- a/example/README.md +++ b/example/README.md @@ -51,6 +51,9 @@ Besides the common inputs, signer will need another three inputs. 1. `share`: The respective share generated from DKG. 2. `pubkey`: The public key generated from DKG. 3. `bks`: The Birkhoff parameter of all peers. +4. `msg`: The message to be signed. + +> Note that `msg` for all participants must be the same. If the value of message is different, signing process will fail. Most of the time, this message will be a cryptographic transaction. And the transaction might be created from one party. Therefore, practically, before signing, another information exchange for the raw transaction might be required. For example, in file `signer/id-10001-input.yaml`, a complete signer configuration is show below. @@ -73,6 +76,7 @@ bks: id-10003: x: "42617894318064911861435689891609248836936982258022075394462053252726961520252" rank: 0 +msg: "hello tss" ``` > Note: All signer config files have already contained executable configurations. However, you could also try to copy the results from DKG/reshare result files and overwrite the configurations (e.g from `dkg/id-10001-output.yaml` to `signer/id-10001-input.yaml`). diff --git a/example/signer/id-10001-input.yaml b/example/signer/id-10001-input.yaml index 377c146f..7b5a8e23 100644 --- a/example/signer/id-10001-input.yaml +++ b/example/signer/id-10001-input.yaml @@ -16,3 +16,4 @@ bks: id-10003: x: "42617894318064911861435689891609248836936982258022075394462053252726961520252" rank: 0 +msg: "hello tss" diff --git a/example/signer/id-10002-input.yaml b/example/signer/id-10002-input.yaml index 10d90f4f..0522efb2 100644 --- a/example/signer/id-10002-input.yaml +++ b/example/signer/id-10002-input.yaml @@ -16,3 +16,4 @@ bks: id-10003: x: "42617894318064911861435689891609248836936982258022075394462053252726961520252" rank: 0 +msg: "hello tss" diff --git a/example/signer/id-10003-input.yaml b/example/signer/id-10003-input.yaml index ea8c08c7..423ed3be 100644 --- a/example/signer/id-10003-input.yaml +++ b/example/signer/id-10003-input.yaml @@ -16,3 +16,4 @@ bks: id-10003: x: "42617894318064911861435689891609248836936982258022075394462053252726961520252" rank: 0 +msg: "hello tss" diff --git a/example/signer/service.go b/example/signer/service.go index 9f8f2610..a0cbb1fe 100644 --- a/example/signer/service.go +++ b/example/signer/service.go @@ -25,8 +25,6 @@ import ( "github.com/libp2p/go-libp2p-core/network" ) -var msg = []byte{1, 2, 3} - type service struct { config *SignerConfig pm types.PeerManager @@ -57,7 +55,7 @@ func NewService(config *SignerConfig, pm types.PeerManager) (*service, error) { } // Create signer - signer, err := signer.NewSigner(pm, dkgResult.PublicKey, paillier, dkgResult.Share, dkgResult.Bks, msg, s) + signer, err := signer.NewSigner(pm, dkgResult.PublicKey, paillier, dkgResult.Share, dkgResult.Bks, []byte(config.Message), s) if err != nil { log.Warn("Cannot create a new signer", "err", err) return nil, err