시작하기
Beatoz 블록체인에서 개발을 시작하는 방법을 알아보세요.
1
SDK 설치
@beatoz/web3 패키지를 프로젝트에 설치합니다.
# npm
npm install @beatoz/web3
# yarn
yarn add @beatoz/web3
# pnpm
pnpm add @beatoz/web32
Web3 인스턴스 생성
Beatoz 네트워크에 연결하기 위한 Web3 인스턴스를 생성합니다.
import { Web3 } from '@beatoz/web3';
// Testnet 연결
const web3 = new Web3('https://rpc-testnet0.beatoz.io');
// 연결 확인
const status = await web3.beatoz.status();
console.log('Network:', status.node_info.network);3
계정 생성
트랜잭션을 보내기 위한 계정을 생성합니다.
// 새 계정 생성
const account = web3.beatoz.accounts.create();
console.log('Address:', account.address);
console.log('Private Key:', account.privateKey);
// 기존 개인키로 계정 가져오기
// const account = web3.beatoz.accounts.privateKeyToAccount('0x...');