Skip to main content

Encrypted ERC-20 Playground App

What is this EERC playground?

  • Encrypted ERC (eERC) lets you use tokens in a private way. Balances and transfers are encrypted.
  • It runs on the WATR Testnet (test network, not real money).
  • There are two modes in the app:
    • Standalone mode:
      • A fully private token that lives only inside this eERC contract.
      • Only the Owner can mint (create) new tokens.
      • Other users can receive, transfer, and sometimes burn tokens, but cannot mint.
    • Converter mode:
      • Uses a normal ERC‑20 test token (Copper Token) and wraps it into encrypted form.
      • You can deposit ERC‑20 → get encrypted tokens, and withdraw encrypted tokens → get ERC‑20 back.

You can switch between these modes at any time in the UI.


Who are the users?

In this playground we mainly think about two kinds of users:

  • Owner
    • This is the wallet that deployed the eERC contracts.
    • Only the Owner can:
      • Set the Auditor Key (needed for both Standalone and Converter contracts).
      • Mint tokens in Standalone mode.
    • The Owner will have 10,000 tokens available by default after setup.
  • Regular user
    • Any other wallet that connects to the app.
    • Regular users:
      • Must register their wallet.
      • Must generate a decryption key.
      • Can request Copper tokens in Converter mode.
      • Can deposit, withdraw and transfer in Converter mode.
      • Can receive transfers and transfer/burn in Standalone mode (but cannot mint).

Pre-requisites

Make sure you have:

  • Browser: Use a modern browser like Chrome, Brave, or Edge.
  • Wallet: Use a wallet supported by RainbowKit (for example MetaMask, Core, Rabby, etc.).
  • Network: Your wallet must be on WATR Testnet (Chain ID 92870).
  • Gas: Your wallet should have a small amount of WATR test tokens for paying transaction fees.

Let's Play

Connect your wallet

  • Open the eERC playground in your browser.
  • On the home page, click the Connect button.
  • Choose your wallet (MetaMask/Core/Rabby, etc.).
  • Approve the connection inside your wallet popup.

When you are connected, you should see your wallet address in the top-right corner.

Connect your wallet


Register your wallet (everyone must do this)

Every new wallet must register once before it can use eERC.

  • After you connect, look at the top status cards.
  • Find the card named Registration.
    • If it shows Pending with a red dot, you are not registered yet.
    • If it shows Active with a green dot, you are already registered.
  • If it is Pending, click the Register button on that card.
  • Confirm the transaction in your wallet.
  • Wait until:
    • The status changes to Active.
    • The dot becomes green.

Registration Completed

What is the Auditor Key?

  • Think of the Auditor Key like a “safety key” for this private token system.
  • It tells the contracts which public key is allowed to watch and check encrypted activity if needed.
  • Without this key:
    • The contracts treat the system as not fully configured.
    • Many actions such as mint, deposit, withdraw, transfer are blocked for safety.
  • The Owner sets this key once so that:
    • The system knows it is correctly set up.
    • All users can safely use eERC in both Standalone and Converter modes.

The Auditor Key must be set once for each mode:

  • One time for the Standalone contract.
  • One time for the Converter contract.

Until this is done, most operations will fail or show an error like: Auditor key is not set for this contract. Ask the admin to set it before …

note

Only the Owner wallet can set the Auditor Key

Set Auditor Key for Standalone mode

  • Make sure you are using the Owner wallet.
  • Switch the app to Standalone mode.
  • In the top cards, find the Auditor Key card.
    • It should say Not Set with a red dot.
  • Click Set Auditor Key.
  • Confirm the transaction in your wallet.
  • Wait until:
    • The text changes to Set.
    • The dot becomes green.

Auditor Key for Standalone Mode

Set Auditor Key for Converter mode

  • Still using the Owner wallet, switch the app to Converter mode.
  • Again, look at the Auditor Key card.
    • It will again say Not Set the first time (this is a different contract).
  • Click Set Auditor Key.
  • Confirm the transaction in your wallet.
  • Wait until it shows Set with a green dot.

Auditor Key for Converter Mode

note

If you are not the Owner, the button will be disabled and may say Only Owner Can Set.

Owner – Starting tokens

After the Owner finishes the setup steps above:

  • The Owner will have 10,000 tokens minted by default.
  • These tokens can be used to:
    • Test Standalone mode mint/burn/transfer flow.
    • Send private transfers to other registered users.

Initial Owner Balance

Standalone Mode - Regular User Operations

In Standalone mode, tokens only exist inside the eERC contract.

Important rules:

  • Only the Owner can mint (create) new tokens.
  • Other wallets cannot mint. If they try, they will see an error.
Switch to Standalone mode
  • Use the mode control/tabs to select Standalone mode.
  • Check that the Active Mode status card says standalone.

Standalone Regular User

Receive tokens from the Owner
  • As a regular user:
    • Your balance will start at 0 in Standalone mode.
    • The Owner must first send you some tokens using a private transfer.
  • Once the Owner sends you tokens:
    • Your Decrypted Balance card will show a positive amount.
    • You can now:
      • Transfer tokens to another registered user.
      • Possibly burn tokens if the contract allows non‑owners to burn

Owner Minting: Owner Minting

Alice after receiving token from bob : Receive from owner

Burn and transfer (non‑owner)
  • Transfer:

    • Works similar to Converter mode:
      • Choose Transfer tab.
      • Enter recipient address and amount.
      • Confirm the transaction.
  • Burn:

    • Enter tokens to burn and they are gone forever.
    • Use the Burn tab, enter amount, and confirm.
    • Your balance goes down.
note

in Standalone mode, you cannot mint unless your wallet is the Owner.

Burn tokens

As the Owner in Standalone mode, you can:

  • Mint new tokens.
  • Burn your own tokens.
  • Transfer tokens to any registered user.

Converter Mode - Regular User Operations

Now let’s focus on Converter mode for a regular user.

In Converter mode you work with:

  • A normal ERC‑20 token (Copper Token).
  • Its encrypted version inside the eERC contract.
Switch to Converter Mode
  • Use the mode control/tabs to select Converter mode.
  • Check that the Active Mode status card says converter.

Request tokens

Request Copper tokens (faucet)

New users start with 0 Copper tokens. To get some:

  • In Converter mode, find the card called ERC‑20 Token Information.
  • Look for the section Request Copper Tokens.
  • Click the Request Copper Tokens button.
  • Confirm the transaction in your wallet.
  • After it is confirmed:
    • Your Your Balance field should show something like 100.00 (Copper tokens).After successful token :

Faucet

Approve the Converter contract (Allowance)

Before the Converter contract can move your ERC‑20 tokens, you must give it permission (allowance).

  • Still in the ERC‑20 Token Information card, find the Allowance row.
  • Click the Approve All button.
  • Sign/confirm the transaction in your wallet.
  • Wait until:
    • The Allowance text changes to MAX.

Max

This step is required so you can:

  • Deposit ERC‑20 into encrypted form.
  • Withdraw back.
  • Use private transfers in Converter mode.
Deposit – Convert ERC‑20 to encrypted tokens

Now you can deposit some of your Copper tokens into the encrypted contract.

  • In Converter mode, scroll down to the big card titled Operations.
  • Click the Deposit tab.
  • In Amount to Deposit, type how many tokens you want to deposit, for example 10.
  • Click Deposit & Encrypt.
  • Confirm the transaction in your wallet.
  • Watch the Transaction status card at the top:
    • It should show Pending and say something like Private Depositing.
  • Once it is done:
    • Your ERC‑20 balance (Copper tokens) will go down.
    • Your Encrypted Balance card will show a higher encrypted balance.

Before Deposit: Before Deposit

After Deposit: After Deposit

Private transfer in Converter mode

You can send encrypted tokens to another registered user.

Before you transfer:

  • Make sure the recipient wallet has:
    • Clicked Connect.
    • Clicked Register (Registration = Active).
    • Clicked Generate (Decryption Key = Generated).

Then:

  • In the Operations card, click the Transfer tab.
  • In Recipient Address, paste the other user’s wallet address (0x...).
  • In Amount, type how many encrypted tokens you want to send.
  • Click Transfer Encrypted Tokens.
  • Confirm the transaction in your wallet.
  • After it confirms:
    • Your Encrypted Balance goes down.
    • The recipient’s Encrypted Balance goes up (on their screen).

If the recipient is not registered, you will see an error like Recipient is not registered and the transfer will not go through.

Sender Alice's balance before Transfer: Alice Before Transfer

Sender Alice's balance after Transfer: Alice After Transfer

Recipient Bob's balance before Transfer: Bob Before Transfer

Recipient Bob's balance after Transfer: Bob After Transfer

Withdraw – Convert encrypted tokens back to ERC‑20

You can also go back from encrypted tokens to normal ERC‑20.

  • In the Operations card, click the Withdraw tab.
  • In Amount to Withdraw, type the amount.
  • Click Decrypt & Withdraw.
  • Confirm the transaction in your wallet.
  • After it is confirmed:
    • Your Encrypted Balance goes down.
    • Your ERC‑20 balance increases.

Bob's ERC-20 balance before Withdrawing: Bob Before Withdraw

Bob's ERC-20 balance after Withdrawing: Bob After Withdraw