func (machine *AssetsProofMachine) calculateAssets() (totalAssets uint64, err error) {
	machine.pkAnonSetMutex.Lock()
	for pub, priv := range machine.PubKeyAnonSet {
		if priv != nil {
			var currBal uint64
			if currBal, err = machine.BalanceRetreiver(pub); err != nil {
				machine.pkAnonSetMutex.Unlock()
				err = fmt.Errorf("Error getting balance of pubkey while calulating assets: %s", err)
				return
			}
			totalAssets += currBal
		}
	}
	machine.pkAnonSetMutex.Unlock()
	return
}
calculateAssets calculates the assets that the exchange owns. This will be committed to.
package provisions
import (
	"crypto/ecdsa"
	"crypto/elliptic"
	"crypto/rand"
	"fmt"
	"math/big"
	"sync"
	"github.com/mit-dci/zksigma"
)
type BalProofMachine struct {
	u1 *big.Int
	u2 *big.Int
	u3 *big.Int
	u4 *big.Int
	ci *big.Int
	ti *big.Int
	xi *big.Int
}
func NewBalProofMachine(curve elliptic.Curve) (machine *BalProofMachine, err error) {
	order := curve.Params().P
	if machine.u1, err = rand.Int(rand.Reader, order); err != nil {
		err = fmt.Errorf("Error getting random u_1 for balance proof machine: %s", err)
		return
	}
	if machine.u2, err = rand.Int(rand.Reader, order); err != nil {
		err = fmt.Errorf("Error getting random u_2 for balance proof machine: %s", err)
		return
	}
	if machine.u3, err = rand.Int(rand.Reader, order); err != nil {
		err = fmt.Errorf("Error getting random u_3 for balance proof machine: %s", err)
		return
	}
	if machine.u4, err = rand.Int(rand.Reader, order); err != nil {
		err = fmt.Errorf("Error getting random u_4 for balance proof machine: %s", err)
		return
	}
	return
}
func (machine *BalProofMachine) SetChallenge(ci *big.Int) (err error) {
	if ci == nil {
		err = fmt.Errorf("Challenge cannot be nil")
		return
	}
	machine.ci = ci
	return
}
func (machine *BalProofMachine) SetPrivKey(privkey *ecdsa.PrivateKey) (err error) {
	if privkey == nil {
		err = fmt.Errorf("Private key cannot be nil")
		return
	}
	machine.xi = privkey.D
	return
}
func (machine *BalProofMachine) SResponse(si bool) (rs *big.Int, err error) {
	if machine.ci == nil {
		err = fmt.Errorf("Cannot generate a response to a challenge if the challenge has not been set")
		return
	}
	if si {
		rs = new(big.Int).Add(machine.u1, machine.ci)
	} else {
		rs = new(big.Int).Set(machine.u1)
	}
	return
}
type AssetsProofMachine struct {
	curve elliptic.Curve
	PubKeyAnonSet    map[*ecdsa.PublicKey]*ecdsa.PrivateKey
	pkAnonSetMutex   *sync.Mutex
	BalanceRetreiver func(pubkey *ecdsa.PublicKey) (balance uint64, err error)
}
func NewAssetsProofMachine(curve elliptic.Curve) (machine *AssetsProofMachine, err error) {
	machine = &AssetsProofMachine{
		curve:            curve,
		PubKeyAnonSet:    make(map[*ecdsa.PublicKey]*ecdsa.PrivateKey),
		pkAnonSetMutex:   new(sync.Mutex),
		BalanceRetreiver: bal,
	}
	return
}
func bal(pubkey *ecdsa.PublicKey) (bal uint64, err error) {
	bal = 1000000000
	return
}