> For the complete documentation index, see [llms.txt](/llms.txt)

# Connect to Local Network

This guide shows you how to connect your application to the Aztec local network and interact with the network.

## Prerequisites

* Running Aztec local network (see [Quickstart](/developers/getting_started_on_local_network.md)) on port 8080
* Node.js installed
* TypeScript project set up

## Install dependencies

```bash
yarn add @aztec-labs/aztec.js@6.0.0 @aztec-labs/accounts@6.0.0 @aztec-labs/wallets@6.0.0
```

## Connect to the network

Create a node client and EmbeddedWallet to interact with the local network:

```typescript
import { createAztecNodeClient, waitForNode } from "@aztec-labs/aztec.js/node";
import { EmbeddedWallet } from "@aztec-labs/wallets/embedded";
import { getInitialTestAccountsData } from "@aztec-labs/accounts/testing";

const nodeUrl = process.env.AZTEC_NODE_URL ?? "http://localhost:8080";
const node = createAztecNodeClient(nodeUrl);

// Wait for the network to be ready
await waitForNode(node);

// Create an EmbeddedWallet connected to the node
const wallet = await EmbeddedWallet.create(node, { ephemeral: true });
```

> [Source code: docs/examples/ts/aztecjs\_connection/index.ts#L1-L14](https://github.com/aztec-labs-eng/aztec-node/blob/v6.0.0/docs/examples/ts/aztecjs_connection/index.ts#L1-L14)

About EmbeddedWallet

`EmbeddedWallet` is a simplified wallet for local development that implements the same `Wallet` interface used in production. It handles key management, transaction signing, and proof generation in-process without external dependencies.

**Why use it for testing?** It starts instantly, requires no setup, and provides deterministic behavior—ideal for automated tests and rapid iteration.

**Production wallets** (like browser extensions or mobile apps) implement the same interface but store keys securely, may require user confirmation for transactions, and typically run in a separate process. Code written against `EmbeddedWallet` works with any `Wallet` implementation, so your application logic transfers directly to production.

### Verify the connection

Get node information to confirm your connection:

```typescript
const nodeInfo = await node.getNodeInfo();
console.log("Connected to local network version:", nodeInfo.nodeVersion);
console.log("Chain ID:", nodeInfo.l1ChainId);
```

> [Source code: docs/examples/ts/aztecjs\_connection/index.ts#L16-L20](https://github.com/aztec-labs-eng/aztec-node/blob/v6.0.0/docs/examples/ts/aztecjs_connection/index.ts#L16-L20)

### Load pre-funded accounts

The local network has accounts pre-funded with fee juice to pay for gas. Register them in your wallet:

```typescript
const testAccounts = await getInitialTestAccountsData();
const [aliceAddress, bobAddress] = await Promise.all(
  testAccounts.slice(0, 2).map(async (account) => {
    return (
      await wallet.createSchnorrInitializerlessAccount(
        account.secret,
        account.salt,
        account.signingKey,
      )
    ).address;
  }),
);

console.log(`Alice's address: ${aliceAddress.toString()}`);
console.log(`Bob's address: ${bobAddress.toString()}`);
```

> [Source code: docs/examples/ts/aztecjs\_connection/index.ts#L22-L38](https://github.com/aztec-labs-eng/aztec-node/blob/v6.0.0/docs/examples/ts/aztecjs_connection/index.ts#L22-L38)

These accounts are pre-funded with fee juice (the native gas token) at genesis, so you can immediately send transactions without needing to bridge funds from L1.

### Check fee juice balance

Verify that an account has fee juice for transactions:

```typescript
import { getFeeJuiceBalance } from "@aztec-labs/aztec.js/utils";

const aliceBalance = await getFeeJuiceBalance(aliceAddress, node);
console.log(`Alice's fee juice balance: ${aliceBalance}`);
```

> [Source code: docs/examples/ts/aztecjs\_connection/index.ts#L40-L45](https://github.com/aztec-labs-eng/aztec-node/blob/v6.0.0/docs/examples/ts/aztecjs_connection/index.ts#L40-L45)

## Next steps

* [Create an account](/developers/docs/aztec-js/how_to_create_account.md) - Deploy new accounts on the network
* [Deploy a contract](/developers/docs/aztec-js/how_to_deploy_contract.md) - Deploy your smart contracts
* [Send transactions](/developers/docs/aztec-js/how_to_send_transaction.md) - Execute contract functions
