Creating Your First Smart Contract on TON Blockchain: A Step-by-Step Guide
Creating your first smart contract on the TON (The Open Network) Blockchain involves several steps. Here's a step-by-step guide to help you get started:
Step 1: Set Up Your Development Environment
npm install -g tondev
tondev start
Step 2: Create a Smart Contract Template
mkdir ton-smart-contract
cd ton-smart-contract
tondev sol create contract
This will create a new Solidity contract template in your directory.
Step 3: Write Your Smart Contract
pragma solidity >= 0.6.0;
contract SimpleStorage {
uint256 storedData;
function set(uint256 x) public {
storedData = x;
}
function get() public view returns (uint256) {
return storedData;
}
}
Step 4: Compile Your Smart Contract
tondev sol compile contract.sol
This will generate ABI and TVC files needed for deployment.
Step 5: Deploy Your Smart Contract
tondev contract deploy Wallet
tondev contract deploy contract --abi ./SimpleStorage.abi.json --tvc ./SimpleStorage.tvc
Step 6: Interact with Your Smart Contract
tondev contract run contract set --abi ./SimpleStorage.abi.json --input '{"x": 12}'
tondev contract run-local contract get --abi ./SimpleStorage.abi.json
Step 7: Verify the Deployment
Step 8: Further Steps
By following these steps, you will have successfully created, deployed, and interacted with your first smart contract on the TON Blockchain.
Happy coding !
Backend Developer | NodeJS
1yسلام. وقتی ی کانترکت دیپلوی شد و بخواهیم مدیریت یه سری فانکشن ها مثل توکن سوزی توسط اونر انجام بشه باید ی اپ مجزا برای اون دولپ بشه؟
Backend Developer | NodeJS
1yKasra Khatamiداخل داکیومنت رسمی ton منظورم هست: https://docs.ton.org/develop/smart-contracts/examples من تازه وارد پیاده سازی کانترکت ها شدم و بک گروندی ندارم. برای توسعه tact و func معرفی کردن . فقط میخواستم اگه میشه یه سری لینک پروژه پیاده سازی کانترکت هس بهم معرفی کنید. چون نمیدونم راه رو دارم درست میرم یا نه. ممنون.
Backend Developer | NodeJS
1yممنون از اشتراک گذاری. توی داکیومنت از فانسی بجای سالیدیتی برای توسعه معرفی کرده. میشه ی سری پروژه واقعی برای ایجاد قرارداد هوشمند تو این شبکه معرفی کنید؟