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

# Sei support on Turnkey

## Address derivation

Turnkey supports Sei address derivation. Sei is part of the Cosmos ecosystem and uses the bech32 address format with the `sei` prefix. Addresses are derived using the SECP256k1 curve.

## Transaction construction and signing

Since Sei is based on the Cosmos SDK, you can leverage our Cosmos support for transaction construction and signing:

* [`@turnkey/cosmjs`](https://www.npmjs.com/package/@turnkey/cosmjs): our CosmJS integration works with Sei as well, allowing you to use a `TurnkeyDirectWallet` as a drop-in replacement.

## Example

Here's a practical example showing how to use Turnkey with Sei for a complete transaction flow:

<CodeGroup>
  ```typescript example.ts [expandable] theme={"system"}
  import { Turnkey } from "@turnkey/sdk-server";
  import {
    SigningStargateClient,
    GasPrice,
    calculateFee,
  } from "@cosmjs/stargate";
  import { coins } from "@cosmjs/amino";

  // Import the initializeSeiSigner function from wallet.ts
  import { initializeSeiSigner } from "./wallet";

  // Initialize the Turnkey client
  const turnkeyClient = new Turnkey({
    apiBaseUrl: "https://api.turnkey.com",
    apiPrivateKey: process.env.API_PRIVATE_KEY,
    apiPublicKey: process.env.API_PUBLIC_KEY,
    defaultOrganizationId: process.env.ORGANIZATION_ID,
  });

  const signer = await initializeSeiSigner(turnkeyClient);

  // Connect to Sei network - use the appropriate endpoint for mainnet/testnet
  const rpcEndpoint = "https://sei-rpc.polkachu.com"; // Example RPC endpoint
  const client = await SigningStargateClient.connectWithSigner(
    rpcEndpoint,
    signer,
    {
      gasPrice: GasPrice.fromString("0.01usei"),
    }
  );

  const recipient = "sei1recipient..."; // Recipient address
  const amount = coins(1000000, "usei"); // 1 SEI
  const fee = calculateFee(200000, GasPrice.fromString("0.01usei"));

  const result = await client.sendTokens(
    signer.address,
    recipient,
    amount,
    fee,
    "Sent via Turnkey"
  );
  console.log("Transaction hash:", result.transactionHash);
  ```

  ```typescript wallet.ts [expandable] theme={"system"}
  import { type TurnkeyApiClient } from "@turnkey/sdk-server";
  import { TurnkeyDirectWallet } from "@turnkey/cosmjs";

  // Connect to Sei and initialize signer
  export async function initializeSeiSigner(turnkeyClient: TurnkeyApiClient) {
    // Create a Turnkey-powered Sei signer
    const signer = await TurnkeyDirectWallet.init({
      config: {
        client: turnkeyClient.apiClient(),
        organizationId: process.env.ORGANIZATION_ID,
        signWith: process.env.SEI_ADDRESS, // Your Sei address in Turnkey
      },
      prefix: "sei", // Using the Sei prefix
    });

    // Get the account details
    const accounts = await signer.getAccounts();
    const account = accounts[0];

    console.log("Sei signer address:", account.address);
    console.log("Public key:", account.pubkey);

    return signer;
  }
  ```
</CodeGroup>

## Sei network support

Turnkey supports:

* Sei Mainnet (Pacific-1)
* Sei Testnet (Atlantic-2)

## Key features for Sei

* **Cosmos SDK Compatibility**: Leverage the same tools used for Cosmos ecosystem
* **SECP256k1 Support**: Full support for Sei's cryptographic requirements
* **Flexible Signing**: Sign any Sei transaction format with Turnkey's signing API

## DApp integration

For DApp developers looking to integrate with Sei, you can use Turnkey as a secure key management solution and combine it with:

* [Sei.js](https://www.npmjs.com/package/@sei-js/core) - Official JavaScript library for Sei
* [CosmJS](https://github.com/cosmos/cosmjs) - Popular JavaScript client library for the Cosmos ecosystem

## Benefits of using Turnkey with Sei

* **Enhanced Security**: Private keys never leave Turnkey's secure infrastructure
* **Simplified Key Management**: No need to manage private keys in your application
* **Policy Control**: Apply transaction policies to control what can be signed
* **Multi-environment Support**: Use the same code across testnet and mainnet

If you're building on Sei and need assistance with your Turnkey integration, feel free to contact us at [hello@turnkey.com](mailto:hello@turnkey.com), on [X](https://x.com/turnkeyhq/), or [on Slack](https://join.slack.com/t/clubturnkey/shared_invite/zt-3aemp2g38-zIh4V~3vNpbX5PsSmkKxcQ).
