Develop a blueprint
Introduction
This article is the pathway for developers creating blueprints — the smart contract models that power nano contracts on Hathor.
By the end of this pathway you will have the resources to design, implement, test, and deploy a blueprint on Hathor Network, using the Python v3.11 blueprint SDK.
You must develop your blueprint using Python 3.11. Support for other Python versions and additional programming languages may be added in the future.
Prerequisites
- Python 3.11 installed locally.
- Familiarity with Python development and unit testing.
- A basic understanding of nano contracts. If you are new to this, start with Everything about nano contracts.
Understand
Before you start developing your blueprints, you need to understand nano contracts. See:
- Everything about nano contracts: for those not familiar with this feature.
- Nano contracts — how it works: to understand how smart contracts work on Hathor.
Implement
- Blueprint SDK — guidelines: to consult the constraints that your blueprint code must follow.
- Blueprint SDK — API: to consult the names from package
hathor.nanocontractsthat can be imported in your blueprint module. - Get started with blueprint SDK — part 1: walks through conceiving and designing your first blueprint — defining its state variables, methods, and expected behavior.
- Get started with blueprint SDK — part 2: walks through implementing and testing the blueprint you designed in part 1.
Test
The blueprint SDK is embedded in Hathor core, so testing your blueprint requires a local Hathor core installation. Start by installing Hathor core from source code — this gives you the hathor-cli and the full test runner environment.
Once installed, the SDK provides a testing framework that lets you write unit tests against your blueprint methods without deploying to a live network. For the full testing API and examples, see:
- Blueprint SDK — tests: all testing utilities provided by the SDK, including how to set up a test environment, invoke methods, and assert contract state.
Deploy
- Nano contracts with headless wallet: for how to deploy your blueprint on the ledger (blockchain).
- Public networks: to connect to the correct public instance of Hathor network.
Examples
Blueprint 'Bet' is provided as a complete example (source code, tests, and documentation):
- Bet — blueprint module: source code of blueprint 'Bet'.
- Bet — unit tests: unit tests for blueprint 'Bet'.
- Bet — documentation: to understand how this blueprint works, and how to document blueprints.