Skip to content
Open
Changes from 19 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
6c0132d
Create dip-ct.md
hushmirror Nov 6, 2024
b63e46e
Remove implementation-specific details
hushmirror Nov 26, 2024
1b855e9
Define exactly how a CT address is calculated
hushmirror Nov 26, 2024
22fc36e
Update dip-ct.md
hushmirror Dec 13, 2024
0f3922c
Update dip-ct.md
hushmirror Dec 13, 2024
1c1a354
Update dip-ct.md
hushmirror Dec 13, 2024
3519b90
Add original Pederson paper as reference
hushmirror Dec 13, 2024
ce1a18c
Update dip-ct.md
hushmirror Dec 17, 2024
34f767e
Update dip-ct.md
hushmirror Dec 17, 2024
f1ef67b
Update dip-ct.md
hushmirror Dec 17, 2024
dc7f919
Update dip-ct.md
hushmirror Dec 17, 2024
7a16879
Update dip-ct.md
hushmirror Dec 17, 2024
e9f81da
Add direct link to Pederson paper
hushmirror Dec 17, 2024
846e876
Add additional Pedersen reference
hushmirror Dec 17, 2024
ea0671e
Fix the spelling of Pedersen
hushmirror Dec 17, 2024
0b133d4
Update dip-ct.md
hushmirror Dec 17, 2024
fd0d6be
Add refs for secp256k1 and curve25519
hushmirror Dec 17, 2024
a8e329e
Describe reasoning behind CT address calculation
hushmirror Dec 17, 2024
b223cc8
More details about consensus rule changes and activation
hushmirror Dec 17, 2024
a3708c4
Update dip-ct.md
hushmirror Jan 8, 2025
a050397
Update dip-ct.md
hushmirror Jan 12, 2025
3a7abb9
Update dip-ct.md
hushmirror Jan 12, 2025
26faedd
Tweak and explain notation
hushmirror Jan 14, 2025
1bd7573
Better explain additive/multiplicative notation
hushmirror Jan 14, 2025
465e9c6
Update dip-ct.md
hushmirror Jan 14, 2025
9cf7d3a
More explanation about additive/multiplicative notation
hushmirror Jan 14, 2025
c91ab07
Update ConfidentialAmount
hushmirror Jan 14, 2025
89102b9
Update ConfidentialNonce
hushmirror Jan 14, 2025
7cac96a
Use 2^52 - 1 instead of MAX_MONEY
hushmirror Jan 14, 2025
ef058ea
Add reference to Elements confidential addresses
hushmirror Jan 15, 2025
f56afaf
Add ref to elements confidential transactions
hushmirror Jan 15, 2025
50cc11e
Mention HD wallet master blinding keys
hushmirror Jan 15, 2025
17533c1
Add ref to SLIP-0077
hushmirror Jan 15, 2025
46cd72f
Describe how blinding keys for an address are created
hushmirror Jan 15, 2025
53b8f84
Fix formatting
hushmirror Jan 15, 2025
d71a1c1
Update dip-ct.md
hushmirror Jan 15, 2025
65d4144
Add bulletproof notes ref
hushmirror Jan 15, 2025
e7cb62e
Add various useful refs
hushmirror Jan 15, 2025
68ce8d2
Fix typo
hushmirror Jan 15, 2025
d286714
Improve explanation of fee
hushmirror Jan 16, 2025
4cdc00c
Update dip-ct.md
hushmirror Jan 16, 2025
de7728d
Update details about CT addresses
hushmirror Jan 22, 2025
1aa4fe4
Add Risk section and reference to BIP360
hushmirror Jan 22, 2025
04d918b
Max value of range proof must be 2^N - 1
hushmirror Jan 22, 2025
db97c5d
Update dip-ct.md
hushmirror Feb 8, 2025
81a320f
Update description of coinjoin
hushmirror Feb 8, 2025
9b35642
Update dip-ct.md
hushmirror Feb 9, 2025
bc812b8
Mention Shor's algorithm and add to references
hushmirror Feb 9, 2025
bc37f9a
Update Overview as per review comments
hushmirror Feb 9, 2025
ee9b162
Fix formatting of Vector<>'s
hushmirror Feb 12, 2025
937aeb1
Define tx input structure
hushmirror Feb 12, 2025
fbbb1be
ConfidentialProof lenths cannot be null
hushmirror Feb 13, 2025
918b693
Update ConfidentialAmount
hushmirror Feb 18, 2025
d4d0989
Explain how ECDH works in a CT
hushmirror Feb 18, 2025
06fd9f1
Document that public blinding key not is hashed in a CT address
hushmirror Feb 27, 2025
6d2b56a
Fix review nit
hushmirror Mar 20, 2025
19a8dad
Specify base58 prefixes for testnet+regtest
hushmirror Mar 24, 2025
76196f2
bech32m instead of base58
hushmirror Mar 26, 2025
aea1f04
Clarify that these prefixes are HRPs of bech32m addresses
hushmirror Mar 26, 2025
3709a87
DIP23 activation instead of height activation
hushmirror Mar 27, 2025
80e4734
Add DIP23+BIP9 to references
hushmirror Mar 27, 2025
f37ff71
Consensus rule for max confidential utxo amount
hushmirror Mar 28, 2025
543f8f4
Update references to latest version of BIP360
hushmirror Mar 29, 2025
eff5099
Fix typo found by @thephez
hushmirror Apr 1, 2025
7389c27
Include version bytes in address
hushmirror Apr 2, 2025
4404138
Only the pubkey in an address is hashed
hushmirror Apr 2, 2025
4b0aa43
Give an example of what a confidential address looks like
hushmirror Apr 2, 2025
f1767da
Add bech32 python to references
hushmirror Apr 7, 2025
457fab7
Add examples of regtest and testnet confidential addresses
hushmirror Apr 8, 2025
ca38db4
Add consensus rules for confidentialAddressBalance
hushmirror Apr 22, 2025
db50a8f
Remove block header version changes
hushmirror May 1, 2025
87f4ded
DIP32
hushmirror May 3, 2025
1da233f
Rename dip-ct.md to dip-0032.md
hushmirror May 5, 2025
585c260
Merge branch 'dashpay:master' into dip-ct
hushmirror May 5, 2025
71d67dd
Add DIP32 to README
hushmirror May 5, 2025
635f229
style: lint fixes
thephez May 21, 2025
642c3da
docs(dip32): typo fixes
thephez May 21, 2025
f98c083
docs: apply suggestions from code review
thephez Jun 9, 2025
3778d0e
docs: consistently capitalize
thephez Jun 9, 2025
ca5682a
Update dip-0032.md
hushmirror Oct 8, 2025
a63754a
Update dip-0032.md
hushmirror Oct 8, 2025
36b2431
Fix typo
hushmirror Oct 12, 2025
21ee490
These items are variable size because they contain variable sized scr…
hushmirror Oct 12, 2025
53a6adb
Mention CoinJoin relying on masternode honesty
hushmirror Oct 12, 2025
4f28b20
Update dip-0032.md
hushmirror Oct 12, 2025
74f28e1
Add reference to Abelian Group wikipedia page
hushmirror Oct 12, 2025
ecf645b
VarInts were not introduced by Bitcoin
hushmirror Oct 12, 2025
a965eb5
Clarify that x*Y is scalar multiplication
hushmirror Oct 12, 2025
f5a9161
Update dip-0032.md
hushmirror Oct 12, 2025
1e85a37
BP range bound is currently N=40
hushmirror Oct 12, 2025
89e07ff
Change prefix for confidential addresses to lowercase
hushmirror Nov 11, 2025
1dc0cb7
Fix capitalization in bech32m address examples
hushmirror Nov 13, 2025
b2eef9f
Update section headers in dip-0032.md
hushmirror Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 216 additions & 0 deletions dip-ct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<pre>
DIP: XXX
Title: Confidential Transactions
Author: Duke Leto
Comments-Summary: No comments yet.
Status: In Progress
Type: Consensus
Created: 2024-08-13
License: MIT License
</pre>

## Table of Contents

1. [Abstract](#abstract)
1. [Motivation](#motivation)
1. [Conventions](#conventions)
1. [Prior Work](#prior-work)
1. [Consensus Protocol Changes](#consensus-protocol-changes)
1. [Observation](#observation)
Comment thread
hushmirror marked this conversation as resolved.
Outdated
1. [Copyright](#copyright)
Comment thread
thephez marked this conversation as resolved.
Outdated

## Abstract

We outline a Confidential Transaction scheme for Dash. After deployment and
activation, Dash will be able to make transactions which do not leak
the amount being transferred.

## Motivation

Currently Dash transactions can optionally use CoinJoin to increase the privacy of transactions but it
leaves much to be desired. This is because CoinJoin is a mixing protocol which
Comment thread
hushmirror marked this conversation as resolved.
Outdated
is based on amount obfuscation which leaves addresses as public data.

CoinJoin transactions leaks large amounts of transaction metadata which is
accessible via public blockchain data and requires users to learn about various
details and advanced options to use it in a privacy-preserving way. The current
CoinJoin implementation also requires users to wait longer for
increased privacy via more mixing rounds. Most users will have no idea how many rounds they should use or what the implications of this choice will be. This incentivizes users to use fewer mixing
rounds to save time, reducing their privacy as well as the privacy of
all users utilizing CoinJoins.

## Conventions

We will use these abbreviations:
* BP - Bulletproof, a type of size-optimized rangeproof
* BP+ - Bulletproof+
* BP++ - Bulletproof++
* CT - Confidential Transaction

## Scope

This DIP describes how CT can be implemented via the Dash Full Node,
the implementation details of light wallet servers and clients and other nodes is out of scope.

## Prior Work

There are many different types of CTs. The term originally was used in the context
of Bitcoin in 2013 and has grown to a research field with many flavors of CTs. Monero
currently uses RingCT with Bulletproof+ optimizations and the purpose of this DIP is
to decide exactly which kind of CT is appropriate for Dash. Monero first implemented
RingCT in 2017 and then added Bulletproofs in 2018 which allow for an 80% reduction
in size of transactions, reducing blockchain bloat as well as reducing transaction fees.
A further improvement called Bulletproofs+ was completed in 2022 which further reduces
transaction size by roughly 5-10% and improves speed by 10%. Yet another improvement
called Bulletproofs++ is currently being worked on which further reduces transaction
size and speeds up runtime. Since BP++ is still being actively worked on and has not
yet been merged into Monero and BP+ are still not widely used it is currently recommended for Dash to use BPs.

## Consensus Protocol Changes

This DIP proposes a new transaction type as well as new address types and therefore is a consensus change.

## Overview

One of the large differences between Dash and Monero is the Elliptic Curve each is based on. Dash uses secp256k1 (defined by `y^2 = x^3 + 7` in "Standards For Efficient Cryptography")
which is inherited from Bitcoin Core while Monero uses the Curve25519 curve defined by `y^2 = x^3 + 486662*x^2 + x` created by Daniel J. Berstein. To quote the original Bulletproof paper "Bulletproofs are zero-knowledge arguments of knowledge" i.e. they are a generalized mathematical tool that can be used in many different ways with many different cryptographic systems. In particular, they do not require a specific elliptic curve to be used with them. This is why both Bitcoin and Monero can use Bulletproofs even though they use different elliptic curves. There exists a fork of libsecp256k1 called libsecp256k1-zkp which contains code to do Bulletproofs on the secp256k1 curve that the Dash community most likely will want to use.
Comment thread
hushmirror marked this conversation as resolved.
Outdated

## Details

This DIP documents how Dash can add CTs using Bulletproofs (BPs). The type of CT we propose using has two main parts, a signature and a Bulletproof. The Bulletproof (a type of range proof) proves that the signature is valid, in particular, that it's values are in between a certain valid range. This prevents an underflow or overflow of values that could be used to subvert the system. Bulletproofs are a type of Non-Interactive Zero Knowledge proof. They prove that the values are valid or invalid without leaking any information about the values themselves.

### Confidential addresses (CT addresses)

New Dash CTs will need a new type of address, a confidential address, to send and receive CT transactions. This means that the Dash full node will require new RPCs to create, validate, list and import confidential addresses. A prefix of `Dash` will be used for these addresses so they can easily be differentiated from other Dash addresses and from Confidential Addresses on other blockchains. These addresses will be new data in wallet.dat and the code which reads and writes wallet.dat will need to also be updated to store and retrieve this data. The code which rescans blockchain history for transactions belonging to the current wallet will also need to be updated. To detect if a UTXO is owned by the current wallet, full nodes will use the Confidential Address public key along with the salt corresponding to that public key to inspect every UTXO to see if is an output owned by the wallet.
Comment thread
hushmirror marked this conversation as resolved.
Outdated

These new CT addresses require a different base58 prefix to identify them as different from traditional Dash addresses and the prefix `Dash` is proposed.
Comment thread
hushmirror marked this conversation as resolved.
Outdated

The exact structure of a CT address is as follows. It contains the following data:

* salt (AKA blinding factor) . 32 byte random value
Comment thread
hushmirror marked this conversation as resolved.
Outdated
* pk . The compressed public key, a 33 byte secp256k1 curve point.
Comment thread
hushmirror marked this conversation as resolved.
Outdated

To clarify, the public key can actually be stored in 32 bytes and one bit, because a point on the curve is a pair of 32 byte numbers (x,y). If x is known, y is almost uniquely identified, since for each `x` there are two `y` values, for exactly the same reason why `x^2 = 4` has two solutions, +2 and -2 . Since secp256k1 is symmetric about the x-axis, one bit can be used to say if the y value is above or below the x axis.

The salt is 32 bytes because it is used to "blind" the x value of a (x,y) point on the curve which is 32 bytes. The compressed public key is 33 bytes (or 32 bytes and one bit) as described above and in the "Compressed Public Keys" section of Chapter 4 of "Mastering Bitcoin".


A CT address can be then generated via

```
address = base58( RIPEMD160( SHA256( salt + pk ) ) )
Comment thread
hushmirror marked this conversation as resolved.
Outdated
```

where `+` denotes concatenation. This is described in more detail in the section "Legacy Addresses for P2PKH" of Chapter 4 of "Mastering Bitcoin". This assumes Confidential UTXOs will be stored in P2PKH format.

### Confidential transactions

A confidential transaction contains the following data :

* A 33 byte Pedersen commitment to the amount being transferred
* A BP rangeproof that ensures the amount transferred is inside a certain interval between 0 and 2^N - 1
* To support all potential value transfers between 0 and 21M the BP rangeproof needs N equal to 52
Comment thread
hushmirror marked this conversation as resolved.
Outdated
* The exact size of the proof depends on the number of inputs and outputs
Comment thread
hushmirror marked this conversation as resolved.
Outdated
* An explicit fee, since the fee cannot be computed by the network since the amount is hidden
Comment thread
hushmirror marked this conversation as resolved.
Outdated
* A list of input UTXOs
* A list of one or more output addresses
* These may be normal or CT addresses

This DIP proposes using DIP-2 Special Transactions to store and implement Confidential Transactions. This means storing data in the `extra_payload` field of existing Dash transactions and Special Transaction `type` of 10, the currently next unused value of this field.

The structure of `extra_payload` is :
Comment thread
hushmirror marked this conversation as resolved.
Outdated

| Field | Type | Size | Description |
| ----- | ---- | ---- | ----------- |
| amount|ConfidentialAmount| 9 or 33 bytes| ... |
Comment thread
hushmirror marked this conversation as resolved.
Outdated
| nonce |ConfidentialNonce| 33 bytes| ... |
| proof |ConfidentialProof| Varies | ... |
Comment thread
hushmirror marked this conversation as resolved.
Outdated

The following data structures have been adapted from the Elements Project Transaction format:

#### ConfidentialAmount

| Field | Required | Size | Data Type | Encoding | Notes |
| ----- | -------- | ---- | --------- | -------- | ----- |
| Header | Yes | 1 byte | | | A header byte of `0x00` indicates a “null” value with no subsequent bytes.<br><br>A header byte of `0x01` indicates an “explicit” value with the following 8 bytes denoting a 64-bit value (big-endian). This value must be between 0 and `MAX_MONEY` inclusive.<br><br>A header byte of `0x08` or `0x09` indicates a blinded value encoded as a compressed elliptic curve point. With the least significant bit of the header byte denoting the least significant bit of the y-coordinate, and the remaining 32 bytes denoting the x-coordinate (big-endian). The point must be a point on the secp256k1 curve. |
| Value | If header byte is not `0x00` | 8 or 32 bytes | `hex` | Big-endian | |
Comment thread
hushmirror marked this conversation as resolved.
Outdated
Comment thread
hushmirror marked this conversation as resolved.
Outdated

#### ConfidentialNonce

| Field | Required | Size | Data Type | Encoding | Notes |
| ----- | -------- | ---- | --------- | -------- | ----- |
| Header | Yes | 1 byte | | | A header byte of `0x00` indicates a “null” value with no subsequent bytes.<br><br>A header byte of `0x01` indicates an “explicit” value with the following 32 bytes denoting a value (big-endian).<br><br>A header byte of `0x02` or `0x03` indicates a compressed elliptic curve point. With the least significant bit of the header byte denoting the least significant bit of the y-coordinate, and the remaining 32 bytes denoting the x-coordinate (big-endian). This point is not required to be on the curve. |
| Value | If header byte is not `0x00` | 32 bytes | `hex` | Big-endian | |
Comment thread
hushmirror marked this conversation as resolved.
Outdated

#### ConfidentialProof

| Field | Required | Size | Data Type | Encoding | Notes |
| ----- | -------- | ---- | --------- | -------- | ----- |
| Length | Yes | Varies | `VarInt` | | `0x00` → null. |
Comment thread
hushmirror marked this conversation as resolved.
Outdated
| Value | If header byte is not `0x00` | Varies | `hex` | Big-endian | Bulletproof which proves that the ConfidentialAmount is within the range of 0 and `MAX_MONEY`|
Comment thread
hushmirror marked this conversation as resolved.
Outdated


#### Pedersen Commitments

A Pedersen commitment can be thought of as a sealed box which is tamper-proof and contains a secret. Mathematically a Pedersen commitment is defined as

```
P(v,s) = v[G] + s[Q]
```

where

* P(v,s) means P is a function of the variables v and s
* v is a value to be committed
* s is a salt AKA blinding factor
Comment thread
hushmirror marked this conversation as resolved.
Outdated
* [G] and [Q] are elliptic curve points on secp256k1 both known to committer and verifier
* The committer is the creator of a transaction
* The verifier is any node which processes the transaction to see if it is valid
* x[Y] means multiplication of value x by curve point [Y]

[G] and [Q] MUST be randomly chosen curve points such that

```
[Q] = d[G]
Comment thread
hushmirror marked this conversation as resolved.
Outdated
```

is unknown, which is equivalent to

```
log[G]
```
Comment thread
hushmirror marked this conversation as resolved.
Outdated

is unknown. This is known as the Discrete Logarithm Problem (DLP) and the security of Pedersen commitments is based on the hardness assumption that the DLP on appropriately chosen elliptic curves have no efficient algorithm to find a solution.


### New consensus rules for CTs

The activation of these new consensus rules will be block height activated, i.e. a block height which enables Confidential Transactions will be chosen, which we will call `heightCT`. If the block height of the full node is less than `heightCT` then the following consensus rules will not be active. When the block reaches `heightCT` these rules will become active.

* If height is at least `heightCT` and if at least one input of a CT is confidential, at least one of the outputs must also be confidential. This prevents metadata leaking about the exact amount in a confidential output. A confidential output may have an amount equal to zero.
* If height is at least `heightCT` and if all inputs are public, i.e. not confidential, the number of confidential outputs must be zero or greater than or equal to two, i.e. having all public inputs with a single confidential output is not allowed, as it leaks the metadata about exactly how much value is in the confidential output.
* If height is less than `heightCT` then Special Transaction type 10 is invalid
Comment thread
hushmirror marked this conversation as resolved.
Outdated


## References

* Original post about Confidential Transactions https://bitcointalk.org/index.php?topic=305791.0
* RingCT https://eprint.iacr.org/2015/1098
* BP https://eprint.iacr.org/2017/1066.pdf
* BP+ https://eprint.iacr.org/2020/735
* BP++ https://eprint.iacr.org/2022/510
* BP++ CCS https://ccs.getmonero.org/proposals/bulletproofs-pp-peer-review.html
* BP++ Audit by CypherStack https://github.com/cypherstack/bppp-review
* libsecp256k1 https://github.com/bitcoin-core/secp256k1
* libsecp256k1 Bulletproofs: https://github.com/BlockstreamResearch/secp256k1-zkp/tree/master/src/modules/rangeproof
* Example of bulletproof API in libsecp256k1 https://github.com/guillaumelauzier/Bulletproofs-libsecp256k1/blob/main/src.cpp
* Elements Transaction Format https://github.com/ElementsProject/elements/blob/master/doc/elements-tx-format.md
* "Non-Interactive and Information-Theoretic Secure Verifiable Secret Sharing" Advances in Cryptology 1991, Torben Pryds Pedersen https://link.springer.com/chapter/10.1007/3-540-46766-1_9
* What Are Pedersen Commitments And How They Work https://www.rareskills.io/post/pedersen-commitment
* Mastering Bitcoin, Chapter 4, Keys https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04_keys.adoc
* secp256k1 "Standards For Efficient Cryptography" https://www.secg.org/sec2-v2.pdf
* Curve25519, Daniel J Bernstein https://cr.yp.to/ecdh/curve25519-20060209.pdf

## Copyright

[Licensed under MIT License](https://opensource.org/licenses/MIT)