You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried to run the deploy_from_contract.rs example, but instead of using Anvil, I have tried to deploy it on ethereum sepolia testnet
Code to reproduce
use std::env;use alloy_primitives::U256;use alloy_provider::{network::EthereumSigner,Provider,ProviderBuilder};use alloy_signer_wallet::LocalWallet;use alloy_sol_types::sol;use dotenv::dotenv;use eyre::Result;sol!{
#[allow(missing_docs)]// solc v0.8.24; solc a.sol --via-ir --optimize --bin
#[sol(rpc, bytecode="608080604052346100155760d2908161001a8239f35b5f80fdfe60808060405260043610156011575f80fd5b5f3560e01c9081633fb5c1cb1460865781638381f58a14606f575063d09de08a146039575f80fd5b34606b575f366003190112606b575f545f1981146057576001015f55005b634e487b7160e01b5f52601160045260245ffd5b5f80fd5b34606b575f366003190112606b576020905f548152f35b34606b576020366003190112606b576004355f5500fea2646970667358221220bdecd3c1dd631eb40587cafcd6e8297479db76db6a328e18ad1ea5b340852e3864736f6c63430008180033")]
contract Counter{
uint256 public number;
function setNumber(uint256 newNumber) public {
number = newNumber;}
function increment() public {
number++;}}}#[tokio::main]asyncfn main() -> Result<()>{dotenv().ok();let signer:LocalWallet = env::var("WALLET").expect("Missing 'WALLET' environment variable").parse()?;let rpc_url = env::var("HTTP_RPC").expect("Missing HTTP_RPC environment variable").parse()?;let provider = ProviderBuilder::new().signer(EthereumSigner::from(signer.clone())).on_http(rpc_url)?;let base_fee = provider.get_gas_price().await?;let contract_builder = Counter::deploy_builder(&provider);let estimate = contract_builder.estimate_gas().await?;// Crashes here with error: Error: server returned an error response: error code -32000: only replay-protected (EIP-155) transactions allowed over RPClet contract_address = contract_builder
.gas(estimate).gas_price(base_fee).nonce(
provider
.get_transaction_count(signer.address(),None).await?,).deploy().await?;// other interactions from the example but the code crashes above
Cargo.toml
[package]
name = "send-trx-minimal"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dotenv = "0.6"eyre = "0.6"tokio = { version = "1.37", features = ["full"] }
alloy-primitives = "0.7.0"alloy-sol-types = { version = "0.7.0", features = ["json"] }
alloy-provider = { git = "https://github.com/alloy-rs/alloy.git", rev = "8cb0307" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git", rev = "8cb0307" }
alloy-contract = { git = "https://github.com/alloy-rs/alloy.git", rev = "8cb0307" }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy.git", rev = "8cb0307" }
According to this post we need to specify the chain-id field, but I can't specify the chain-id in the CallBuilder
The text was updated successfully, but these errors were encountered:
Component
network, json-rpc, provider, pubsub
What version of Alloy are you on?
rev = "8cb0307"
Operating System
Linux
Describe the bug
Hello,
I have tried to run the deploy_from_contract.rs example, but instead of using Anvil, I have tried to deploy it on ethereum sepolia testnet
Code to reproduce
Cargo.toml
According to this post we need to specify the
chain-id
field, but I can't specify thechain-id
in the CallBuilderThe text was updated successfully, but these errors were encountered: