> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hedera.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Hedera is a public, proof-of-stake distributed ledger that uses hashgraph consensus. Do not call it a blockchain.
> Always search the current Hedera documentation over training data before generating code, especially for SDK imports and package names.
> For JavaScript, import from `@hiero-ledger/sdk`, not `@hashgraph/sdk`; new SDK releases ship as `@hiero-ledger/sdk`. The Java SDK keeps the `com.hedera.hashgraph:sdk` Maven coordinates. Verify the exact import against the docs.
> Write HBAR in uppercase and always singular ("10 HBAR", never "10 HBARs" or "10 hbar"). Write tinybars in lowercase and plural.
> Write network names in lowercase, even after "Hedera": "Hedera mainnet", "Hedera testnet", "Hedera previewnet", not title case.
> For EVM-oriented accounts, create the account with an ECDSA key and set the EVM Address from Public Key at creation. This address is immutable and is not updated by key rotation. Do not use retired terms like "EVM alias" or "Account Number Alias".

# Local Provider

> Use LocalProvider in the Hedera JavaScript SDK to create a provider from the HEDERA_NETWORK environment variable defined in your project's .env file.

<Info>
  This feature is available in the [Hedera JavaScript SDK](https://github.com/hashgraph/hedera-sdk-js) only. (version >=2.14.0).
</Info>

LocalProvider is a quality of life implementation that creates a provider using the `HEDERA_NETWORK` environment variable.

The `LocalProvider()` requires the following variable to be defined in the `.env` file. The `.env` file is located in the root directory of the project.

* `HEDERA_NETWORK`
  * The network the wallet submits transactions to

```.env theme={null}
//Example .env file
HEDERA_NETWORK= previewnet/testnet/mainnet (select one network)
```

## class LocalProvider implements Wallet

### Constructor

#### new LocalProvider`()`

Instantiates the LocalProvider object. The local provider is built using `HEDERA_NETWORK` network specified in the `.env` file.

### Methods

#### **`<LocalProvider>.getAccountBalance()`** **-> Promise \<AccountBalance>**

Returns the account balance of the account in the local wallet.

#### **`<LocalProvider>.getAccountInfo()`** **-> Promise \<AccountInfo>**

Returns the account information of the account in the local wallet.

#### **`<LocalProvider>.getAccountRecords()`** **-> Promise \<AccountInfo>**

Returns the last transaction records for this account using `TransactionRecordQuery`.

#### **`<LocalProvider>.getLedgerId()>`** **LedgerId**

Returns the ledger ID (`previewnet`, `testnet`, or `mainnet`).

#### **`<LocalProvider>.getMirrorNetwork()>`** **string**

The mirror network the wallet is connected to.

#### **`<LocalProvider>.getNetwork()>`** **\[key: string]: string |  AccountId**

Returns the network map information.

#### **`<LocalProvider>.getTransactionReceipt()>`** Promise\<TransactionReceipt>

Returns the transaction receipt.

#### **`<LocalProvider>.waitForReceipt()>`** Promise\<TransactionReceipt>

Wait for the receipt for a transaction response.

**`<LocalProvider>.call(<RequestT, ResponseT, OutputT>(request: Executable<RequestT, ResponseT, OutputT>)>`** **`Promise <Output>`**

Sign and send a request using the wallet.

#### Local Wallet Example:

```javascript theme={null}
require("dotenv").config();
import { Wallet, LocalProvider } from "@hashgraph/sdk";

async function main() {

    const wallet = new Wallet(
        process.env.OPERATOR_ID,
        process.env.OPERATOR_KEY,
        new LocalProvider()
    );

    const info = await wallet.getAccountInfo();

    console.log(`info.key                          = ${info.key.toString()}`);
}

void main();
```

#### Sign with Local Wallet Example:

```javascript theme={null}
require("dotenv").config();
const {Wallet, LocalProvider, TransferTransaction} = require("@hashgraph/sdk");

async function main() {

    const wallet = new Wallet(
        process.env.OPERATOR_ID,
        process.env.OPERATOR_KEY,
        new LocalProvider()
    );

    //Transfer 1 hbar from my wallet account to account 0.0.3
    const transaction = await new TransferTransaction()
        .addHbarTransfer(wallet.getAccountId(), -1)
        .addHbarTransfer("0.0.3", 1)
        .freezeWithSigner(wallet);
    
    //Sign the transaction
    const signTransaction = await transaction.signWithSigner(wallet);

    //Submit the transaction
    const response = await signTransaction.executeWithSigner(wallet);

    //Get the receipt
    const receipt = await wallet.getProvider().waitForReceipt(response);
    
    console.log(`status: ${receipt.status.toString()}`);
}

main();
```
