Private transaction processing
Processing private transactions involves the following:
-
Precompiled contract: A smart contract compiled from the source language to EVM bytecode and stored by an Ethereum node for later execution.
-
Privacy marker transaction (PMT): A public Ethereum transaction with a payload of the enclave key. The enclave key is a pointer to the private transaction in Tessera. The
to
attribute of the PMT is the address of the privacy precompiled contract.The PMT is signed with a random key or the key specified on the command line.
Private transaction processing is illustrated and described in the following diagram.
-
Submit a private transaction using
eea_sendRawTransaction
. The signed transaction includes transaction parameters specific to private transactions, including:privateFor
orprivacyGroupId
, which specifies the list of recipients.privateFrom
, which specifies the sender.restriction
, which specifies the transaction is restricted to the transaction participants.
-
The JSON-RPC endpoint passes the private transaction to the Private Transaction Handler.
-
The Private Transaction Handler sends the private transaction to Tessera.
-
Tessera distributes the private transaction directly (that is, point-to-point) to the Tessera nodes specified in
privateFor
or belonging to the privacy group identified byprivacyGroupId
. All recipient Tessera nodes store the transaction. Tessera associates the stored transaction with the transaction hash and privacy group ID. -
Tessera returns the transaction hash to the Private Transaction Handler.
-
The Private Transaction Handler creates a PMT for the private transaction. The Private Transaction Handler propagates the PMT using devP2P in the same way as any other public Ethereum transaction.
tipIf you want to sign the PMT outside of Besu, use
priv_distributeRawTransaction
instead ofeea_sendRawTransaction
. -
Besu mines the PMT into a block and the PMT is distributed to all Ethereum nodes in the network.
-
The Mainnet Transaction Processor processes the PMT in the same way as any other public transaction. On nodes containing the privacy precompile contract specified in the
to
attribute of the PMT, the Mainnet Transaction Processor passes the PMT to the privacy precompile contract.noteNodes receiving the PMT that don't contain the privacy precompile contract ignore the PMT.
-
The privacy precompile contract queries Tessera for the private transaction and privacy group ID using the transaction hash.
-
The privacy precompile contract passes the private transaction to the Private Transaction Processor. The privacy group ID specifies the private world state to use.
-
The Private Transaction Processor executes the transaction. The Private Transaction Processor can read and write to the private world state, and read from the public world state.
- We recommend using a network with a consensus mechanism supporting transaction finality. For example, IBFT 2.0.
- Tessera must be highly available and run in a separate instance to Besu.
Using private transactions with pruning or fast sync is not supported.