Skip to content

Instantly share code, notes, and snippets.

@0x2830
Created February 25, 2020 21:10
β”Œccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc┐
β”‚ β”‚
β”‚ _ _ ___ _____ β”‚
β”‚ | |__ | |___ / __\/__ \ β”‚
β”‚ | '_ \| / __| / / / /\/ β”‚
β”‚ | |_) | \__ \/ /___ / / β”‚
β”‚ |_.__/|_|___/\____/ \/ β”‚
β”‚ β”‚
β”œ=========================================================================─
β”‚ β”‚
β”‚ blsCT - a private transaction protocol β”‚
β”‚ β”‚
β”œ=========================================================================─
β”‚ β”‚
β”‚ β”‚
β”‚ _ Confidential _ β”‚
β”‚ β”‚
β”‚ A transaction does not reveal the transacted amount. β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ _ Untraceable _ β”‚
β”‚ β”‚
β”‚ It is hard to identify the source of the coins. β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ _ Unlinkable _ β”‚
β”‚ β”‚
β”‚ Given two transactions are sent to the same user, it's impossible to β”‚
β”‚ link them by an observer. Moreover, given two public keys, an β”‚
β”‚ adversary cannot determine whether they belong to the same user. β”‚
β”‚ β”‚
β”‚ β”‚
β””cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccβ”˜
~~~~ WHAT IS blsCT ~~~~
β”Œccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc┐
β”‚ β”‚
β”‚ β”‚
β”‚ _ blsCT transactions are aggregatable _ β”‚
β”‚ β”‚
β”‚ two blsCT transactions can be merged in one blsCT transaction. an β”‚
β”‚ observer can't tell if a transaction has been aggregated! β”‚
β”‚ transactions can be aggregated infinite times! β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ _ aggregated blsCT transactions are good for privacy _ β”‚
β”‚ β”‚
β”‚ blsCT hides the transaction amounts. when two transactions are β”‚
β”‚ aggregated and their inputs are mixed, an observer can't tell which β”‚
β”‚ inputs pay which outputs! β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ _ aggregation can be passive _ β”‚
β”‚ β”‚
β”‚ transactions can be aggregated at various layers: block construction β”‚
β”‚ by miners, tx broadcast by nodes, aggregation market by senders! β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ _ blsCT helps scalability _ β”‚
β”‚ β”‚
β”‚ only one signature is needed for each block, instead of needing one β”‚
β”‚ signature for each input! β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ _ liquidity providers can earn money _ β”‚
β”‚ β”‚
β”‚ nodes can earn coins offering their coins for mixing β”‚
β”‚ participating in the aggregation market! β”‚
β”‚ β”‚
β”‚ β”‚
β””cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccβ”˜
~~~~ AGGREGATION MARKET ~~~~
$ Hello nodes! If you give me one .───────.
$ transaction to mix with mine, I ( NODE2 )
$ .─────────. will pay you 1 NAV! `───────'
$ β•± β•² .───────.
$ ( MY NODE ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─▢ ( NODE3 )
$ `. ,' `───────'
$ `───────' .─────. .─────. .─────. .───────.
S $ .───────. ─( TX2 )( TX3 )( TX4 ) ─ ─ ( NODE4 )
E $ ( MY TX ) β”‚ `─────' `─────' `─────' `───────'
N $ `───┬───'
D $ β”Œ ─ β–Ό
E $ .─────────.
R $ β”‚ β•± β•²
$ ─▢( AGGREGATION )
$ `. ,'
$ `───┬───'
$ The aggregated transaction
$ .─────▼─────. β”Œ ─ ─ ─ ─ is broadcasted to other
$ (AGGREGATED TX) nodes
$ `───────────' β”‚
β”‚
ß β—€ ─ ─ ─ β”˜ .───────.
ß β”‚ ─ ─ ─ ─ ─( NODE5 )
ß .───▼───. β”‚ `───────'
ß ( NODE4 )─ ┐ ▼─ ─ ─ ─ .───────.
B ß `───────' .─────────. ─ ─ ─( NODE6 )
R ß ─ β”˜ β•± β•² β”‚ `───────'
O ß β”” β–Ά ( AGGREGATION )◀─ ─ .───────.
A ß ─ β–Ά. ,' β”Œ ─ ─ ─( NODE7 )
D ß β”‚ `───┬───'◀─ ─ ─ `───────'
C ß Aggregation happens
A ß again with other ─ β”˜ .─────▼─────.
S ß txs (AGGREGATED TX)
T ß `───────────'
ß β”‚
ß .───────────. .───────────.
ß (AGGREGATED TX) β”‚ (AGGREGATED TX)
ß `───────────' β–Ό `───────────'
β”‚ .─────────. β”‚
ß β•± β•²
ß β”” ─ ─ ─ ─ ─ β–Ά( AGGREGATION )β—€ ─ ─ ─ ─ β”˜
ß `. ,'
ß `───────'
ß And again... β”‚
ß β–Ό
ß .───────────.
ß (AGGREGATED TX)
ß `───────────'
ß β”‚
ß
ß β”‚
ß β–Ό
ß .─────────────.
S ß _.───' `────.
T ß ,─' '─.
A ß ,' `.
K ß ,' `.
E ß ,' `.
R ß β•± BLOCK β•²
ß β•± β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β•²
/ ß β•± β”‚ blsCT TX β”‚ β•²
ß ; β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ ;
M ß ; β”‚ SIGNATURE β”‚ ;
I ß ; β”œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€ :
N ß β”‚ β”‚INPUT4 β”‚OUTP1 β”‚ β”‚
E ß inputs and ─ ─ ─▢│INPUT2 β”‚OUTP4 β”‚ β”‚
R ß outputs are β”‚INPUT5 β”‚OUTP2 β”‚ ;
ß mixed, can't link β”‚INPUT3 β”‚OUTP3 │◀──────────┐ ;
ß them β”‚INPUT1 β”‚ ... β”‚ β”‚ ;
ß β”‚ ... β”‚ β”‚
ß β•² β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”˜
ß β•² this transaction
ß β•² pays 1 NAV to each
ß `. node2, node3 and
ß `. node4
ß `.
ß '─.
ß `────. _.───'
ß `───────────'
ß
ß
ß
~~~~ HOW DOES IT WORK ~~~~
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TX 1 β”‚ β”‚ TX 2 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ SIGNATURE β”‚ β”‚ SIGNATURE β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€ β”œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€
β”‚INPUT1 β”‚OUTP1 β”‚ β”‚INPUT4 β”‚OUTP3 β”‚
β”‚INPUT2 β”‚OUTP2 β”‚ β”‚INPUT5 β”‚OUTP4 β”‚
β”‚INPUT3 β”‚ β”‚ β”‚INPUT6 β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”˜
β”‚
.─────────. β”‚
β”‚ β•± β•²
─ β–Ά ( AGGREGATION ) β—€ β”˜
`. ,'
`───────'
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TX β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ SIGNATURE β”‚β—€ ─ ─ only one signature
β”œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€
β”‚INPUT4 β”‚OUTP1 β”‚
inputs and outputs ─ ─ ─▢│INPUT2 β”‚OUTP4 β”‚
are mixed, can't link β”‚INPUT5 β”‚OUTP2 β”‚
them β”‚INPUT3 β”‚OUTP3 β”‚
β”‚INPUT1 β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”˜
~~~~ HOW DOES A TX LOOK LIKE ~~~~
β”Œccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc┐
β”‚ β”‚
β”‚ BLS signature - aggregation of the signatures: β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ for each input: β”‚
β”‚ β”‚
β”‚ Sign(prev output spending key, H(input)) β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ for each output: β”‚
β”‚ β”‚
β”‚ Sign(output blinding key, H(output)) β”‚
β”‚ β”‚
β”‚ β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ BLS output β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ amount: 0xffffffff as a marker β”‚
β”‚ β”‚ to show it is a bls output. β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ scriptPub: spending script. β”‚
β”‚ β”‚ <TRUE> if no spending β”‚
β”‚ β”‚ conditions. β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ blinding key: public key used to β”‚
β”‚ β”‚ create a bls signature of the β”‚
β”‚ β”‚ output and as ephemeral key for β”‚
β”‚ BLS input β”‚ creating a shared secret. β”‚
β”‚ β”‚ β”‚
β”‚ Same structure as a normal β”‚ spending key: public key β”‚
β”‚ input. It can only point to a β”‚ authorized to spend, derived β”‚
β”‚ BLS output. β”‚ using the shared secret. β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ encrypted data: amount, blinding β”‚
β”‚ β”‚ factor and memo encrypted using β”‚
β”‚ β”‚ the shared secret. β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ amount commitment: pedersen β”‚
β”‚ β”‚ commitment to the output amount β”‚
β”‚ β”‚ and a blinding factor. β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ range proof: proof that amount β”‚
β”‚ β”‚ is positive. β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚
β””cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccβ”˜
~ CRYPTOGRAPHIC PRIMITIVES ~
β”Œ=========================================================================┐
β”‚ β”‚
β”‚ _ BLS signatures _ β”‚
β”‚ β”‚
β”‚ https://tools.ietf.org/html/draft-boneh-bls-signature-00 β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ _ Bulletproofs _ β”‚
β”‚ β”‚
β””cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccβ”˜
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment