Skip to main content

Encryption Scheme

Every UTXO is encrypted with an authenticated encryption algorithm, particularly X25519-XChaCha20-Poly1305 which is ECDH over Curve25519 paired with the extended nonce variant of the ChaCha20-Poly1305 AEAD.

UTXOs are always encrypted with ephemeral Curve25519 key pairs, and the corresponding public key being set in the authenticated but plaintext part of the AEAD envelope. This eliminates the need for any public key registries while guaranteeing authenticity and confidentiality of the UTXO contents.

Let GG be the Curve25519 generator, qq be its prime order, and aa and bb be Alice's and Bob's private keys respectively:

a,b$Fqa, b \xleftarrow{\$} \mathbb{F}_{q}

Obtain the shared secret via ECDH over Curve25519:

s=X25519(a,bG)=X25519(b,aG)\quad s = \text{X25519}(a, b \cdot G) = \text{X25519}(b, a \cdot G)

Extend the shared secret with a 24-byte nonce to derive a strong 256-bit key for the symmetric cipher:

k=HChaCha20(s,n24)\quad k = \text{HChaCha20}(s, n_{24})

Let MM be the message plaintext, and EE be the sealed envelope - encrypted UTXO:

A=n24aG\quad A = n_{24} \parallel a \cdot G C=ChaCha20(k,n24,M)\quad C = \text{ChaCha20}(k, n_{24}, M) T=Poly1305(k,n24,A,C)\quad T = \text{Poly1305}(k, n_{24}, A, C) E=ACT\quad E = A \parallel C \parallel T