gdex-wallet-setup
Generate EVM control wallets offline, create session keypairs, get wallet info — first step for users without wallets
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- gdex-wallet-setup
- description
- Generate EVM control wallets offline, create session keypairs, get wallet info — first step for users without wallets
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md346 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
GDEX: Wallet Setup
Generate EVM control wallets for new users and session keypairs for managed-custody trading. Wallet generation is fully offline — no network or auth required.
When to Use
- A user says they don't have a wallet
- Setting up a new user for the first time
- Generating session keypairs for managed-custody trading
- Querying wallet info on a specific chain
Prerequisites
npm install @gemachdao/gdex-skill
No authentication needed for wallet generation.
Generate an EVM Control Wallet
import { generateEvmWallet } from '@gemachdao/gdex-skill';
const wallet = generateEvmWallet();
console.log('Address:', wallet.address); // public — safe to display
console.log('Private Key:', wallet.privateKey); // SECRET — store securely
console.log('Mnemonic:', wallet.mnemonic); // SECRET — 12-word backup phrase
// wallet.type → 'evm'
// wallet.derivationPath → "m/44'/60'/0'/0/0"
Important:
- Works fully offline — no network or API calls
- The private key and mnemonic must be stored securely
- Never log, display in UI, or transmit the private key
- The EVM control wallet is all you need — after managed-custody sign-in, the backend provisions Solana + other chain wallets automatically
Generate a Session Keypair
Session keypairs (secp256k1) are used to sign trades after the initial control-wallet sign-in:
import { generateGdexSessionKeyPair } from '@gemachdao/gdex-skill';
const { sessionPrivateKey, sessionKey } = generateGdexSessionKeyPair();
// sessionPrivateKey: hex string (store securely, reuse across requests)
// sessionKey: compressed public key (0x + 66 hex chars)
Get Wallet Info
Managed-wallet native balance and token count on one chain. This is an
authenticated managed read (/v1/user + /v1/portfolio with userId, the
encrypted session data and chainId); GDEX has no address-only balance read:
import { GdexSkill, GDEX_API_KEY_PRIMARY } from '@gemachdao/gdex-skill';
const skill = new GdexSkill();
skill.loginWithApiKey(GDEX_API_KEY_PRIMARY);
const info = await skill.getWalletInfo({
walletAddress: '0xYourControlWallet', // the GDEX userId
sessionPrivateKey, // from sign-in (or pass `data`)
apiKey: GDEX_API_KEY_PRIMARY,
chain: 1, // Ethereum
});
MCP: get_wallet_info takes accountRef (from gdex_connect) instead of the raw keys.
Wallet Info Response
interface WalletInfo {
address: string; // managed trading wallet on this chain
userId: string; // control wallet
chain: number; // normalized numeric chain id
chainId: number;
nativeBalance: string; // whole units, approximate (backend float)
nativeSymbol: string; // 'ETH', 'SOL', 'SUI', etc.
precision: 'approximate';
totalValueUsd?: string;
tokenCount: number;
}
Full New User Onboarding Flow
import {
generateEvmWallet,
generateGdexSessionKeyPair,
buildGdexSignInMessage,
buildGdexSignInComputedData,
GdexSkill,
GDEX_API_KEY_PRIMARY,
} from '@gemachdao/gdex-skill';
// Step 1: Generate a control wallet (offline)
const wallet = generateEvmWallet();
console.log('Your new wallet address:', wallet.address);
// ⚠️ Tell user to save privateKey and mnemonic securely!
// Step 2: Generate session keypair
const { sessionPrivateKey, sessionKey } = generateGdexSessionKeyPair();
// Step 3: Initialize SDK
const skill = new GdexSkill();
skill.loginWithApiKey(GDEX_API_KEY_PRIMARY);
// Step 4: Build sign-in message and sign with the new wallet
const userId = wallet.address;
const nonce = String(Math.floor(Date.now() / 1000) + Math.floor(Math.random() * 1000));
const message = buildGdexSignInMessage(userId, nonce, sessionKey);
// For a generated wallet, sign directly with ethers:
import { ethers } from 'ethers';
const signer = new ethers.Wallet(wallet.privateKey);
const signature = await signer.signMessage(message);
// Step 5: Sign in via managed custody
const signInPayload = buildGdexSignInComputedData({
apiKey: GDEX_API_KEY_PRIMARY,
userId,
sessionKey,
nonce,
signature,
});
await skill.signInWithComputedData({
computedData: signInPayload.computedData,
chainId: 1, // EVM
}, { sessionPrivateKey }); // keeps the gdex_session cookie and signs /v1/user
// ✅ User is now authenticated and can trade
// The backend has provisioned Solana + other chain wallets automatically
Autonomous Agent Notes (Live-Tested)
generateEvmWallet()works fully offline (E2E verified). No network calls needed. Returns{ address, privateKey, mnemonic, type, derivationPath }.- After sign-in, the backend auto-provisions managed wallets on all chains. You only need one EVM control wallet.
- Store the mnemonic and private key securely. Loss = permanent loss of access.
- The session keypair is separate from the wallet. Generate it with
generateGdexSessionKeyPair()— it's used for signing trades, not wallet derivation. - Multiple sign-ins are fine. You can generate new session keys and re-sign-in at any time.
Related Skills
- gdex-authentication — Full managed-custody auth details
- gdex-onboarding — Platform overview for new users
- gdex-spot-trading — Start trading after wallet setup
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.