Connecting to Testnet
The Testnet is a public network that allows you to interact with a Fuel Virtual Machine and is used for testing and development purposes.
Latest Testnet
Dev Testnet
https://testnet.fuel.network/v1/graphql
We have some useful resources for the Testnet:
- Faucet - for funding wallets that have been created.
- Explorer - for viewing transactions and blocks.
- GraphQL Playground - for testing GraphQL queries and mutations.
In the example below, we connect a Provider to the latest testnet and create a new wallet from a private key.
Note: New wallets on the Testnet will not have any assets! You can use the Faucet to fund your wallet.
ts
See code in contextimport { Provider, Wallet } from 'fuels';
// Create a provider, with the Latest Testnet URL.
const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
// Create our wallet (with a private key).
const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568';
const wallet = Wallet.fromPrivateKey(PRIVATE_KEY, provider);
// Perform a balance check.
const { balances } = await wallet.getBalances();
// [{ assetId: '0x..', amount: bn(..) }, ..]