|
1 | 1 | --- |
2 | 2 | title: Proxy RPC API |
3 | | -description: Learn about the Prividium™ Proxy RPC API. |
| 3 | +description: Understand how the Prividium™ Proxy RPC enforces access control. |
4 | 4 | --- |
5 | 5 |
|
6 | | -In a standard rollup, there is a standard RPC API that provides full access |
7 | | -to transaction data for users. |
8 | | -With Prividium™, the Proxy RPC is an additional layer in between end users and the chain's standard RPC API. |
| 6 | +The Proxy RPC sits between end users and the chain's standard RPC API. It enforces transaction-level access control by filtering |
| 7 | +all blockchain interactions before they reach the sequencer. |
9 | 8 |
|
10 | | -The purpose of the Proxy RPC API is to filter blockchain transactions and wallet interactions. |
11 | | -It serves as an intermediary between web apps/wallets |
12 | | -and blockchain data while enforcing transaction-level access control. |
| 9 | +:display_partial{path="/zk-stack/prividium/_partials/_license-callout"} |
13 | 10 |
|
14 | | -Access to the standard RPC should remain private. |
15 | | -We highly recommend implementing a secure firewall around the standard RPC API. |
16 | | -Only the Proxy RPC API endpoint should be publicly shared. |
| 11 | +## How It Works |
17 | 12 |
|
18 | | -## Setting up the Proxy |
| 13 | +The Proxy RPC validates every request against the [Permissions API](/zk-stack/prividium/permissions-overview): |
19 | 14 |
|
20 | | -To set up the legacy Proxy, you can follow the instructions in the [local setup guide](/zk-stack/prividium/run-prividium-chain#proxy-rpc-api). |
| 15 | +1. User submits a transaction or query through the Proxy RPC |
| 16 | +2. Proxy validates the user's JWT and wallet address |
| 17 | +3. Proxy checks permissions for the requested contract function |
| 18 | +4. Authorized requests proceed to the standard RPC; unauthorized requests return `401 Unauthorized` |
21 | 19 |
|
22 | | -The new implementation of the Proxy is not yet publicly available. |
| 20 | +::callout{icon="i-heroicons-exclamation-triangle" color="amber"} |
| 21 | +Keep the standard RPC endpoint private. Implement a firewall to restrict access. Only expose the Proxy RPC publicly. |
| 22 | +:: |
23 | 23 |
|
24 | 24 | ## Limitations |
25 | 25 |
|
26 | | -### Multicall contract methods |
| 26 | +### Multicall Contracts |
27 | 27 |
|
28 | | -Currently, [multicall](https://docs.chainstack.com/docs/http-batch-request-vs-multicall-contract#multicall-contract) contract methods |
29 | | -cannot be used in any access policy, |
30 | | -as it would enable bypassing the other access policy rules. |
| 28 | +[Multicall](https://docs.chainstack.com/docs/http-batch-request-vs-multicall-contract#multicall-contract) contract methods |
| 29 | +bypass individual function permission checks. The Proxy blocks multicall patterns to prevent policy circumvention. |
31 | 30 |
|
32 | | -### L1-L2 transactions |
| 31 | +### L1-L2 Transactions |
33 | 32 |
|
34 | | -L1-L2 transactions, also known as forced transactions, originate from Ethereum (the L1) and can be force included on the L2 chain. |
35 | | -In a public chain, this mechanism helps ensure censorship resistance for users, |
36 | | -and allows them to retain full control of their assets. |
| 33 | +Forced transactions originating from Ethereum (L1) can bypass the Proxy entirely. These transactions provide censorship resistance |
| 34 | +on public chains but create security risks for permissioned networks: |
37 | 35 |
|
38 | | -For Prividium™ chains though, |
39 | | -forced transactions can also be a vector for deploying arbitrary contracts, |
40 | | -performing arbitrary contract writes, |
41 | | -and leaking data through blind attacks. |
42 | | -The ZKsync protocol contracts have a way to |
43 | | -[request arbitrary transaction](https://github.com/matter-labs/era-contracts/blob/29f9ff4bbe12dc133c852f81acd70e2b4139d6b2/l1-contracts/contracts/bridgehub/Bridgehub.sol#L216) |
44 | | -to be executed from Ethereum, |
45 | | -and it can be used to bypass the privacy configuration of a Prividium™ chain. |
| 36 | +- Deploy arbitrary contracts |
| 37 | +- Execute unauthorized writes |
| 38 | +- Leak data through blind attacks |
46 | 39 |
|
47 | | -Currently **L1-L2 transactions are not automatically disabled** in Prividium™ chains. |
48 | | -Prividium™ chain operators can be protected against malicious use of these forced transactions by implementing [transaction filtering](/zk-stack/customizations/transaction-filtering). |
49 | | -Note that for users, this means that the chain has the ability to censor transactions. |
50 | | -It is the responsibility of the chain operator to decide how to implement this filtering. |
| 40 | +**Mitigation:** |
| 41 | + |
| 42 | +L1-L2 transactions are **not automatically disabled**. |
| 43 | +Chain operators can implement [transaction filtering](/zk-stack/customizations/transaction-filtering) to control forced transaction behavior. |
| 44 | + |
| 45 | +The [`PrividiumTransactionFilterer`](https://github.com/matter-labs/era-contracts/blob/zksync-os-stable/l1-contracts/contracts/transactionFilterer/PrividiumTransactionFilterer.sol) |
| 46 | +contract provides an allowlist-based filter: |
| 47 | + |
| 48 | +- Allowlisted addresses execute unrestricted forced transactions |
| 49 | +- Other addresses can only transfer ETH or ERC-20 tokens |
| 50 | + |
| 51 | +::callout{icon="i-heroicons-light-bulb"} |
| 52 | +Enabling transaction filtering grants the chain operator censorship capability. Document your filtering policy for users. |
| 53 | +:: |
0 commit comments