첫 USDT0 보내기
Stable에서 USDT0는 체인의 네이티브 자산이자 ERC-20 토큰입니다. 이는 표준 가치 전송과 함께 approve, transferFrom, permit가 완전히 사용 가능하며, 두 경로 모두 동일한 기본 잔액에서 자금을 이동시킨다는 것을 의미합니다.
이 페이지에서는 두 경로를 통해 USDT0를 보내고 두 방식이 하나의 잔액에서 인출됨을 확인하는 과정을 안내합니다.
무엇을 만들 것인가
0.001 USDT0를 네이티브 전송으로 보내고, 0.001 USDT0를 ERC-20 전송으로 보낸 다음, 두 잔액을 모두 출력하는 2개의 스크립트 흐름입니다.
데모
step 1. Connect wallet → balance displayed
0.01 USDT0
step 2. Send 0.001 USDT0 (choose native or ERC-20 transfer)
step 3. Result
Sent: 0.001 USDT0
Gas fee: 0.000021 USDT0
Native balance: 0.008979 USDT0
ERC-20 balance: 0.008979 USDT0사전 준비물
- Node.js 20 이상
- 테스트넷 USDT0가 있는 프라이빗 키. 지갑에 자금을 충전하려면 빠른 시작을 참조하세요.
- 메인넷:
0x779ded0c9e1022225f8e0630b35a9b54be713736 - 테스트넷:
0x78cf24370174180738c5b8e352b6d14c83a6c9a9
설정
// 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 USDT0_ADDRESS = "0x78Cf24370174180738C5B8E352B6D14c83a6c9A9";
export const provider = new ethers.JsonRpcProvider(STABLE_TESTNET_RPC);
export const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);옵션 1 (권장): 네이티브 전송으로 보내기
네이티브 전송은 Ethereum에서 ETH를 보내는 것과 동일하게 작동합니다. value 필드가 USDT0 금액을 담습니다. 네이티브 전송은 21,000 가스만 소모하며, USDT0를 보내는 가장 저렴한 방법입니다.
// sendNative.ts
import { ethers } from "ethers";
import { provider, wallet } from "./config";
const recipient = "0xRecipientAddress";
const amount = ethers.parseUnits("0.001", 18); // 18 decimals for 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("Native transfer tx:", receipt!.hash);npx tsx sendNative.tsNative transfer tx: 0x8f3a...2d41옵션 2: ERC-20 전송으로 보내기
USDT0는 ERC-20 전송으로도 보낼 수 있습니다. 이는 동일한 잔액에서 차감되지만, 6 소수점 정밀도를 가진 ERC-20 인터페이스를 사용합니다.
// sendERC20.ts
import { ethers } from "ethers";
import { wallet, USDT0_ADDRESS } from "./config";
const recipient = "0xRecipientAddress";
const amount = ethers.parseUnits("0.001", 6); // 6 decimals for ERC-20
const usdt0 = new ethers.Contract(USDT0_ADDRESS, [
"function transfer(address to, uint256 amount) returns (bool)"
], wallet);
const tx = await usdt0.transfer(recipient, amount);
const receipt = await tx.wait(1);
console.log("ERC-20 transfer tx:", receipt!.hash);npx tsx sendERC20.tsERC-20 transfer tx: 0xa2b1...77c0통합 잔액 확인
두 전송 중 어느 것이든 후에, 두 잔액을 조회하여 동일한 출처에서 인출되는지 확인하세요.
// balances.ts
import { ethers } from "ethers";
import { provider, wallet, USDT0_ADDRESS } from "./config";
const nativeBalance = await provider.getBalance(wallet.address);
console.log("Native balance:", ethers.formatEther(nativeBalance), "USDT0");
const usdt0 = new ethers.Contract(USDT0_ADDRESS, [
"function balanceOf(address) view returns (uint256)"
], provider);
const erc20Balance = await usdt0.balanceOf(wallet.address);
console.log("ERC-20 balance:", ethers.formatUnits(erc20Balance, 6), "USDT0");npx tsx balances.tsNative balance: 0.008979 USDT0
ERC-20 balance: 0.008979 USDT0두 값은 동일한 잔액을 나타냅니다. 소수점 잔액 조정으로 인해 최대 0.000001 USDT0까지 차이가 날 수 있습니다.
다음 권장 사항
- 가스 제로 트랜잭션 — 가스 비용을 면제 서비스가 지불하는 방식으로 USDT0를 보냅니다.
- P2P 결제 앱 만들기 — 지갑 생성, 전송, 수신 및 결제 내역 조회를 구현합니다.
- Stable에서의 USDT0 동작 — 이중 역할 잔액 조정과 컨트랙트 설계를 이해합니다.

