> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://docs.prividium.com/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

Prividium transaction filterer is an *optional* contract that allows you to control what kind of L1->L2 transactions are
added to the queue to be executed.

In particular, it can be used to only allow ETH and ERC20 token deposits to the chain, unless the address is whitelisted
on the transaction filterer contract.

The filterer is one part of enabling deposits. For the full setup — L2 permissions, this filterer, and frontend settings
— see [Enabling Bridging](/configuring/chain/bridging).

## Deployment and configuration

These are the steps to deploy and configure the transaction filterer on an otherwise deployed chain:

1. Clone the contracts repo and install dependencies:

```bash
git clone -b zksync-os-stable https://github.com/matter-labs/era-contracts --recursive
cd era-contracts/l1-contracts
yarn install
```

2. Simulate deployment and configuration of the
   [PrividiumTransactionFilterer.sol](https://github.com/matter-labs/era-contracts/blob/154f60275e8161da792004a5740c4897ab8f7cf1/l1-contracts/contracts/transactionFilterer/PrividiumTransactionFilterer.sol).

```bash
BRIDGEHUB_ADDRESS=... # Address of the L1 Bridgehub
CHAIN_ADMIN_PK=... # Private key of the Prividium chain admin, can be used to upgrade the filterer contract
FILTERER_OWNER_PK=... # Private key of the filterer contract owner, cannot be the same as chain admin
CHAIN_ID=... # Chain ID of the Prividium chain
DEPOSITS_ALLOWED=... # `true` or `false` - whether or not to allow depositing for non-whitelisted addresses
L1_RPC_URL=...

forge script deploy-scripts/DeployPrividiumTransactionFilterer.s.sol \
    --sig 'run(address,uint256,bool)' $BRIDGEHUB_ADDRESS $CHAIN_ID $DEPOSITS_ALLOWED \
    --private-keys $CHAIN_ADMIN_PK \
    --private-keys $FILTERER_OWNER_PK \
    --sender $(cast wallet address $FILTERER_OWNER_PK) \
    --rpc-url $L1_RPC_URL
```

3. Run the same command, with `--broadcast` appended at the end to send the transactions on chain. After this command
   succeeds, the transaction filterer is deployed and configured.

## Whitelisting addresses

Only addresses whitelisted on the transaction filterer contract are able to perform arbitrary L1->L2 transactions. All
other EOA addresses are only able to perform deposits *to their own address*, if `depositsAllowed` is set to `true`.
Note that contract addresses are aliased during depositing, which means that L1 contracts will not be able to perform
deposits unless whitelisted.

* To add an address to the whitelist, call `grantWhitelist(address sender)` method
* To remove an address from the whitelist, call `revokeWhitelist(address sender)` method
* To toggle deposits permission (i.e. to allow/disallow depositing for non-whitelisted addresses), call
  `setDepositsAllowed(bool allowed)` method

All 3 of these methods can only be called by the owner of the transaction filterer contract.

Example:

```bash
cast send $FILTERER_ADDRESS 'grantWhitelist(address)' $ADDRESS_TO_WHITELIST --private-key $FILTERER_OWNER_PK --rpc-url $L1_RPC_URL --broadcast
```
