Connecting to a Local Node
Firstly, you will need a local node running on your machine. We recommend one of the following methods:
- Testing utilities can assist in programmatically launching a short-lived node.
- Running fuel-core directly.
In the following example, we create a provider to connect to the local node and sign a message.
ts
See code in contextimport { Provider, Wallet } from 'fuels';
// Create a provider.
const LOCAL_FUEL_NETWORK = `http://127.0.0.1:4000/v1/graphql`;
const provider = await Provider.create(LOCAL_FUEL_NETWORK);
// Create our wallet (with a private key).
const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568';
const wallet = Wallet.fromPrivateKey(PRIVATE_KEY, provider);