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: 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:

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);

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 - Official JavaScript library for Sei
  • 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, on X, or on Slack.