Sending messages from Ethereum to Starknet.
cd starknet/Set the required Starknet environment variables in starknet.env and run:
source starknet.env(cd store_value && scarb build)In other words, you're sending your contract’s code to the network
starkli declare \
store_value/target/dev/store_value_SimpleStorage.contract_class.json \
--compiler-version=2.7.1 \This will return the identifier of the contract class in Starknet:
Class hash declared:
0x0618a9355cb653ac5cc7eb0d4d88ad74fbbb30bff03357dc573641010aed4279
You're now creating a usable instance of the code you previously declared
starkli deploy 0x0618a9355cb653ac5cc7eb0d4d88ad74fbbb30bff03357dc573641010aed4279This will return the address of the deployed contract:
Contract deployed:
0x05d6d1ab1a3ce77fbf0e04eca3a17e908ef9825e86286dc3845c5e23bb82485c
Install dependencies
cd ethereum/
pnpm iSet the required Ethereum environment variables in ethereum.env and run:
source ethereum.envCompile the Ethereum smart contract using hardhat
npx hardhat compilenpx hardhat run scripts/deploy.js --network sepoliaThis will return the Ethereum address of the deployed contract:
L1 to L2 Messenger deployed to: 0x76d4661bD8a04e5769bA196d91f5D33f5038cdBc
Review the callContract.js script and update all variables accordingly. Once you're done, run it with:
node scripts/callContract.jsYou should now be able to call your L2 contract with starkli and check that modified_by has been updated to reflect your L1 contract address, and the stored value corresponds with what you sent:
starkli call <L2_CONTRACT_ADDRESS> get_modified_by
[
"<LI_CONTRACT_ADDRESS>"
]
starkli call <L2_CONTRACT_ADDRESS> get
[
"<NEW_VALUE>"
]