Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

빠른 시작

필요한 도구는 Node.js, 포셋에서 받은 USDT0, 그리고 개인 키뿐입니다. Stable은 USDT0를 가스 토큰으로 사용하므로, 트랜잭션을 처리하는 데 USDT0만 있으면 됩니다. 별도로 충전해야 할 가스 자산은 없습니다.

사전 준비

  • Node.js 20 이상
  • 직접 관리하는 개인 키 (새로운 테스트 키도 괜찮습니다)

1. 설치 및 구성

프로젝트를 생성하고, ethers를 설치한 후, 테스트넷 구성을 저장하세요.

mkdir stable-quickstart && cd stable-quickstart
npm init -y && npm install ethers
added 1 package, audited 2 packages in 1s

개인 키를 .env에 저장하세요:

echo "PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE" > .env

config.ts를 생성하세요:

// config.ts
import { ethers } from "ethers";
import "dotenv/config";
 
export const STABLE_TESTNET_RPC = "https://rpc.testnet.stable.xyz";
export const CHAIN_ID = 2201;
 
export const provider = new ethers.JsonRpcProvider(STABLE_TESTNET_RPC);
export const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);

2. 지갑에 자금 충전

주소를 출력한 다음, 포셋에서 테스트넷 USDT0를 요청하세요.

// address.ts
import { wallet } from "./config";
 
console.log("Wallet address:", wallet.address);
npx tsx address.ts
Wallet address: 0x1234...abcd

https://faucet.stable.xyz로 이동하여 주소를 붙여넣고, 버튼을 선택하여 테스트넷 USDT0를 받으세요. 포셋은 1 USDT0를 전송하며, 이는 수천 건의 네이티브 전송에 충분합니다.

3. 첫 트랜잭션 전송

0.001 USDT0를 네이티브로 전송하세요. Stable에서 USDT0는 네이티브 자산이므로, 간단한 값 전송이 가장 저렴한 경로입니다(21,000 가스).

// send.ts
import { ethers } from "ethers";
import { provider, wallet } from "./config";
 
const recipient = "0xRecipientAddress"; // replace with any address
const amount = ethers.parseEther("0.001"); // 0.001 USDT0 (18 decimals, native)
 
const block = await provider.getBlock("latest");
const baseFee = block!.baseFeePerGas!;
 
const tx = await wallet.sendTransaction({
  to: recipient,
  value: amount,
  maxFeePerGas: baseFee * 2n,
  maxPriorityFeePerGas: 0n, // always 0 on Stable
});
 
const receipt = await tx.wait(1);
console.log("Tx:", receipt!.hash);
console.log("Explorer:", `https://testnet.stablescan.xyz/tx/${receipt!.hash}`);
npx tsx send.ts
Tx: 0x8f3a...2d41
Explorer: https://testnet.stablescan.xyz/tx/0x8f3a...2d41

익스플로러 링크를 열어 트랜잭션을 확인하세요. 블록 생성 시간은 약 0.7초이므로, 이미 최종 확정되었을 것입니다.

다음 단계