-
Notifications
You must be signed in to change notification settings - Fork 59
Confidential Transactions #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hushmirror
wants to merge
93
commits into
dashpay:master
Choose a base branch
from
hushmirror:dip-ct
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
6c0132d
Create dip-ct.md
hushmirror b63e46e
Remove implementation-specific details
hushmirror 1b855e9
Define exactly how a CT address is calculated
hushmirror 22fc36e
Update dip-ct.md
hushmirror 0f3922c
Update dip-ct.md
hushmirror 1c1a354
Update dip-ct.md
hushmirror 3519b90
Add original Pederson paper as reference
hushmirror ce1a18c
Update dip-ct.md
hushmirror 34f767e
Update dip-ct.md
hushmirror f1ef67b
Update dip-ct.md
hushmirror dc7f919
Update dip-ct.md
hushmirror 7a16879
Update dip-ct.md
hushmirror e9f81da
Add direct link to Pederson paper
hushmirror 846e876
Add additional Pedersen reference
hushmirror ea0671e
Fix the spelling of Pedersen
hushmirror 0b133d4
Update dip-ct.md
hushmirror fd0d6be
Add refs for secp256k1 and curve25519
hushmirror a8e329e
Describe reasoning behind CT address calculation
hushmirror b223cc8
More details about consensus rule changes and activation
hushmirror a3708c4
Update dip-ct.md
hushmirror a050397
Update dip-ct.md
hushmirror 3a7abb9
Update dip-ct.md
hushmirror 26faedd
Tweak and explain notation
hushmirror 1bd7573
Better explain additive/multiplicative notation
hushmirror 465e9c6
Update dip-ct.md
hushmirror 9cf7d3a
More explanation about additive/multiplicative notation
hushmirror c91ab07
Update ConfidentialAmount
hushmirror 89102b9
Update ConfidentialNonce
hushmirror 7cac96a
Use 2^52 - 1 instead of MAX_MONEY
hushmirror ef058ea
Add reference to Elements confidential addresses
hushmirror f56afaf
Add ref to elements confidential transactions
hushmirror 50cc11e
Mention HD wallet master blinding keys
hushmirror 17533c1
Add ref to SLIP-0077
hushmirror 46cd72f
Describe how blinding keys for an address are created
hushmirror 53b8f84
Fix formatting
hushmirror d71a1c1
Update dip-ct.md
hushmirror 65d4144
Add bulletproof notes ref
hushmirror e7cb62e
Add various useful refs
hushmirror 68ce8d2
Fix typo
hushmirror d286714
Improve explanation of fee
hushmirror 4cdc00c
Update dip-ct.md
hushmirror de7728d
Update details about CT addresses
hushmirror 1aa4fe4
Add Risk section and reference to BIP360
hushmirror 04d918b
Max value of range proof must be 2^N - 1
hushmirror db97c5d
Update dip-ct.md
hushmirror 81a320f
Update description of coinjoin
hushmirror 9b35642
Update dip-ct.md
hushmirror bc812b8
Mention Shor's algorithm and add to references
hushmirror bc37f9a
Update Overview as per review comments
hushmirror ee9b162
Fix formatting of Vector<>'s
hushmirror 937aeb1
Define tx input structure
hushmirror fbbb1be
ConfidentialProof lenths cannot be null
hushmirror 918b693
Update ConfidentialAmount
hushmirror d4d0989
Explain how ECDH works in a CT
hushmirror 06fd9f1
Document that public blinding key not is hashed in a CT address
hushmirror 6d2b56a
Fix review nit
hushmirror 19a8dad
Specify base58 prefixes for testnet+regtest
hushmirror 76196f2
bech32m instead of base58
hushmirror aea1f04
Clarify that these prefixes are HRPs of bech32m addresses
hushmirror 3709a87
DIP23 activation instead of height activation
hushmirror 80e4734
Add DIP23+BIP9 to references
hushmirror f37ff71
Consensus rule for max confidential utxo amount
hushmirror 543f8f4
Update references to latest version of BIP360
hushmirror eff5099
Fix typo found by @thephez
hushmirror 7389c27
Include version bytes in address
hushmirror 4404138
Only the pubkey in an address is hashed
hushmirror 4b0aa43
Give an example of what a confidential address looks like
hushmirror f1767da
Add bech32 python to references
hushmirror 457fab7
Add examples of regtest and testnet confidential addresses
hushmirror ca38db4
Add consensus rules for confidentialAddressBalance
hushmirror db50a8f
Remove block header version changes
hushmirror 87f4ded
DIP32
hushmirror 1da233f
Rename dip-ct.md to dip-0032.md
hushmirror 585c260
Merge branch 'dashpay:master' into dip-ct
hushmirror 71d67dd
Add DIP32 to README
hushmirror 635f229
style: lint fixes
thephez 642c3da
docs(dip32): typo fixes
thephez f98c083
docs: apply suggestions from code review
thephez 3778d0e
docs: consistently capitalize
thephez ca5682a
Update dip-0032.md
hushmirror a63754a
Update dip-0032.md
hushmirror 36b2431
Fix typo
hushmirror 21ee490
These items are variable size because they contain variable sized scr…
hushmirror 53a6adb
Mention CoinJoin relying on masternode honesty
hushmirror 4f28b20
Update dip-0032.md
hushmirror 74f28e1
Add reference to Abelian Group wikipedia page
hushmirror ecf645b
VarInts were not introduced by Bitcoin
hushmirror a965eb5
Clarify that x*Y is scalar multiplication
hushmirror f5a9161
Update dip-0032.md
hushmirror 1e85a37
BP range bound is currently N=40
hushmirror 89e07ff
Change prefix for confidential addresses to lowercase
hushmirror 1dc0cb7
Fix capitalization in bech32m address examples
hushmirror b2eef9f
Update section headers in dip-0032.md
hushmirror File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| <pre> | ||
| DIP: XXX | ||
| Title: Confidential Transactions | ||
| Author: Duke Leto | ||
| Comments-Summary: No comments yet. | ||
| Status: In Progress | ||
| Type: Standard | ||
| 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) | ||
| 1. [Copyright](#copyright) | ||
|
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 | ||
|
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 | ||
| which is inherited from Bitcoin Core while Monero uses the Curve25519 curve. Bulletproofs are curve-agnostic, they can be used with any elliptic curve, but when considering exactly how the code will be implemented and which low-level libraries to use, this becomes important. The Monero implementation of Bulletproofs is specific to the elliptic curve they use and can not easily be ported or used in the Dash codebase. | ||
|
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 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 will need to be decided upon for these addresses so they can easily be differentiated from other Dash addresses. 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, i.e. the `-rescan` CLI option. | ||
|
|
||
| These new CT addresses require a different base58 prefix to identify them as different from traditional Dash addresses. | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### New RPCs | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
|
|
||
| The following is a list of new RPCs which will be needed to support CTs: | ||
|
|
||
| * `getnewctaddress` | ||
| * Takes no arguments. | ||
| * Generates a random pubkey as well as a random salt or blinding factor and stores this data in wallet.dat and returns the base58 encoded representation | ||
| * This address will have a different base58 prefix from normal Dash addresses | ||
| * `listctaddresses` | ||
| * Takes no arguments. | ||
| * Returns a list of all CT addresses | ||
|
|
||
| ### Modified RPCs | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
|
|
||
| The following RPCs will be modified to support CTs: | ||
|
|
||
| * `importprivkey` | ||
| * Add ability to import a CT address private key | ||
| * `createrawcttransaction` | ||
| * Add ability to create raw CT transactions via specifying the amount of an input UTXO | ||
| * `getrawtransaction` | ||
| * Add ability to return data about CT transactions | ||
| * `gettransaction` | ||
| * Add ability to return data about CT transactions | ||
| * `getreceivedbyaddress` | ||
| * Add ability to get data about a CT address | ||
| * `dumpprivkey` | ||
| * Add ability to dump a CT address private key | ||
| * `dumpwallet` | ||
| * Add ability to dump CT address data | ||
| * `rescanblockchain` | ||
| * Add ability to recognize CT transactions owned by current wallet during a rescan | ||
| * `sendmany` | ||
| * Add ability to send to one or more CT addresses | ||
| * `sendtoaddress` | ||
| * Add ability to send to a CT address | ||
| * `validateaddress` | ||
| * Add ability to recognize CT addresses as valid and return metadata about them | ||
|
|
||
| ### Confidential transactions | ||
|
|
||
| A confidential transaction contains the following data : | ||
|
|
||
| * A 33 byte Pederson 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 | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
| * The exact size of the proof depends on the number of inputs and outputs | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
| * An explicit fee, since the fee cannot be computed by the network since the amount is hidden | ||
|
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 | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| A Pederson commitment can be thought of as a sealed box which is tamper-proof and contains a secret. Mathematically a Pederscon 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 | ||
|
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] | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| is unknown, which is equivalent to | ||
|
|
||
| ``` | ||
| log[G] | ||
| ``` | ||
|
hushmirror marked this conversation as resolved.
Outdated
|
||
|
|
||
| is unknown. This is known as the Discrete Logarithm Problem (DLP) and the security of Pederson 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 | ||
|
|
||
| * 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 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. | ||
|
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 | ||
|
|
||
| ## Copyright | ||
|
|
||
| [Licensed under MIT License](https://opensource.org/licenses/MIT) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.