Skip to content

Set up

Download the validium repo

  1. Create a new directory and cd into it.

    cd ~/
    mkdir cdk-validium
    cd cdk-validium/
    
  2. Download the 0.0.2 release from the cdk-validium-contracts github repo.

    curl -L -o cdk-validium-contracts.tar.gz https://github.com/0xPolygon/cdk-validium-contracts/archive/refs/tags/v0.0.2.tar.gz
    

    Note

    The download is available in both .tar.gz and .zip formats.

  3. Extract the files and cd into the repo.

    tar -xzf cdk-validium-contracts.tar.gz
    cd cdk-validium-contracts-0.0.2/
    

Install the dependencies

npm install

Create the contracts .env configuration

  1. Generate a mnemonic, address, and private key using cast.

    cast wallet new-mnemonic --words 12
    

    Tip

    If the command new-mnemonic is not found, update foundry with foundryup and try again.

    The output should look something like this:

    Phrase:
    island debris exhaust typical clap debate exhaust little verify mean sausage entire
    Accounts:
    - Account 0:
    Address:     0x8Ea797e7f349dA91078B1d833C534D2c392BB7FE
    Private key: 0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726
    
  2. Copy the contract environment configuration example file into a new .env file.

    Important

    You should still be in the cdk-validium-contracts-0.0.2/ directory from the previous step.

    cp .env.example .env
    
  3. Open the .env file.

    Important

    You should still be in the cdk-validium-contracts-0.0.2/ directory from the previous step.

    nano .env
    
  4. This is what the .env file will more or less look like, although you may see actual data in there from a previous run.

    MNEMONIC="<GENERATED_MNEMONIC>"  # copy/paste the generated Phrase from cast
    INFURA_PROJECT_ID="<YOUR_INFURA_API_KEY>"  # Generate a project id on [Infura](https://www.infura.io/)
    ETHERSCAN_API_KEY="<ETHERSCAN_API_KEY>" # Generate an API key on [Etherscan](https://etherscan.io)
    

    Replace the variables as follows:

    • GENERATED_MNEMONIC is the generated mnemonic phrase from the cast step above.
    • YOUR_INFURA_API_KEY is a project id you have already created on Infura Sepolia.
    • ETHERSCAN_API_KEY is an API key you have already generated on Etherscan. This variable is optional.

    Info

    Check the documentation if you want to use a different node provider.

Create the shared system .env configuration

  1. Now open the other .env file residing in /tmp/cdk/.env which we created in the prerequisite steps.

    nano /tmp/cdk/.env
    
  2. Below is what the .env file will more or less look like, although you may see actual data in there from a previous run.

    TEST_ADDRESS="<the address generated by cast above>"
    TEST_PRIVATE_KEY="<the private key generated by cast above>" 
    L1_URL="https://sepolia.infura.io/v3/<YOUR_INFURA_API_KEY>" # same as in the other env file
    L1_WS_URL="wss://sepolia.infura.io/ws/v3/<YOUR_INFURA_API_KEY>" # same as in the other env file
    

    Replace the following variables:

    • TEST_ADDRESS is the address generated by cast above.
    • TEST_PRIVATE_KEY is the private key generated by cast above.
    • L1_URL is your Infura Sepolia RPC URL, for example: https://sepolia.infura.io/v3/
    • L1_WS_URL is your Infura Sepolia wss URL, for example: wss://sepolia.infura.io/ws/v3/

Send Sepolia

Send 2 Sepolia ETH to the cast generated address called TEST_ADDRESS in the shared .env file above.


Last update: February 20, 2024
Authors: kmurphypolygon (99.13%), Rachit Sonthalia (0.87%)