Quick Start

Step 1: Henesis CLI ์„ค์น˜ํ•˜๊ธฐ

Henesis CLI ์„ค์น˜โ€Œ

npm install -g @haechi-labs/henesis-cli

Henesis ๊ณ„์ •์œผ๋กœ ๋กœ๊ทธ์ธ

henesis login

Step 2: ์ƒ˜ํ”Œ ์ฝ”๋“œ ๊ฐ€์ ธ์˜ค๊ธฐ

Sample Repository๋ฅผ ํ†ตํ•ด ์–ด๋–ป๊ฒŒ Henesis๋กœ ๋ธ”๋ก์ฒด์ธ ๋ฐ์ดํ„ฐ๋ฅผ ์œ ์‹ค์—†์ด ๊ตฌ๋…ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

Sample Repository ๊ฐ€์ ธ์˜ค๊ธฐ

git clone https://github.com/HAECHI-LABS/sample-erc20-watcher

Sample ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™

cd sample-erc20-watcher

dependency ์„ค์น˜

npm install

Step 3: ๋ธ”๋ก์ฒด์ธ ๋ฐ์ดํ„ฐ ํ•„ํ„ฐ ๋“ฑ๋กํ•˜๊ธฐ

Henesis๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ธ”๋ก์ฒด์ธ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์œ ์‹ค์—†์ด ๊ตฌ๋…ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์–ด๋–ค ์ปจํŠธ๋ž™ํŠธ์˜ ์ด๋ฒคํŠธ๋ฅผ ๋“ค์„ ๊ฒƒ์ธ์ง€ ํ•„ํ„ฐ์— ๊ธฐ๋กํ•˜๋Š” ๊ณผ์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ํ•„ํ„ฐ ๋“ฑ๋ก์€ henesis.yaml ์„ ํ†ตํ•ด ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ƒ˜ํ”Œ ์ฝ”๋“œ์—์„œ๋Š” ์ด๋”๋ฆฌ์›€ ๋ฉ”์ธ๋„ท์— ๋ฐฐํฌ๋˜์–ด ์žˆ๋Š” TetherToken ์ปจํŠธ๋ž™ํŠธ์˜ ์ด๋ฒคํŠธ๋ฅผ ๊ตฌ๋…ํ•˜๋Š” ๊ฒƒ์„ ํ†ตํ•ด Henesis ์‚ฌ์šฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

henesis.yaml
name: tether-tutorial
version: v1 # (TBD) The version of this yaml file.
apiVersion: v1 # (TBD) The version of Henesis api. The type of message you receive can be changed depending on this version.
โ€‹
blockchain:
platform: ethereum
network: mainnet
threshold: 6 # optional.
# ethereum: (default: 12, min: 6)
# klaytn: (default: 0, min: 0)
โ€‹
filters:
contracts:
- address: '0xdac17f958d2ee523a2206206994597c13d831ec7'
name: TetherToken
files: # The events of the contracts listed below can be combined together at this address.
- path: ./contracts/TetherToken.sol
contractName: TetherToken
compilerVersion: 0.4.18
โ€‹
provider:
type: webSocket

Step 4: Integration ๋ฐฐํฌํ•˜๊ธฐ

CLI์˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด integration์„ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

henesis integration:deploy

์„ฑ๊ณต์ ์œผ๋กœ integration์ด ๋ฐฐํฌ๋˜์—ˆ๋‹ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‚ด์šฉ์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

Deploying... !
tether-tutorial-jrweu has been deployed
Deploying... done

CLI์˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด integration์˜ ์ƒํƒœ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, State๊ฐ€ Available๋กœ ํ‘œ์‹œ๋˜์—ˆ์œผ๋ฉด ์ •์ƒ์ ์œผ๋กœ integration์ด ๋ฐฐํฌ๋œ ์ƒํƒœ์ž…๋‹ˆ๋‹ค.

henesis integration:status
Id Name Platform Network Version Provider State
tether-tutorial-jrweu tether-tutorial ethereum mainnet v1 webSocket Available

Step 5: Event ๋ฐ์ดํ„ฐ ํ™•์ธํ•˜๊ธฐ

ClientId ์™€ IntegrationId ํ™•์ธ ๋ฐ ์„ค์ •ํ•˜๊ธฐ

Henesis๋ฅผ ํ†ตํ•ด Event ๋ฐ์ดํ„ฐ๋ฅผ ๊ตฌ๋…ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ •๋ณด๋“ค์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

  • CLIENT_ID : henesis account:describe๋ฅผ ํ†ตํ•ด ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • INTEGRATION_ID : henesis integration:status๋ฅผ ํ†ตํ•ด ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ClientId๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ CLI ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

henesis account:describe
Email: haechi@haechi.io
Name: haechi
Organization: haechi-labs
ClientId: a481485a958f1b82ac210ec4eea27943

IntegrationId๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ CLI ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

henesis integration:status
Id Name Platform Network Version Provider State
tether-tutorial-jrweu tether-tutorial ethereum mainnet v1 webSocket Available

์„ค์ •ํŒŒ์ผ์ธ .env ์— CLI ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ํ™•์ธํ•œ ClientId์™€ IntegrationId๋ฅผ ๊ธฐ์ž…ํ•ด์ค๋‹ˆ๋‹ค.

.env
CLIENT_ID=<your client id>
INTEGRATION_ID=<your integration id>

์ƒ˜ํ”Œ ์ฝ”๋“œ ๋นŒ๋“œ ๋ฐ ์‹คํ–‰ํ•˜๊ธฐ

โ€‹npm์„ ํ†ตํ•ด ์†Œ์Šค ์ฝ”๋“œ๋ฅผ ๋นŒ๋“œํ•ด์ค๋‹ˆ๋‹ค.

$ npm run build:standalone

API ์„œ๋ฒ„๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$ node index

๋ธŒ๋ผ์šฐ์ €์—์„œ http://locahost:3000 ๋ฅผ ์ ‘์†ํ•ด Event ๋ฐ์ดํ„ฐ๋ฅผ ์ž˜ ๊ตฌ๋…ํ•˜๊ณ  ์žˆ์Œ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

๊ตฌ๋…ํ•˜๋Š” ๋ธ”๋ก์ฒด์ธ ๋ฐ์ดํ„ฐ์˜ raw data๋Š” ์—ฌ๊ธฐ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.