I tried to access the latest test network and got a 404 prompt

I tried to access the latest test network and got a 404 prompt. Is there something wrong with my rpc? Where should I find the correct rpc, which I copied from the wallet.

use std::str::FromStr;

use fuels::{crypto::SecretKey, prelude::*};

use tokio::runtime;

async fn wallet() {
    // let rpc_url = "beta-5.fuel.network/graphql";
    let rpc_url = "testnet.fuel.network/v1/graphql";

    // Create a provider pointing to the testnet.
    // This example will not work as the testnet does not support the new version of fuel-core
    // yet
    let provider = Provider::connect(rpc_url).await.unwrap();

    // Setup a private key
    let secret =
        SecretKey::from_str("xxxxxxxx")
            .unwrap();

    // Create the wallet
    let wallet = WalletUnlocked::new_from_private_key(secret, Some(provider));

    // Get the wallet address. Used later with the faucet
    dbg!(wallet.address().to_string());

    let balances = wallet.get_balances().await.unwrap();
    dbg!(balances);
}

fn main() {
    let rt = runtime::Runtime::new().unwrap();
    rt.block_on(wallet());
}

thread 'main' panicked at src/main.rs:14:53:
called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: Other, error: ErrorResponse(404, "") })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1 Like

same like that and looking forward to solution

Hi @nGsoVdMbJdbFwPfXiUzz and @Flan289 ,

Can you please include more context around what code you are trying to run (link to code or gist) and what your fuelup show result is and what version of the SDK you have installed in your project?

I’ll have the team look into this for what we can and get back to you shortly.

This is all my code

use std::str::FromStr;

use fuels::{crypto::SecretKey, prelude::*};

use tokio::runtime;

async fn wallet() {
    // let rpc_url = "beta-5.fuel.network/graphql";
    let rpc_url = "testnet.fuel.network/v1/graphql";

    // Create a provider pointing to the testnet.
    // This example will not work as the testnet does not support the new version of fuel-core
    // yet
    let provider = Provider::connect(rpc_url).await.unwrap();

    // Setup a private key
    let secret =
        SecretKey::from_str("xxxxxxxx")
            .unwrap();

    // Create the wallet
    let wallet = WalletUnlocked::new_from_private_key(secret, Some(provider));

    // Get the wallet address. Used later with the faucet
    dbg!(wallet.address().to_string());

    let balances = wallet.get_balances().await.unwrap();
    dbg!(balances);
}

fn main() {
    let rt = runtime::Runtime::new().unwrap();
    rt.block_on(wallet());
}

Cargo.toml

[package]
name = "hello_fuel"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
fuels = { version = "0.55.0", features = ["fuel-core-lib"] }
tokio = { version = "1.4", features = ["full"] }

I uploaded my source code to github

nGsoVdMbJdbFwPfXiUzz/hello_fuel (github.com)

Can you please upgrade your fuels version to “0.62.0”? Also, could you share the output of the command ‘fuelup show’ when run in the terminal?

After updating the version I can use it normally

2 Likes

I am glad it helped. lmk if you want anymore help :slight_smile: