Skip to main content

Blueprint SDK overview

Summary: In previous steps we installed and configured all tools required for TON smart contract development and created our first project template.

Before we proceed to actual smart contract development let's briefly describe project structure and explain how to use Blueprint SDK.

Project structure

warning

If you didn't choose proposed names in previous steps, source code file names and some of the in-code entities may differ.

Project structure
Example/
├── contracts/ # Folder containing smart contracts code
│ ├── imports/ # Library imports for contracts
│ │ └── stdlib.fc # Standard library for FunC
│ └── hello_world.fc # Main contract file
├── scripts/ # Deployment and on-chain interaction scripts
│ ├── deployHelloWorld.ts # Script to deploy the contract
│ └── incrementHelloWorld.ts # Script to interact with the contract
├── tests/ # Test folder for local contract testing
│ └── HelloWorld.spec.ts # Test specifications for the contract
└── wrappers/ # TypeScript wrappers for contract interaction
├── HelloWorld.ts # Wrapper class for smart contract
└── HelloWorld.compile.ts # Script for contract compilation

/contracts

This folder contains your smart contract source code written in one of the available programming languages used for TON Blockchain smart contract development.

/wrappers

To interact with your smart contract off-chain you need to serialize and desirialize messages sended to it. Wrapper classes developed to mirror your smart contract implementation making it simple to use it's functionality.

/tests

This directory contains test files for your smart contracts. Testing contracts directly in TON network is not the best option because deployment requires some amount of time and may lead to losing funds. This testing playground allow you to execute multiple smart contracts and even send messages between them in your "local network". Tests are crucial for ensuring your smart contracts behave as expected before deployment to the network.

/scripts

The scripts directory contains TypeScript files that help you deploy and interact with your smart contracts on-chain using previously implemented wrappers.

Development flow

Almost any smart contract project development consist of five simple steps:

  1. Edit smart contract code in /contracts folder and build it by running build script:
npx blueprint build
  1. Update smart contract wrapper in /wrapper folder corresponding to changes in contract.
  2. Update test's in /tests folder to ensure correctness of new functionality and run test script:
npx blueprint test
  1. Repeat steps 1-3 until you get desired result.

  2. Update deployment script in /scripts folder and run it using this command:

npx blueprint run
tip

All examples in this guide follow sequnce of this 1-3 steps with corresponding code samples. Step 5, deployment process, is covered in last section of the guide: Deploying to network.

Also, you can always generate same structure for another smart contract if, for example, you want to create multiple contracts interacting with each other, by using following command:

npx blueprint create PascalCase #dont forget to name contract in PascalCase
Was this article useful?