Skip to content

Commit

Permalink
Merge pull request #43 from getamis/add_example
Browse files Browse the repository at this point in the history
example/: change msg to be a parameter and add more descriptions.
  • Loading branch information
bun919tw authored Apr 24, 2020
2 parents c05de85 + 6b4cf61 commit b2dc58f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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`).
Expand Down
1 change: 1 addition & 0 deletions example/signer/id-10001-input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bks:
id-10003:
x: "42617894318064911861435689891609248836936982258022075394462053252726961520252"
rank: 0
msg: "hello tss"
1 change: 1 addition & 0 deletions example/signer/id-10002-input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bks:
id-10003:
x: "42617894318064911861435689891609248836936982258022075394462053252726961520252"
rank: 0
msg: "hello tss"
1 change: 1 addition & 0 deletions example/signer/id-10003-input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bks:
id-10003:
x: "42617894318064911861435689891609248836936982258022075394462053252726961520252"
rank: 0
msg: "hello tss"
4 changes: 1 addition & 3 deletions example/signer/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b2dc58f

Please sign in to comment.