Protocol¶
CashShuffle is an extension to CoinShuffle. The CoinShuffle protocol defines a sequence of 5 phases (+ a 6th blame phase for identifying protocol violators). Several details are left implementation defined.
cashshufflejs uses this configuration for the variable details:
- Message types are defined with protobuf.
- Messages on the wire are preceded by a byte length count represented as an unsigned 32-bit integer in big endian byte order.
-
protocol.
Phase
()¶ Phase enumeration.
Arguments: - None (number) – Before protocol start. Value 0.
- Announcement (number) – Phase 1. Participants announce themselves. Value 1.
- Shuffle (number) – Phase 2. Blind shuffling of output addresses. Value 2.
- Broadcast (number) – Phase 3. Verify output addresses. Value 3.
- EquivocationCheck (number) – Phase 4. Verify no equivocation. Value 4.
- Signing (number) – Phase 5a. Sign transaction. Value 5.
- VerificationSubmission (number) – Phase 5b. Submit transaction to Bitcoin Cash network. Value 6.
- Blame (number) – Out of band phase 6. Identify protocol violator. Value 7.
-
protocol.
Reason
()¶ Blame reason enumeration.
Arguments: - InsufficientFunds (number) – Insufficient funds. Value 0.
- DoubleSpend (number) – Double spend. Value 1.
- EquivocationFailure (number) – Equivocation failure. Value 2.
- ShuffleFailure (number) – Shuffle failure. Value 3.
- ShuffleEquivocationFailure (number) – Shuffle and equivocation failure. Value 4.
- InvalidSignature (number) – Invalid signature. Value 5.
- MissingOutput (number) – Missing output. Value 6.
- Liar (number) – Liar. Value 7.
- InvalidFormat (number) – Invalid format. Value 8.
-
protocol.
Invalid
()¶ Invalid message.
Provides access to an invalid message as a byte string.
Arguments: - invalid= (bytes) – Bytes of message.
-
protocol.
DecryptionKey
()¶ Description key.
Arguments: - key= (string) – Decryption key as string.
- public= (string) –
-
protocol.
EncryptionKey
()¶ Encryption key.
Arguments: - key= (string) – Encryption key as string.
-
protocol.
Hash
()¶ Message hash.
Enables validating message integrity.
Arguments: - hash= (bytes) – Hash as byte string.
-
protocol.
InputSignature
()¶ Input signature.
Arguments: - index (uint64) – Input index.
- signature (protocol.Signature) – Input signature.
-
protocol.
Registration
()¶ Registration request.
Arguments: - amount= (uint64) – Amount of Bitcoin Cash to shuffle.
-
protocol.
Signature
()¶ Digital signature.
Enables verifying message authenticity.
Arguments: - signature= (bytes) – Signature as byte string.
-
protocol.
Transaction
()¶ Bitcoin Cash transaction.
Arguments: - transaction= (bytes) – Bitcoin Cash transaction as byte string.
-
protocol.
VerificationKey
()¶ Verification key.
Public key of a participant. Used to identify sender and recipient in messages.
Arguments: - key= (string) – Verification key as string.
-
protocol.
Message
()¶ Core message.
Arguments: - address= (protocol.Address) – Bitcoin Cash address.
- key= (protocol.EncryptionKey) – Encryption key.
- hash= (protocol.Hash) – Message hash.
- signature= (protocol.Signature) – Message signature.
- str= (string) –
- blame= (protocol.Blame) – Blame details.
- next= (protocol.Message) –
- signatures= (Array.<protocol.InputSignature>) – Input signatures.
-
protocol.
Packet
()¶ Packaged message.
Message with envelope and packaging details.
Arguments: - session= (bytes) – Session number.
- number= (uint32) –
- from_key= (protocol.VerificationKey) – Sender public key.
- to_key= (protocol.VerificationKey) – Recipient public key.
- phase= (protocol.Phase) – Protocol phase.
- message= (protocol.Message) – Core message.
- registration= (protocol.Registration) – Registration request.
-
protocol.
Signed
()¶ Signed packaged message.
Packaged message with signature.
Arguments: - packet= (protocol.Packet) – Packaged message.
- signature= (protocol.Signature) – Packet signature.
-
protocol.
Packets
()¶ List of signed packets.
Arguments: - packet= (Array.<protocol.Signed>) – Signed packets.
-
protocol.
Blame
()¶ Blame details.
Arguments: - reason= (protocol.Reason) – Blame reason.
- accused= (protocol.VerificationKey) – Public key of accused participant.
- key= (protocol.DecryptionKey) – Decryption key.
- transaction= (protocol.Transaction) –
- invalid= (protocol.Invalid) – Invalid message.
- packets= (protocol.Packets) – List of signed packets.