# networkFromAlgod

> Query an algod client for its current suggested transaction parameters and return its CAIP-2 identifier.

```ts
import { networkFromAlgod } from 'x402-avm-js';
```

```ts
export async function networkFromAlgod(algod: algosdk.Algodv2): Promise<string>;
```

Query an algod client for its current suggested transaction parameters and return its CAIP-2 identifier.

Works with any Algorand node, including LocalNet instances and private testnets where the genesis hash
cannot be known in advance.

## Parameters

- `algod` (`algosdk.Algodv2`, required):
Algodv2 client instance.

## Returns

- `returns` (`true`): ">
Promise resolving to the canonical CAIP-2 network identifier.

## Throws

- `X402AvmError`: If the algod node does not return a genesisHash (network errors from algod propagate unchanged).

## Example

```ts
const algod = algodClient('localnet');
const networkId = await networkFromAlgod(algod);
console.log(networkId); // 'algorand:' followed by the genesis hash, e.g. TestNet's CAIP-2 id
```

Source: [src/index.ts](https://github.com/x402-avm/x402-avm-js/blob/main/src/index.ts#L282)

Source: https://x402-avm.github.io/reference/js/network-from-algod
