Documentation
¶
Overview ¶
Package suiwallet: Ed25519-based wallet implementation with SUI blockchain address generation Provides wallet creation, signing, and verification operations using Ed25519 cryptography Generates blockchain addresses through Blake2b-256 hashing with scheme prefix Compatible with SUI blockchain wallet requirements and key management
suiwallet: 基于 Ed25519 的钱包实现,包含 SUI 区块链地址生成 提供使用 Ed25519 加密的钱包创建、签名和验证操作 通过带有方案前缀的 Blake2b-256 哈希生成区块链地址 与 SUI 区块链钱包要求和密钥管理兼容
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wallet ¶
type Wallet struct {
PrivateKey ed25519.PrivateKey // Ed25519 private key // Ed25519 私钥
PublicKey ed25519.PublicKey // Ed25519 public key // Ed25519 公钥
AuthKey [32]byte // Blake2b-256 hash of [0x00][public_key] // [0x00][公钥] 的 Blake2b-256 哈希
}
Wallet represents SUI blockchain wallet with Ed25519 key pair Contains private key, public key, and authentication key (address hash) Supports signing transactions and verifying signatures Reference implementation from github.com/ltp456/go-sui-sdk
Wallet 代表带有 Ed25519 密钥对的 SUI 区块链钱包 包含私钥、公钥和认证密钥(地址哈希) 支持签署交易和验证签名 参考实现来自 github.com/ltp456/go-sui-sdk
func NewWallet ¶
NewWallet creates a new wallet instance from 32-byte seed Accepts seed bytes and generates Ed25519 key pair Computes authentication key (address) through Blake2b-256 hashing Returns wallet instance or error if creation fails
NewWallet 从 32 字节种子创建新的钱包实例 接受种子字节并生成 Ed25519 密钥对 通过 Blake2b-256 哈希计算认证密钥(地址) 返回钱包实例,如果创建失败则返回错误
func NewWalletV2 ¶ added in v0.0.7
NewWalletV2 creates a new wallet from hex-encoded private key string Accepts hex string private key and decodes it to bytes Returns wallet instance or error if decode or creation fails
NewWalletV2 从十六进制编码的私钥字符串创建新钱包 接受十六进制字符串私钥并将其解码为字节 返回钱包实例,如果解码或创建失败则返回错误
func (*Wallet) Address ¶
Address returns the wallet address as hex string with 0x prefix Derives address from AuthKey (Blake2b-256 hash) Returns formatted address string
Address 返回带有 0x 前缀的十六进制字符串钱包地址 从 AuthKey(Blake2b-256 哈希)派生地址 返回格式化的地址字符串
func (*Wallet) Public ¶
Public returns the Ed25519 public key Returns public key bytes used in signatures
Public 返回 Ed25519 公钥 返回签名中使用的公钥字节