# SLIP-0077 : Deterministic blinding key derivation for Confidential Transactions ``` Number: SLIP-0077 Title: Deterministic blinding key derivation for Confidential Transactions Type: Standard Status: Draft Authors: Roman Zeyde Created: 2019-06-15 ``` ## Abstract This document describes a method for blinding key derivation for Confidential Transactions, using a deterministic hierarchy. ## General design In confidential transactions, the sender and the receiver use ECDH to derive a shared nonce, which is then used for hiding/recovering of the actual value and asset type being transacted. In Elements/Liquid, the receiver uses the following derivation scheme for his ECDH public/private keys: ``` blinding_private_key := HMAC_SHA256(key=master_blinding_key, msg=script_pubkey) blinding_public_key := secp256k1_publickey(private_key=blinding_private_key) ``` Note: `blinding_private_key` (as 256-bit scalar) must be less than the secp256k1 curve group order - otherwise, the derivation above must fail. The receiver is using `blinding_public_key` to construct a "confidential address", which is used by the sender to blind the relevant transaction outputs. Each such blinded transaction output also contains the sender's ECDH public key, so the receiver would be able to recover the shared nonce using its `blinding_private_key`. An additional use-case is sharing some/all of the receiver's blinding private keys with an external auditor, allowing unblinding the audited outputs without being able to spend them. ## Design details ### Master blinding key derivation In order to use similar blinding key derivation scheme on TREZOR, we suggest using [SLIP-0021](https://github.com/satoshilabs/slips/blob/master/slip-0021.md) derivation scheme for `master_blinding_key`: ``` domain := b"Symmetric key seed" root := HMAC_SHA512(key=domain, msg=seed) label := b"SLIP-0077" node := HMAC_SHA512(key=root[0:32], msg=(b"\x00" + label)) master_blinding_key := node[32:64] ``` The above seed should be derived using [BIP-0039](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed) mnemonic and passphrase (if available). ### Shared nonce derivation The shared nonce is derived using ECDH and double-SHA256 of the compressed shared public key: ``` shared := secp256k1_multiply(blinding_private_key, sender_public_key, compressed=True) nonce := SHA256(SHA256(shared)) ``` ## References * [An investigation into Confidential Transactions](https://github.com/AdamISZ/ConfidentialTransactionsDoc/blob/master/essayonCT.pdf) * [Confidential Transactions tutorial](https://elementsproject.org/elements-code-tutorial/confidential-transactions#blindingkey) * [Liquid Developer Guide](https://docs.blockstream.com/liquid/developer-guide/developer-guide-index.html#confidential-transactions) * [Elements' blinding key derivation](https://github.com/ElementsProject/elements/blob/a6beb256ed5195c2a1014a34fdf354d5797247a8/src/wallet/wallet.cpp#L5594) * [Elements' output unblinding using ECDH](https://github.com/ElementsProject/elements/blob/66c015529e7846f8491bcafd986326bcafc1bfcb/src/blind.cpp#L53)