This article provides a complete guideline to get started with blockchain development using the Stratis platform. This article will cover three different ways to interact with Stratis Blockchain for the development environment by creating your own private blockchain network. The article especially focuses to provide guides to create your own private blockchain for development and testing using Stratis Blockchain.
Write-up will basically elaborate on the three ways to build your own private blockchain network and get started with the development in our local machine.
- Running the Full Node
- Using Cirrus Core Private Net Wallet
- Running Docker Container Image
This article is based on Windows x64 machine and instances related to it. However, you can get the instances for all major operating systems; macOS, Linux as well. Note that you don’t need to follow all these methods. Which one you feel comfortable you can opt for that.
Running Stratis Full Node
Stratis Full Node is the core of Stratis private blockchain. This is the first and very crucial step to set up and run the Stratis Full Node on your development machine. This is needed to run the project locally and interact with the Stratis Blockchain. If you have already gone through the previous article series, you might have experienced this way of getting started. However, if you are new to this can follow the below steps:
- Download Fullnode
You can download Stratis Full Node from here.
2. Running Full Node
Once the Stratis Full Node is downloaded, go to the folder and open the Stratis Full Node solution in Visual studio, there, you will see many projects; however, you need to run the Stratis.CirusMinerD project with the -devmode parameter by executing the below command from CLI.
dotnet run -devmode=miner
Right-click on “Stratis.CirrusMinerD” Project and click on Open in Terminal then run below command.
dotnet run -devmode=miner
The above command runs a single block-producing node using the PoA (Proof-of-Authority) consensus algorithm. After the successful execution of the above command, open the http://localhost:38223/swagger in your device where you can see a list of APIs. These API endpoints will be used to interact with the blockchain.
Running the Cirrus Core Private Net Wallet
Cirrus Core private net wallet provides the graphical user interface which runs with an instance of the Stratis Full Node; ‘Stratis.CirrusMinerD’ project in devmode=miner.
This wallet is designed to launch the node for a local development environment to deploy, call the contract, and ease of use for developers to build the solutions without external interference.
- Download the Wallet
You can download the Cirrus Core Wallet from the Cirrus repository which is available for all major operating systems. Download it according to your System and install it. Installation is just the simple clicks. You can download the wallet from the official Stratis.
2. Launching and Interacting the Wallet
Once it is installed open it from the shortcut created in the desktop.
It will ask you for the wallet name and password. Provide the username: cirrusdev and the password: password as illustrated in the picture below.
Once you decrypt the wallet, it will be loaded with a dashboard reflecting the balance of 100000000 TCRS which you can use for development.
The history tab provides the history of the transactions in your wallet.
For deploying and interacting with Smart Contract, go to the Smart Contract Tab. To deploy the Contract, click on Create Contract button.
Then, provide all necessary fields and parameters specific to your contract, byte code of your contract, and finally, click create contract button as shown below.
When it is deployed you can see the contract is created in the Smart contract Dashboard as illustrated below.
You can click the View button, to view it in the Swagger.
Once you click the view button, it will launch in the Browser and can interact/call with the deployed contract from there.
To view the receipt of the transaction, click on the hash as shown below.
Additionally, once the Cirrus core Private Net Wallet is running in your machine, you can interact and explore with the RESTFul API through Swagger available on http://localhost:38223/Swagger.
Details of deploying and interacting contracts using Cirrus Core Private Net wallet can be found here.
Running Docker Image
Another way to get started and create your own private blockchain network for local development is to run the Docker Image provided by Stratis.
For this, you need to install Docker in your development environment. You can get Docker Community Version from the official docker site. Download and install the docker as per your device. You can follow the article for assistance to install and resolve the issues of docker.
Then follow the below steps:
- Get the proper Docker Image provided by Stratis Platform from the repository and clone it respectively by running below command.
docker pull stratisplatform/stratisfullnode:Stratis.CirrusMinerD-220.127.116.11-ext
2. After the Docker Image is successfully pulled then you can build the network executing the below command.
docker run -p 38223:38223 stratisplatform/stratisfullnode:Stratis.CirrusMinerD-18.104.22.168-ext
Once the above command is executed successfully, you can see your wallet as depicted below.
Now, it’s time that you can interact with the RESTFul API through Swagger available on http://localhost:38223/Swagger. You can get all API documentation and it’s details from the academy API Reference page.
Hence, the article has described the three different methods of building your own local Stratis blockchain development environment to get started with the development. You can follow any of the methods and start your development activities.