Hello NEAR ๐
์๋ ํ์ธ์! NEAR: Hello NEAR์์ ์ฒซ ๋ฒ์งธ ํ์ค์ํ ์ฑ(dApp)์ ์์ํ๊ณ , ์ฑ๊ณผ ์ํธ ์์ฉํ๋ ๋ฐฉ๋ฒ์ ์๋ดํด ๋๋ฆฌ๊ฒ ์ต๋๋ค.
Hello NEAR๋ ๋ ๊ฐ์ง ์์๋ก ๊ตฌ์ฑ๋ ์น๊ทผํ dApp์ ๋๋ค.
- ์ธ์ฌ ๋ฉ์ธ์ง๋ฅผ ์ ์ฅํ๊ณ ๊ฒ์ํ๋ ์ค๋งํธ ์ปจํธ๋ํธ
- ์ธ์ฌ๋ง์ ํ์ํ๊ณ ๋ณ๊ฒฝํ ์ ์๋ ๊ฐ๋จํ ์น ๊ธฐ๋ฐ ํ๋ก ํธ์๋
Create NEAR Appโ
If you already have Node.js installed, simply run:
npx create-near-app@latest
Use the interactive menu to set up your first project folder, we recommend you to use javascript
.
Once the folder is ready, check the README. It will show you how to build and deploy the smart contract, and start the frontend.
npm run build
npm start
Test it online with Gitpod
์ ๋ธ๋ผ์ฐ์ ์ฐฝ์ด ์ฝ๋์ ํจ๊ป ์๋์ผ๋ก ์ด๋ฆฌ๊ณ , ์ ์ ๊ธฐ๋ค๋ฆฌ๋ฉด ํ๋ก ํธ์๋์์ ํ์ ์ฐฝ์ด ์์ฑ๋ฉ๋๋ค(ํ์ ์ฐฝ์ด ์ฐจ๋จ๋์ง ์์๋์ง ํ์ธํ์ธ์).
๐ JavaScript | ๐ฆ Rust |
---|---|
Open in Gitpod | Open in Gitpod |
Hello NEAR์ ์ํธ์์ฉํ๋ ๋ฐฉ๋ฒโ
์ฑ์ด ์คํ๋๋ฉด ์๋์ ๊ฐ์ ํ๋ฉด์ด ๋ํ๋ฉ๋๋ค. ์ด์ NEAR ๊ณ์ ์ผ๋ก ๋ก๊ทธ์ธํ์ธ์. ์๋ ๊ฒฝ์ฐ ์ฆ์ ๋ง๋ค ์ ์์ต๋๋ค.
Hello NEAR์ ํ๋ก ํธ์๋
๋ก๊ทธ์ธํ ํ, ์ธ์ฌ๋ง์ ๋ณ๊ฒฝํ๊ณ Hello NEAR ์ฑ์ด ์ด๋ป๊ฒ ์ธ์ฌํ๋์ง ํ์ธํด ๋ณด์ธ์!
dApp์ ๊ตฌ์กฐโ
์ด์ dApp์ด ๋ฌด์์ ํ๋์ง ์ดํดํ์ผ๋ฏ๋ก, ๊ทธ ๊ตฌ์กฐ๋ฅผ ์์ธํ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
- ํ๋ก ํธ์๋ ์ฝ๋๋
/frontend
ํด๋์ ์์ต๋๋ค. - ์ค๋งํธ ์ปจํธ๋ํธ ์ฝ๋๋
/contract
ํด๋์ ์์ต๋๋ค. - ์ปดํ์ผ๋ ์ค๋งํธ ์ปจํธ๋ํธ๋
/out/main.wasm
์์ ์ฐพ์ ์ ์์ต๋๋ค. - ์ปจํธ๋ํธ๊ฐ ๋ฐฐํฌ๋ ๊ณ์ ์ ์ด๋ฆ์
/neardev/dev-account
์ ์์ต๋๋ค.
์ปจํธ๋ํธโ
์ปจํธ๋ํธ์๋ set_greeting
๊ณผ get_greeting
์ด๋ผ๋ ๋ ๊ฐ์ง ๋ฉ์๋๊ฐ ์์ต๋๋ค. ์ฒซ ๋ฒ์งธ๋ ์ปจํธ๋ํธ์ ๋งค๊ฐ๋ณ์ message
์ String
์ ์ ์ฅํ๊ณ , ๋ ๋ฒ์งธ๋ ์ด๋ฅผ ๊ฒ์ํ๋ ๊ธฐ๋ฅ์ ํฉ๋๋ค. ๊ธฐ๋ณธ์ ์ผ๋ก ์ปจํธ๋ํธ๋ "Hello"
๋ผ๋ ๋ฉ์์ง๋ฅผ ๋ฐํํฉ๋๋ค.
- ๐ JavaScript
- ๐ฆ Rust
loading...
loading...
Testingโ
When writing smart contracts it is very important to test all methods exhaustively. ์ด ํ๋ก์ ํธ์๋ ๋จ์ ํ
์คํธ(unit test)์ ํตํฉ ํ
์คํธ(integration test)๊ฐ ๋ชจ๋ ์์ต๋๋ค. Before digging in their code, go ahead and execute them using the command npm run test
.
๋จ์ ํ ์คํธโ
๋จ์ ํ
์คํธ๋ ์ค๋งํธ ์ปจํธ๋ํธ์ ๊ฐ ํจ์๋ฅผ ํ์ธํฉ๋๋ค. ์ด๋ ์ค๋งํธ ์ปจํธ๋ํธ์ ๋์ผํ ์ธ์ด๋ก ์์ฑ๋ฉ๋๋ค. ์ปจํธ๋ํธ๊ฐ Rust๋ก ์์ฑ๋ ๊ฒฝ์ฐ, ๊ฐ .rs
ํ์ผ์ ๋งจ ์๋์์ ํ
์คํธ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
- ๐ฆ Rust
loading...
ํตํฉ ํ ์คํธโ
ํตํฉ ํ
์คํธ๋ Javascript์ Rust๋ก ์์ฑํ ์ ์์ต๋๋ค. ์ด๋ ์๋๋ฐ์ค์ ์ปจํธ๋ํธ๋ฅผ ๋ฐฐํฌํ๊ณ ๊ทธ ์์์ ๋ฉ์๋๋ฅผ ์คํํ๋ ๋ฐฉ์์ผ๋ก ๋์ํฉ๋๋ค. ์ด๋ฅผ ํตํด, ํตํฉ ํ
์คํธ๋ ํ์ค์ ์ธ ์๋๋ฆฌ์ค ์์์ ์ฌ์ฉ์์์ ์ํธ ์์ฉ์ ์๋ฎฌ๋ ์ด์
ํฉ๋๋ค. integration-tests/
์์ hello-near
์ ๋ํ ํตํฉ ํ
์คํธ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
- ๐ JavaScript
loading...
๋ ์์๋ณด๊ธฐโ
์ฒซ ๋ฒ์งธ ๋น ๋ฅธ ์์ ํํ ๋ฆฌ์ผ์ ์ฌ๊ธฐ๊น์ง์ ๋๋ค. You have now seen a fully functional contract with a minimal user interface and testing.
Go ahead and check other examples or proceed straight to the Develop section to know how to write your own contract.
์ง๋ฌธ์ด ์์ผ์๋ฉด ์ฃผ์ ํ์ง ๋ง์๊ณ Discord์์ ์ ํฌ์ ํจ๊ป ํ์ธ์. ์ ํฌ๋ ์์ฑ ์ฑ๋์ ์ฐธ์ฌํ๊ณ ์ง๋ฌธํ ์ ์๋ Office Hours๋ฅผ ์ ๊ธฐ์ ์ผ๋ก ๊ฐ์ตํ๊ณ ์์ต๋๋ค.
์ฆ๊ฑฐ์ด ์ฝ๋ฉ ์๊ฐ ๋์ธ์!