scallop-crypto-keyslisted
Install: claude install-skill scallop-io/scallop-skills
# Cryptographic Keys
Generate, import, and manage Ed25519 keypairs for Sui transactions.
## Overview
The SDK provides `SuiKeypair` for Ed25519 key management. It handles key generation, multiple import formats, address derivation, and transaction signing.
## Generate a New Keypair
```python
from sui_scallop_sdk import SuiKeypair
keypair = SuiKeypair.generate()
print(f"Address: {keypair.address}")
print(f"Public Key (base64): {keypair.public_key_base64}")
print(f"Private Key (hex): {keypair.private_key.hex()}")
```
## Import Existing Keys
### From Bech32 (Sui Wallet Format)
The standard format exported by Sui wallets (`suiprivkey1...`):
```python
keypair = SuiKeypair.from_bech32("suiprivkey1qp...")
print(f"Address: {keypair.address}")
```
### From Hex
```python
# With or without 0x prefix
keypair = SuiKeypair.from_hex("0x1a2b3c4d...")
keypair = SuiKeypair.from_hex("1a2b3c4d...")
```
### From Base64
Supports multiple lengths:
- 32 bytes: raw private key
- 33 bytes: scheme flag (0x00) + private key
- 64 bytes: full keypair (private + public)
```python
keypair = SuiKeypair.from_base64("Gis7ChsKBwQ...")
```
### From Raw Bytes
```python
private_key_bytes = bytes.fromhex("1a2b3c4d" * 8) # 32 bytes
keypair = SuiKeypair(private_key_bytes)
```
## Properties
```python
keypair.private_key # bytes: 32-byte raw private key
keypair.public_key # bytes: 32-byte Ed25519 public key
keypair.public_key_base64 # str: base64-encoded with 0x00 scheme prefix
keypair.