Documentation ¶
Index ¶
Constants ¶
const MinPeers = 4
MinPeers is the minimum number of peers required for a mix run to proceed.
Variables ¶
var ( ErrTooFewPeers = errors.New("not enough peers required to mix") ErrUnknownPRs = errors.New("unable to participate in reformed session referencing unknown PRs") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages local mixing client sessions.
func (*Client) ExpireMessages ¶
ExpireMessages will cause the removal all mixpool messages and sessions that indicate an expiry height at or before the height parameter and removes any pending DiceMix sessions that did not complete.
type CoinJoin ¶
type CoinJoin struct {
// contains filtered or unexported fields
}
CoinJoin tracks the in-progress coinjoin transaction for a single peer as the mixing protocol is performed.
func NewCoinJoin ¶
func NewCoinJoin(gen GenFunc, change *wire.TxOut, mixValue int64, prExpiry uint32, mcount uint32) *CoinJoin
NewCoinJoin creates the initial coinjoin transaction. Inputs must be contributed to the coinjoin by one or more calls to AddInput.
func (*CoinJoin) AddInput ¶
func (c *CoinJoin) AddInput(input *wire.TxIn, prevScript []byte, prevScriptVersion uint16, privKey *secp256k1.PrivateKey) error
AddInput adds an contributed input to the coinjoin transaction.
The private key is used to generate a UTXO signature proof demonstrating that this wallet is able to spend the UTXO. The private key is not retained by the CoinJoin structure and may be zerod from memory after AddInput returns.
func (*CoinJoin) MixedIndices ¶
MixedIndices returns the peer's mixed transaction output indices.
type Wallet ¶
type Wallet interface { BestBlock() (uint32, chainhash.Hash) // Mixpool returns access to the wallet's mixing message pool. // // The mixpool should only be used for message access and deletion, // but never publishing; SubmitMixMessage must be used instead for // message publishing. Mixpool() *mixpool.Pool // SubmitMixMessage submits a mixing message to the wallet's mixpool // and broadcasts it to the network. SubmitMixMessage(ctx context.Context, msg mixing.Message) error // SignInput adds a signature script to a transaction input. SignInput(tx *wire.MsgTx, index int, prevScript []byte) error // PublishTransaction adds the transaction to the wallet and publishes // it to the network. PublishTransaction(ctx context.Context, tx *wire.MsgTx) error }
Wallet signs mix transactions and listens for and broadcasts mixing protocol messages.
While wallets are responsible for generating mixed addresses, this duty is performed by the generator function provided to NewCoinJoin rather than this interface. This allows each CoinJoin to pass in a generator closure for different BIP0032 accounts and branches.