This project demonstrates how to send a message from Osmosis to Avalanche.
Download and install the osmosisd
CLI by following the instructions here.
If the installation wizard does not work, build from source using the following commands:
git clone https://github.com/osmosis-labs/osmosis.git
cd osmosis
make build
If you don't have a wallet yet, create one using the following command:
osmosisd keys add wallet
Get some test tokens from the Osmosis Testnet Faucet: Osmosis Testnet Faucet
Navigate to the wasm
folder and build the contract using Docker:
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13
Use the following command to upload the contract:
osmosisd tx wasm store ./artifacts/send_receive.wasm --from wallet --gas-prices 0.4uosmo --gas auto --gas-adjustment 1.5 -y -b sync --output json --node <https://rpc.osmotest5.osmosis.zone:443> --chain-id osmo-test-5
Instantiate the contract with this command:
osmosisd tx wasm instantiate <codeId> '{"channel":"channel-4118"}' --from wallet --label "send_receive" --gas-prices 0.1uosmo --gas auto --gas-adjustment 1.3 --no-admin -y -b sync --output json --node <https://rpc.osmotest5.osmosis.zone:443> --chain-id osmo-test-5
Replace <codeId>
with the actual code ID of your transaction. To find the code ID, check Mintscan and replace <codeId>
accordingly.
Navigate to the root folder and create a .env
file:
touch .env
Add the private key of your EVM address to the .env
file:
PRIVATE_KEY="your private key"
Run the script using the following command:
node index.js
Run the script using the following command:
node read.js
- Ensure you have Docker installed for building the contract.
- Replace placeholder values (e.g.,
<codeId>
,"your private key"
) with actual values specific to your setup. - For any issues during the deployment or execution, refer to the official documentation or community forums for support.