Secure RPC
Repository: Secure RPC GitHub
Introduction
The secure-rpc framework enables confidential transmission of transaction data by:
Encrypting transactions before sending them to any external system (e.g., a tx_orderer).
Managing encryption keys via a Distributed Key Generation (DKG) service.
This approach ensures sensitive transaction data is protected both at rest and in transit.
System Overview
The secure-rpc framework is designed to safeguard sensitive transaction data in a blockchain or rollup environment. Its core objective is to ensure that whenever a transaction needs to be broadcast, it can be protected by powerful encryption mechanisms after leaving the client environment. This encryption can later be undone by the tx_orderer. At the heart of the system lies a Distributed Key Generation (DKG) service, which manages the cryptographic keys needed to execute these operations.
Rather than manually tracking encryption keys or pre-sharing them among participants, the secure-rpc approach offloads most key-related responsibilities to this DKG service. The DKG is capable of serving the latest encryption keys for encrypting new transactions, while also storing and providing the corresponding decryption keys.
Encryption Flows
SKDE A default encryption method that uses a distributed key approach. A “delay” aspect is introduced ensuring data is only decryptable after a certain time or condition.
PVDE Leverages time-lock puzzles to enforce a minimum waiting period before decryption is possible.
Decryption Flows
The system fetches the correct decryption key from the DKG service based on a
key_id
.Applies the corresponding decryption mechanism.
Reconstructs the original transaction.
RPC Endpoints
Send Raw Transaction (
send_raw_transaction
): Based on the configuration the tx can be encrypted or tx. encryption type can be changed.
Distributed Key Generation Service
Provides encryption keys, decryption keys, and SKDE parameters.
Manages key rotation or updates so that the client always uses the latest encryption key.
Key Components & Flows
DKG Integration
The secure-rpc client retrieves:
Encryption Key for encrypting outgoing transactions.
Decryption Key for decrypting incoming or stored transactions.
SKDE Parameters needed for the SKDE algorithm.
Encryption Flow (SKDE Example)
Raw Transaction (e.g., Ethereum transaction) is provided.
Transaction Splitting:
Open Data: Non-sensitive metadata or fields that must remain unencrypted.
Encrypted Data: Sensitive fields that should remain confidential.
Key Retrieval from the DKG service (latest or specific
key_id
).Encryption using SKDE routines (
skde::delay_encryption
) along with the encryption_key.Result is an
EncryptedTransaction
with a reference to thekey_id
used.
Time-Lock Puzzle (PVDE)
Though currently a minimal or “unsupported” flow in the provided code, the concept is:
Generate a puzzle parameter (
time_lock_puzzle_param
) which involves a carefully chosen modulusn
, baseg
, and exponenty
.The encryption includes a puzzle, meaning that even with the correct key, it takes a certain number of sequential operations to unlock the data.
The puzzle is combined with zero-knowledge proofs (
sigma_protocol_public_input
) to prove that data was encrypted correctly without revealing it.
Usage Scenario
Client needs to submit a transaction to a tx_orderer, but data is sensitive.
AppState / Config indicates encryption is enabled with SKDE.
Client calls
send_raw_transaction
, which internally:Calls
encrypt_transaction
→ obtains anEncryptedTransaction
.Sends this encrypted data to the tx_orderer via a chosen RPC endpoint from a configured URL list.
The tx_orderer provides the secure-rpc with order-commitment.
The secure RPC forwards it to the user.
Later, the tx-orderer needs to retrieve the original transaction.
Tx_orderer fetches the decryption key from the DKG system and obtains the original transaction.
Last updated