I have a smart contract written with the stylus SDK, and I have a rust script that I've written to interact with it. My file structure looks as such:

├── Cargo.lock
├── Cargo.toml
├── Makefile
├── script
│   └── get_block.rs
└── src
    └── main.rs
  • main.rs: My smart contract/program
  • get_block.rs: My script to interact with my program

For simplicity, let's say my program looks as such:

use ethers::prelude::*;

const RPC_URL: &str = "https://eth.llamarpc.com";

async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let provider = Provider::<Http>::try_from(RPC_URL)?;
    let block_number: U64 = provider.get_block_number().await?;


How would I run my script in cargo/stylus?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.