# buildIdentityTxn

> Build an identity transaction for wallet ownership proof.

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

```ts
export function buildIdentityTxn(
  address: string,
  genesisHashB64: string,
  ts?: number
): algosdk.Transaction;
```

Build an identity transaction for wallet ownership proof.

Constructs an unsubmitted zero-amount payment transaction where sender and receiver
are the payer address, flat fee is 0, firstValid is 1, and lastValid is 1000.
The note field contains `x402-identity:<address>:<unix_timestamp>`.

Because valid rounds are set to 1-1000 and fee is 0, this transaction cannot be executed
or replayed on chain; it serves purely as an off-chain cryptographic signature proof.

## Parameters

- `address` (`string`, required):
Algorand address proving ownership.

- `genesisHashB64` (`string`, required):
Network genesis hash as a base64-encoded string.

- `ts` (`number`):
Optional Unix timestamp in seconds (defaults to current time).

## Returns

- `returns` (`algosdk.Transaction`):
Algorand Transaction instance ready for signing.

## Example

```ts
const txn = buildIdentityTxn(activeAddress, MAINNET.genesisHash);
const signed = await signTransactions([algosdk.encodeUnsignedTransaction(txn)], [0]);
const header = encodeIdentityHeader(signed[0]!);
```

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

Source: https://x402-avm.github.io/reference/js/build-identity-txn
