The new construction saves about 35 bytes over the existing one. The
reduction in size comes from only encoding each public key (the trader's
and auctioneer's) once and not using the extra opcodes for
OP_CHECKMULTISIG.
In this commit, we overhaul the keys used in the multi-sig construction
of an account to prevent script reuse and provide plausible deniability
between account outputs to third parties. This is done by tweaking the
trader's key with two new components:
1. A per-batch key, which is obtained from the auctioneer during account
creation. Every time the account is modified or participates in a
cleared batch within the system, the per-batch key is incremented by the
curve's base point, resulting in a different key used in the account
script.
2. A shared secret derived using Diffie-Hellman between the trader's and
auctioneer's base keys. By using this secret, we provide plausible
deniability to third parties with knowledge of the base keys and
per-batch key.
The resulting tweaked key for the trader is then used as the tweak for
the auctioneer's base key.
The account manager is a subsystem of the client that will be
responsible for management of all CLM accounts on-chain. This initial
version only supports opening accounts at the moment, but this will be
extended later on to also support closing and modifying them. Open
accounts are also watched for their confirmation and spend, though the
spend path remains unhandled.
The commit stands alone by itself, and is not yet integrated into the
server as we still need to satisfy its dependencies, which we'll do in
the following commits.