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

# Direct vs Amino Signing

> The two Cosmos signing modes and how CosmJS chooses between them

Cosmos supports two signing modes. `SigningStargateClient` automatically picks
the right one based on the signer you provide.

## Direct (Protobuf)

The modern default. The transaction is serialized as Protobuf bytes, hashed with
SHA-256, and signed. This is the most compact encoding and supports all message
types.

* Wallet: `DirectSecp256k1HdWallet` from `@cosmjs/proto-signing`
* Interface: `OfflineDirectSigner` (has `signDirect` method)
* Sign mode: `SIGN_MODE_DIRECT`

EVM-compatible direct wallets (`DirectEthSecp256k1HdWallet`, `DirectEthSecp256k1Wallet`) use the same Direct sign doc and the same `SIGN_MODE_DIRECT`, but hash the serialized bytes with **Keccak-256** before signing to follow Ethereum conventions.

## Amino (JSON)

The legacy format. The transaction is serialized as deterministic JSON (sorted
keys, escaped special characters), hashed with SHA-256, and signed. Required for
Ledger hardware wallets and some older chains.

* Wallet: `Secp256k1HdWallet` from `@cosmjs/amino`
* Interface: `OfflineAminoSigner` (has `signAmino` method)
* Sign mode: `SIGN_MODE_LEGACY_AMINO_JSON`

## Automatic Detection

You don't need to choose manually. Pass any `OfflineSigner` to
`connectWithSigner` and the client determines the mode at signing time:

```typescript theme={"system"}
import { isOfflineDirectSigner } from "@cosmjs/proto-signing";

// The client checks internally:
// isOfflineDirectSigner(signer) ? signDirect(...) : signAmino(...)
```

If your signer implements both `signDirect` and `signAmino`, Direct signing
takes precedence.
