# sign_identity_txn

> Create and sign an identity proof transaction, returning the X-Identity-Txn header.

```python
from ai_economy_sdk import sign_identity_txn
```

```python
def sign_identity_txn(
    private_key: str,
    genesis_hash_b64: str,
    ts: int | None = None,
) -> dict[str, str]
```

Create and sign an identity proof transaction, returning the X-Identity-Txn header.

Constructs a zero-amount self-payment transaction containing the timestamped
identity note and signs it with the provided private key.

## Parameters

- `private_key` (`str`, required):
Base64-encoded Algorand private key of the sender.

- `genesis_hash_b64` (`str`, required):
Base64-encoded genesis hash of the network against which identity is proven.

- `ts` (`int | None`, default `None`):
Unix timestamp (seconds) embedded in the identity note. Defaults to current time.

## Returns

- `returns` (`dict[str, str]`):
Single-entry dictionary `{"X-Identity-Txn": "<base64 msgpack-encoded signed txn>"}`.

## Examples

```python
>>> from algosdk import account
>>> from ai_economy_sdk.identity import sign_identity_txn
>>> sk, _ = account.generate_account()
>>> hdrs = sign_identity_txn(sk, "wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=")
>>> "X-Identity-Txn" in hdrs
True
```

## See also

- `verify_identity_txn`: Server-side verification function.
- `sign_identity`: Legacy three-header signing mechanism.

Source: [ai_economy_sdk/identity.py](https://github.com/x402-avm/ai-economy-sdk/blob/main/ai_economy_sdk/identity.py#L131)

Source: https://x402-avm.github.io/reference/python/ai-economy-sdk/sign-identity-txn
