Agent skill
sui-keypair-cryptography
Helps Claude Code understand Sui blockchain keypair and cryptography operations, providing guidelines and examples for key generation, signing, verification, address derivation, and multi-signature scheme support. Use when working with cryptography in Sui development or when the user mentions keypairs, cryptography, signing, or verification.
Install this agent skill to your Project
npx add-skill https://github.com/RandyPen/sui-eco-skills/tree/main/sui-keypair-cryptography
SKILL.md
Keypair and Cryptography Skill
Overview
The keypair and cryptography module provides secure cryptographic operations for the Sui blockchain ecosystem, including key generation, signing, verification, and address derivation. It supports multiple signature schemes and provides a unified interface for cryptographic operations.
Quick Start
Installation and Import
// Import Ed25519 keypair
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
// Import other signature schemes
import { Secp256k1Keypair } from '@mysten/sui/keypairs/secp256k1';
import { Secp256r1Keypair } from '@mysten/sui/keypairs/secp256r1';
// Import common utilities
import { mnemonicToSeed } from '@mysten/sui/cryptography';
// Note: generateMnemonic needs to be imported from @scure/bip39: import { generateMnemonic } from '@scure/bip39';
Basic Examples
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
import { Transaction } from '@mysten/sui/transactions';
// Generate new keypair
const keypair = new Ed25519Keypair();
// Get address
const address = keypair.toSuiAddress();
console.log('Address:', address);
// Sign transaction
const tx = new Transaction();
// ... build transaction
const bytes = await tx.build({ client });
const { signature } = await keypair.signTransaction(bytes);
// Verify signature
const isValid = await keypair.getPublicKey().verifyTransaction(bytes, signature);
console.log('Signature valid:', isValid);
Core Components
Signer Abstract Class
Location: https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/cryptography/keypair.ts
Signer is the abstract base class for all signing operations, providing:
- Message signing with intent scope
- Transaction signing and execution
- Personal message signing
- Address derivation from public key
Keypair Abstract Class
Location: https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/cryptography/keypair.ts
Keypair extends Signer, adding secret key management:
- Secret key serialization/deserialization
- Bech32 encoding for private keys
- Multiple signature scheme support
PublicKey Abstract Class
Location: https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/cryptography/publickey.ts
PublicKey is the base class for public key operations, providing:
- Address derivation and verification
- Signature verification
- Multiple encoding formats
- Intent-based verification
Supported Signature Schemes
For detailed information about supported signature schemes including Ed25519, Secp256k1, Secp256r1, and Passkey, see Signature Schemes.
Key Features
For detailed information about key features including intent-based signing, address derivation, and private key management, see Key Features.
Usage Patterns
For detailed information about usage patterns including key generation, signing, verification, and serialization, see Usage Patterns.
Architecture Notes
For detailed information about architecture notes including security design, intent system, and address generation, see Architecture Notes.
Integration Points
For detailed information about integration points including transaction integration, wallet integration, and blockchain operations, see Integration Points.
Advanced Features
For detailed information about advanced features including multi-signature support, hardware security, and key rotation, see Advanced Features.
Security Considerations
For detailed information about security considerations including key protection, signature security, and best practices, see Security Considerations.
Workflows
For detailed information about workflows including secure key generation, transaction signing, and key recovery, see Workflows.
Best Practices
For detailed information about best practices including key management, signing practices, and address handling, see Best Practices.
Related Skills
- sui-transaction-building: Understand the application of keypairs in transaction signing
- sui-bcs: Understand BCS serialization of public keys and signatures
- sui-client: Understand integration with SuiClient
References
- Source Code:
https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/cryptography/andhttps://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/keypairs/ - Test Cases:
https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/cryptography/__tests__/ - TypeScript Type Definitions:
https://github.com/MystenLabs/ts-sdks/tree/main/packages/typescript/src/cryptography/types.ts - Security Guidelines: Sui official security best practices documentation
This skill helps Claude Code understand Sui keypair and cryptography operations, providing practical code examples and usage guidelines. When users need to handle key management, signing, and verification for the Sui blockchain, referring to this skill can provide accurate TypeScript code and best practices.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
sui-transaction-building
Helps Claude Code understand Sui blockchain transaction building, providing guidelines and examples for Transaction class, commands, input types, gas configuration, and serialization. Use when building blockchain transactions on Sui or when the user mentions transaction building, Transaction class, or Move calls.
deepbook-trading
Helps Claude Code understand DeepBook V3 SDK usage for order book trading, flash loans, fund management, and market data queries on Sui blockchain. Use when operating DeepBook DEX, executing trading strategies, or querying market data.
working-with-ferra-dlmm
Helps developers work with the Ferra DLMM SDK for Discrete Liquidity Market Maker operations on Sui blockchain. Provides guidance on SDK initialization, pair creation, liquidity management, token swaps, and position handling. Use when working with DLMM pairs, adding/removing liquidity, creating trading pairs, or performing token swaps in the ferra-sdks monorepo.
deepbook-margin-trading-skill
Guides developers through using DeepBook V3 Margin Trading SDK for leverage trading, borrowing, lending, liquidation operations, and risk management on Sui blockchain. Use when working with DeepBook margin trading, margin pools, margin managers, take profit/stop loss orders, or liquidation functionality.
sui-client
Interact with Sui blockchain using @mysten/sui SDK. Use when building transactions, reading chain data, or managing staking positions on Sui.
cetus-dlmm-interface
Enables Claude to effectively work with the Cetus Dynamic Liquidity Market Maker (DLMM) protocol on Sui blockchain. This skill provides comprehensive knowledge of the DLMM architecture, Move smart contracts, Rust SDK, and development workflows. Claude can assist with building, testing, and modifying DLMM contracts, creating swap simulations, implementing new features, and debugging protocol issues. The skill covers all 15 Move modules, multi-bin architecture, reward distribution, ACL system, and flash swap functionality. Trigger contexts include: working with Sui Move smart contracts for decentralized exchanges, implementing dynamic liquidity management, creating multi-bin AMM protocols, building swap simulations with Rust SDK, modifying DLMM protocol parameters, debugging pool operations, implementing reward systems, and working with Cetus DLMM interface codebase.
Didn't find tool you were looking for?