Skip to content

Commit c5ec807

Browse files
authored
Threshold encryption for improved liveness (#1)
1 parent c0b65aa commit c5ec807

40 files changed

+1432
-6695
lines changed

README.md

Lines changed: 140 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,183 @@
1-
# ADCNet - Anonymous Broadcast Protocol
1+
# ADCNet - Anonymous Distributed Communication Network
22

3-
[![Goreport status](https://goreportcard.com/badge/github.com/ruteri/auction-based-dcnet)](https://goreportcard.com/report/github.com/ruteri/auction-based-dcnet)
4-
[![Test status](https://github.com/ruteri/auction-based-dcnet/workflows/Checks/badge.svg?branch=main)](https://github.com/ruteri/auction-based-dcnet/actions?query=workflow%3A%22Checks%22)
3+
[![Goreport status](https://goreportcard.com/badge/github.com/flashbots/adcnet)](https://goreportcard.com/report/github.com/flashbots/adcnet)
4+
[![Test status](https://github.com/flashbots/adcnet/workflows/Checks/badge.svg?branch=main)](https://github.com/flashbots/adcnet/actions?query=workflow%3A%22Checks%22)
55

6-
Auction-based DCNet is a Golang implementation of the "ZIPNet: Low-bandwidth anonymous broadcast from (dis)Trusted Execution Environments" protocol. It provides an efficient, scalable, and robust anonymous broadcast channel with high trust diversity and low bandwidth requirements.
6+
ADCNet is a Go implementation of an anonymous distributed communication network using threshold cryptography and auction-based message scheduling. It provides anonymous broadcast with cryptographic privacy guarantees and efficient bandwidth allocation through a distributed auction mechanism.
77

88
## Overview
99

10-
ADCNet allows participants to broadcast messages without revealing who sent which message. It improves upon existing anonymous broadcast protocols by significantly reducing server computational overhead and bandwidth requirements, making it practical to deploy with many untrusted servers for better anonymity guarantees.
10+
ADCNet enables participants to broadcast messages anonymously using threshold secret sharing. The protocol ensures that message content and sender identity remain hidden as long as fewer than a threshold number of servers collude. It uses an Invertible Bloom Filter (IBF) based auction system for fair and efficient message scheduling.
1111

1212
## Architecture
1313

14-
ADCNet consists of three main components:
14+
ADCNet consists of three main components operating in a round-based protocol:
1515

1616
### 1. Clients
1717

18-
Clients operate inside Trusted Execution Environments (TEEs) and prepare encrypted messages. The TEE is used for DoS prevention but not for privacy, making TEE failures a liveness issue rather than a privacy concern. Non-talking clients send all-zero messages as cover traffic.
18+
Clients prepare messages for anonymous broadcast by:
19+
- Creating polynomial secret shares of their messages using Shamir's Secret Sharing
20+
- Blinding each share with server-specific one-time pads derived from shared secrets
21+
- Participating in auctions for message slots by encoding bids into IBF chunks
22+
- Encoding messages at auction-determined offsets if they won slots in previous rounds
1923

2024
### 2. Aggregators
2125

22-
Aggregators form a tree-like structure to combine client messages, significantly reducing the bandwidth requirements for anytrust servers. Aggregators are completely untrusted for privacy.
26+
Aggregators reduce bandwidth requirements by:
27+
- Collecting and verifying client message signatures
28+
- Combining client shares through field addition in finite fields
29+
- Supporting hierarchical aggregation to further reduce server load
30+
- Operating without any trust requirements for privacy
2331

24-
### 3. Anytrust Servers
32+
### 3. Servers
2533

26-
Servers operate in an anytrust model where privacy is guaranteed as long as at least one server is honest. Servers unblind the aggregated messages and combine partial decryptions to produce the final broadcast.
34+
Servers collaborate to reconstruct messages through threshold decryption:
35+
- Each server removes its blinding factors from aggregated messages
36+
- Servers create partial decryptions by subtracting their one-time pads
37+
- A leader server combines partial decryptions using polynomial interpolation
38+
- The reconstructed IBF is inverted to determine next round's message scheduling
2739

2840
## Key Features
2941

30-
- **Hierarchical Message Aggregation**: Uses untrusted aggregators to combine client messages, reducing bandwidth requirements
31-
- **Falsifiable TEE Trust**: Uses TEEs for DoS prevention but not privacy
32-
- **Efficient Cover Traffic**: Makes non-talking participants extremely cheap, encouraging large anonymity sets
33-
- **Scalable Trust Model**: Supports hundreds of anytrust servers with minimal performance penalty
34-
- **Forward Secrecy**: Uses key ratcheting to ensure past communications remain secure
35-
- **Auction-based Scheduling**: Uses an Invertible Bloom Filter (IBF) for efficient and fair slot allocation
36-
- **Dynamic Message Sizing**: Supports variable-length messages allocated through the auction mechanism
42+
- **Threshold Secret Sharing**: Uses polynomial-based secret sharing with configurable threshold `t`
43+
- **Finite Field Arithmetic**: Operates in two fields - 513-bit for messages, 384-bit for auctions
44+
- **IBF-based Scheduling**: Distributed auction mechanism using Invertible Bloom Filters
45+
- **One-time Pad Blinding**: Server-specific blinding using PRF-derived vectors
46+
- **Dynamic Message Sizing**: Variable-length messages allocated through auction weights
47+
- **Anonymity Guarantees**: Unlinkability between rounds through fresh blinding
48+
49+
## Protocol Flow
50+
51+
1. **Message Preparation** (Client):
52+
- Check if won slot in previous auction by comparing message hash
53+
- Encode message at appropriate offset if auction was won
54+
- Create polynomial shares where f(0) = message, degree = t-1
55+
- Blind shares with server-specific one-time pads
56+
57+
2. **Aggregation**:
58+
- Aggregators sum shares from multiple clients in finite field
59+
- Verify signatures and enforce authorization policies
60+
- Support multi-level aggregation for bandwidth optimization
61+
62+
3. **Partial Decryption** (Server):
63+
- Each server subtracts its blinding factors from aggregate
64+
- Derives blinding using PRF with shared secrets and round number
65+
- Creates partial decryption share for polynomial reconstruction
66+
67+
4. **Message Reconstruction** (Leader):
68+
- Collects partial decryptions from at least t servers
69+
- Uses Neville interpolation to evaluate polynomial at x=0
70+
- Recovers auction IBF to determine next round's winners
71+
- Outputs reconstructed message vector and auction results
72+
73+
## Package Structure
74+
75+
### `protocol`
76+
Main protocol implementation including:
77+
- `ClientMessager`: Secret sharing and message preparation
78+
- `ServerMessager`: Partial decryption and message reconstruction
79+
- `AggregatorMessager`: Message aggregation operations
80+
- Message encoding and polynomial operations
81+
82+
### `blind_auction`
83+
Distributed auction mechanism featuring:
84+
- `IBFVector`: Multi-level Invertible Bloom Filter implementation
85+
- `AuctionEngine`: Knapsack-based slot allocation
86+
- Auction data encoding and recovery algorithms
87+
88+
### `crypto`
89+
Cryptographic primitives providing:
90+
- Field arithmetic in finite fields
91+
- Polynomial interpolation (Neville's algorithm)
92+
- Key management (Ed25519 signing, X25519 key exchange)
93+
- Blinding vector derivation
94+
- PRF-based random generation
95+
96+
## Security Properties
97+
98+
- **Privacy**: Message content hidden as long as fewer than `t` servers collude
99+
- **Anonymity**: Sender identity protected through polynomial secret sharing
100+
- **Unlinkability**: Fresh blinding prevents correlation between rounds
101+
- **Availability**: System operates with any `t` out of `n` servers
102+
- **Integrity**: Digital signatures authenticate all protocol messages
37103

38-
## Protocol Innovations
39-
40-
### Invertible Bloom Filter (IBF) for Message Scheduling
41-
42-
ADCNet uses an Invertible Bloom Filter to enable an auction-based scheduling mechanism. Instead of randomly selecting slots with static sizes (as in the original footprint scheduling), clients bid for message space by submitting weights in an auction:
43-
44-
1. Clients compute a hash of their message and include it with a weight in an AuctionData structure
45-
2. These auction entries are inserted into an IBF with multiple levels and buckets
46-
3. The IBF is encrypted using one-time pads derived from shared secrets with servers
47-
4. After server decryption and aggregation, the IBF is "peeled" to recover all auction entries
48-
5. Message slots are allocated based on auction weights, with higher weights receiving priority
49-
50-
### Dynamic Message Allocation
104+
## Implementation Details
51105

52-
Unlike the original fixed-size message slots, ADCNet now supports dynamic message sizing:
106+
- **Field Orders**:
107+
- Messages: 513-bit prime field (encodes 512-bit chunks)
108+
- Auctions: 384-bit field (48-byte IBF chunks)
109+
- **Polynomial Degree**: t-1 where t is the threshold
110+
- **Blinding**: PRF-based one-time pads unique per server/round/index
111+
- **IBF Structure**: 4-level filter with 0.75 shrink factor between levels
53112

54-
1. Clients participate in the auction process to bid for message space
55-
2. The protocol compares message weights to determine slot allocation
56-
3. A knapsack-style optimization allocates message space based on auction results
57-
4. This approach provides more efficient bandwidth utilization for variable-sized messages
113+
## Getting Started
58114

59-
## Implementation Details
115+
### Installation
60116

61-
This Go implementation provides:
117+
```bash
118+
go get github.com/flashbots/adcnet
119+
```
62120

63-
- Strong typing for cryptographic primitives (Hash, Signature, PublicKey, etc.)
64-
- Clean interfaces for Clients, Aggregators, and Servers
65-
- Abstractions for TEEs, cryptographic operations, and network transport
66-
- IBF-based auction mechanism for efficient slot reservation
67-
- Support for dynamic message sizes
121+
### Basic Usage
122+
123+
```go
124+
import (
125+
"github.com/flashbots/adcnet/protocol"
126+
"github.com/flashbots/adcnet/crypto"
127+
)
128+
129+
// Configure protocol parameters
130+
config := &protocol.ADCNetConfig{
131+
AuctionSlots: 100,
132+
MessageSize: 1000, // Size in field elements
133+
MinServers: 3, // Threshold t
134+
MessageFieldOrder: crypto.MessageFieldOrder,
135+
}
136+
137+
// Initialize components
138+
client := &protocol.ClientMessager{
139+
Config: config,
140+
SharedSecrets: sharedSecrets, // Pre-established with servers
141+
}
142+
143+
// Prepare and send messages
144+
messages, shouldSend, err := client.PrepareMessage(
145+
roundNumber,
146+
previousRoundOutput,
147+
messageData,
148+
auctionBid,
149+
)
150+
```
68151

69-
## Getting Started
152+
## Testing
70153

71-
### Prerequisites
154+
Run the test suite:
72155

73-
- Go 1.18 or higher
74-
- For client functionality: Access to a TEE (SGX, TrustZone, etc.)
156+
```bash
157+
go test ./...
158+
```
75159

76-
### Installation
160+
Performance benchmarks:
77161

78162
```bash
79-
go get github.com/ruteri/auction-based-dcnet
163+
go test -bench=. ./protocol
80164
```
81165

82166
## Security Considerations
83167

84-
- ADC provides anonymity as long as at least one anytrust server is honest
85-
- TEE security is required only for DoS prevention and faithful auction outcomes, not privacy
86-
- All client messages must be processed or none; selective dropping breaks anonymity
87-
- The protocol operates in rounds with synchrony assumptions
88-
- The IBF-based auction mechanism ensures fair slot allocation while maintaining anonymity
168+
- Servers must have pre-established shared secrets with all authorized clients
169+
- A large share of authorized clients must participate (send real or dummy messages) for anonymity
170+
- Message padding and salting required to prevent traffic analysis
171+
- Synchronous rounds assumed - asynchrony breaks anonymity guarantees
172+
- Not all cryptographic operations are constant-time (field arithmetic, polynomial math)
89173

90174
## License
91175

92176
This project is licensed under the MIT License - see the LICENSE file for details.
93177

94-
## Acknowledgements
178+
## References
95179

96-
ADC is based on the research paper:
180+
This implementation is inspired by research in anonymous communication systems and threshold cryptography. The auction-based scheduling mechanism using IBFs provides an efficient solution for dynamic bandwidth allocation in anonymous broadcast protocols.
97181

182+
Loosely based on:
98183
Rosenberg, M., Shih, M., Zhao, Z., Wang, R., Miers, I., & Zhang, F. (2023). ZIPNet: Low-bandwidth anonymous broadcast from (dis)Trusted Execution Environments.

aggregator/aggregator.go

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)