Wallet Quick Start
Create a wallet and send a transaction
Install
go get github.com/luxfi/sdk@latestCreate a Wallet
package main
import (
"context"
"fmt"
"github.com/luxfi/ids"
"github.com/luxfi/sdk/wallet"
"github.com/luxfi/sdk/crypto"
)
func main() {
// Create wallet for mainnet
w := wallet.New(1, ids.Empty)
// Generate a new key
addr, err := w.GenerateKey()
if err != nil {
panic(err)
}
fmt.Println("Address:", addr)
// Check balance
balance := w.GetBalance(luxAssetID)
fmt.Println("Balance:", balance)
}Import an Existing Key
import "github.com/luxfi/sdk/key"
// From mnemonic
mnemonic := []string{"word1", "word2", "..."}
privKey, _ := key.DeriveKey(mnemonic, 0)
addr, _ := w.ImportKey(privKey)Send a Transfer
// Build transfer (X-Chain UTXO style)
tx, err := w.CreateTransferTx(
recipientAddr, // ids.ShortID
assetID, // ids.ID
1000000, // 1 LUX on X-Chain (6 decimals)
[]byte("memo"),
)
if err != nil {
panic(err)
}
// Sign
err = w.Sign(context.Background(), tx)
if err != nil {
panic(err)
}Web Wallet
For browser-based access, visit wallet.lux.network:
- Create or import a wallet
- Select the target chain (P, X, or C)
- Enter recipient and amount
- Confirm the transaction