Skip to content

Commit

Permalink
UIP 4: Fix markdownlint
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero committed Nov 12, 2024
1 parent e04f488 commit f61c190
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions uips/uip-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S

The `Spend` action will be augmented with an additional field `encrypted_backref` on the `SpendBody`:

```
```protobuf
message SpendBody {
// A commitment to the value of the input note.
penumbra.core.asset.v1.BalanceCommitment balance_commitment = 1;
Expand All @@ -54,33 +54,27 @@ The `encrypted_backref` should be encrypted using `ChaCha20-Poly1305`. [RFC-8349

We derive a new symmetric key, the Backreference Key $brk$, from the `OutgoingViewingKey` $ovk$ using the BLAKE2b-512 hash function and personalization string `"Penumbra_Backref"`:

```
brk = BLAKE2b-512("Penumbra_Backref", ovk)
```rust
brk = BLAKE2b_512("Penumbra_Backref", ovk)
```

One advantage of using a single key is that we can scan all spends using this key without having to do key derivation each time.

The first 12 bytes of the nullifier `nf` on the spend is used as the nonce $n$:

```
```rust
n = nf[:12]
```

There is a single nullifier per spend/note, thus this nonce will not repeat, satisfying the requirement that no (key, nonce) pair be reused for encrypting different plaintexts.

Encryption of the 32-byte note commitment $cm$ is performed using `ChaCha20-Poly1305` with the $(brk, n)$ tuple and outputs the 32-byte ciphertext $c$ and a 16-byte MAC:

```
(c, MAC) = ChaCha20-Poly1305(brk, n, cm)
```

The transmitted data in the `encrypted_backref` field consists of a concatenation of the ciphertext $c$ and MAC:

```
encrypted_backref = c || MAC
```rust
(c, MAC) = ChaCha20_Poly1305(brk, n, cm)
```

The `encrypted_backref` is thus 48 bytes (32 byte ciphertext + 16 byte MAC).
The transmitted data in the `encrypted_backref` field consists of a concatenation of the ciphertext $c$ and MAC. The `encrypted_backref` is thus 48 bytes (32 byte ciphertext + 16 byte MAC).

### EffectHash

Expand Down

0 comments on commit f61c190

Please sign in to comment.