지갑 생성하기
Stable 지갑은 이더리움 표준 키 쌍입니다. EVM 계정을 생성하는 모든 지갑 라이브러리는 수정 없이 Stable에서 작동합니다. 이 가이드에서는 두 가지 경로를 소개합니다: 대부분의 애플리케이션을 위한 ethers.js, 그리고 에이전트와 결제를 위한 턴키 방식의 자가 수탁(self-custody) 계층을 원하는 통합을 위한 Tether의 WDK (Wallet Development Kit)입니다.
사전 준비 사항
- Node.js 20 이상.
옵션 1: ethers.js
라이브러리를 설치하고 키 쌍을 생성합니다.
npm install ethers// wallet.ts
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://rpc.testnet.stable.xyz");
/** Create a new wallet for a new user. */
export function createWallet() {
const wallet = ethers.Wallet.createRandom(provider);
return {
wallet,
address: wallet.address,
seedPhrase: wallet.mnemonic!.phrase, // show to the user once for backup
};
}
/** Restore a wallet from a seed phrase (returning user). */
export function restoreWallet(seedPhrase: string) {
const wallet = ethers.Wallet.fromPhrase(seedPhrase, provider);
return { wallet, address: wallet.address };
}
if (import.meta.url === `file://${process.argv[1]}`) {
const { address, seedPhrase } = createWallet();
console.log("Address: ", address);
console.log("Seed phrase:", seedPhrase);
}npx tsx wallet.tsAddress: 0xAlice...1234
Seed phrase: liberty shoot ... (12 words)옵션 2: Tether WDK
WDK는 키 파생, 서명, 트랜잭션 제출을 하나의 인터페이스로 감쌉니다. 일반적인 계정 흐름을 재구현하지 않고 자가 수탁을 원할 때 적합한 선택이며, 에이전트 결제를 위한 x402와 직접 통합됩니다.
npm install @tetherto/wdk @tetherto/wdk-wallet-evm// wallet-wdk.ts
import WDK from "@tetherto/wdk";
import WalletManagerEvm from "@tetherto/wdk-wallet-evm";
function initWdk(seedPhrase: string) {
return new WDK(seedPhrase)
.registerWallet("stable", WalletManagerEvm, {
provider: "https://rpc.testnet.stable.xyz",
});
}
/** Create a new wallet for a new user. */
export async function createWallet() {
const seedPhrase = WDK.getRandomSeedPhrase();
const wdk = initWdk(seedPhrase);
const account = await wdk.getAccount("stable", 0);
return {
account,
address: await account.getAddress(),
seedPhrase, // show to the user once for backup
};
}
/** Restore a wallet from a seed phrase (returning user). */
export async function restoreWallet(seedPhrase: string) {
const wdk = initWdk(seedPhrase);
const account = await wdk.getAccount("stable", 0);
return { account, address: await account.getAddress() };
}npx tsx wallet-wdk.tsAddress: 0xAlice...1234
Seed phrase: liberty shoot ... (12 words)지갑에 자금 충전하기
지갑이 트랜잭션을 처리하려면 가스용 USDT0가 필요합니다. 테스트넷에서는 포셋에 요청하세요:
open https://faucet.stable.xyz주소를 붙여넣고 버튼을 선택해 1 테스트넷 USDT0(수천 건의 네이티브 전송에 충분한 양)를 받으세요. 메인넷의 경우, 지원되는 거래소나 브리지에서 USDT0를 전송하세요. Stable로 브리징하기를 참조하세요.
잔액 확인하기
네이티브 USDT0는 18자리 소수를 사용합니다. 네이티브 잔액이 가스가 지불되는 잔액입니다.
// balance.ts
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://rpc.testnet.stable.xyz");
const balance = await provider.getBalance("0xYourAddress");
console.log("Balance:", ethers.formatEther(balance), "USDT0");npx tsx balance.tsBalance: 1.0 USDT0다음 권장 단계
- EIP-7702로 위임하기 — 이 지갑에 일괄 결제, 지출 한도, 세션 키를 추가하세요.
- 첫 USDT0 보내기 — 동일한 잔액에서의 네이티브 및 ERC-20 전송.
- 테스트넷 지갑에 자금 충전하기 — 더 큰 테스트 잔액을 위한 포셋 및 Sepolia 브리지 옵션.

