aboutsummaryrefslogtreecommitdiff
path: root/bidder/bid.go
diff options
context:
space:
mode:
Diffstat (limited to 'bidder/bid.go')
-rw-r--r--bidder/bid.go77
1 files changed, 0 insertions, 77 deletions
diff --git a/bidder/bid.go b/bidder/bid.go
deleted file mode 100644
index 5f98a0c..0000000
--- a/bidder/bid.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package bidder
-
-import (
- "crypto/ed25519"
- "fmt"
-
- . "kesim.org/seal/nizk"
-
- "kesim.org/seal/nizk/commit"
- "kesim.org/seal/nizk/stage1"
-)
-
-type bid struct {
- id ed25519.PrivateKey
- Id ed25519.PublicKey
-
- price uint64 // bigendian encoding of the bid
- bitlength uint8 // number of bits encoded in price.
-
- // bits are derived from zbid and the zero element in
- // the slice corresponds to the highest bit in zbid
- bits []*commit.Statement
-
- // The commitments we received from the bidders.
- bidders map[string][]*commit.Commitment
-
- // sorted list of the bidders.
- bidder_ids []string
-
- // Stage 1 data per round
- stage1 []*stage1.Statement
-}
-
-// newBid creates a new Bidder for the given price, using the lower bits up to bitlength
-func newBid(price uint64, bitlength uint8) (b *bid, e error) {
- if bitlength > 63 {
- return nil, fmt.Errorf("bitlength too large, maximum is 63")
- } else if 0 != (price >> bitlength) {
- return nil, fmt.Errorf("price %d too large for given bitlength %d", price, bitlength)
- }
-
- b = &bid{
- price: price,
- bitlength: bitlength,
- }
-
- b.Id, b.id, e = ed25519.GenerateKey(nil)
- if e != nil {
- return nil, e
- }
-
- b.bits = make([]*commit.Statement, bitlength)
- for i := bitlength; i > 0; i-- {
- set := (price>>(i-1)&1 != 0)
- x, r := Curve.RandomScalar(), Curve.RandomScalar()
- b.bits[i-1] = commit.NewStatement(x, r, set)
- }
-
- return b, nil
-}
-
-// Commit returns the public commitment to the bits and a signature
-// TODO: return signature over bid
-func (bid *bid) Commit() (c []*commit.Commitment) {
- c = make([]*commit.Commitment, len(bid.bits))
- for i := range bid.bits {
- c[i] = bid.bits[i].Commit(Bites(bid.Id))
- }
- return c
-}
-
-func (bid *bid) Result() {
-}
-
-func (bid *bid) Send(msg []byte, sig []byte) error {
- return fmt.Errorf("bidder.Send not implemented")
-} \ No newline at end of file