<aside> ⚠️

Before following this guide, make sure the network you want to test is working properly.

</aside>

Build Packages

cd tokamak-thanos/packages/tokamak/contracts-bedrock

./scripts/start-deploy.sh build

Set the environment variables and fund assets

We use TON as L2 native token in devnet. Before we start the bridge test, we set the environment variables. You can find the addresses of L1 deployed contracts and L2 native token in .devnet/addresses.json. (This file is generated after we deployed contracts in L1.)

# change directory
cd packages/tokamak/sdk

# open file
vi tasks/example.env

# ..need to edit and save
export PRIVATE_KEY=${your_private_key}
export NATIVE_TOKEN=${address_L2NativeToken}
export ADDRESS_MANAGER=${address_AddressManager}
export L1_CROSS_DOMAIN_MESSENGER=${address_L1CrossDomainMessengerProxy}
export L1_STANDARD_BRIDGE=${address_L1StandardBridgeProxy}
export OPTIMISM_PORTAL=${address_OptimismPortalProxy}
export L2_OUTPUT_ORACLE=${address_L2OutputOracleProxy}
export L1_URL=${url_l1}
export L2_URL=${url_l2}

# copy to packages/tokamak/sdk/.env
cp tasks/example.env .env

And we prepare ETH and TON in L1.

Fund ETH in L1 (Only Devnet)

<aside> 👉

Sepolia: You can get the ETH faucet using Infura, Quicknode, Alchemy, etc.

</aside>

command:

# change directory
cd packages/tokamak/contracts-bedrock

# fund
cast send --from 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 --rpc-url <http://localhost:8545> --unlocked --value ${ammount} ether ${your_address}

expected result:

# fund 10 ETH
cast send --from 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 --rpc-url <http://localhost:8545> --unlocked --value 10ether 0x90358f827D81D988355D709A06CeE594a4E38BA6

blockHash               0x06a9c98e91b4970465768d27fb82055fc5a1065533758daec4b92e9ce1450a04
blockNumber             244
contractAddress         
cumulativeGasUsed       21000
effectiveGasPrice       1000000007
from                    0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
gasUsed                 21000
logs                    []
logsBloom               0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
root                    
status                  1 (success)
transactionHash         0x024156b4501db26f913f39b3a46a38251b04db4c612528477109bb0955f3ee7d
transactionIndex        0
type                    2
blobGasPrice            
blobGasUsed             
to                      0x961b6fb7D210298B88d7E4491E907cf09c9cD61d

Fund TON in L1 (Only Devnet)

<aside> 👉

Sepolia: Please refer to https://docs.tokamak.network/home/service-guide/faucet-testnet

</aside>

command:

# change directory
cd packages/tokamak/sdk

# fund TON
npx hardhat fund-native-token --amount ${amount}

expected result:

# fund 200000000 TON
npx hardhat fund-native-token --amount 200000000000000000000000000

Faucet amount: 200000000000000000000000000
Native token address: 0xC7844340d14deAedfDD2f2dD9360c336661b2F0A
Native token balance in L1 before funding: 0
Faucet transaction hash:  0x1332e290ce1ebd00399c6f489da8329759787385312810ec99faad259b0b468a
Native token balance in L1 after funding: 200000000000000000000000000