How to Deploy Solana Program with Blockpulsar

Blockpulsar provides continuous integration and continuous deployment (CI/CD) for smart contracts. In this tutorial we provide how you can deploy your solana program (smart contract) on the Blockpulsar platform.

How to Deploy Solana Program with Blockpulsar

Blockpulsar provides continuous integration and continuous deployment (CI/CD) for smart contracts. In this tutorial we are going to provide how you can deploy your solana program (smart contract) on the Blockpulsar platform. To do so is straightforward.

  • Step 1. Create Blockpulsar Client and App
  • Step 2. Create Solana Program (Smart Contract)
  • Step 3. Deploy Solana Program
NOTE: On Solana, smart contracts are called programs.

STEP 1: Create Blockpulsar Client and App

Click here to sign up and create a Blockpulsar Client and Application if you have not created one yet.

When you create a Client you will get two keys: API KEY and SECRET KEY. These keys are unique to each Client. You can have multiple Clients and every single Client can have multiple applications with a unique ID generated by the system.

Login to your home page, create Client and App. On the left side bar click:

  • API Clinet -> Nee API Client
  • Apps -> Create New APP

If you created successfully you should see the following: APP

STEP 2: Create Solana Program

Create your Solana program on your machine. You can download a minimal Hello World example from here.
In the root directory open blockpulsar.json or blockpulsar.toml file (create if it does not exist) and provide app_id and stage or if you are using Anchor framework, then Anchor.toml or Cargo.toml should contain blockpulsar config with app_id and stage in it. For example (JSON format),

{
  "app_id": "<Application ID>",
  "stage": "dev | test | prod"
}

For example (.toml file format),

...
[blockpulsar]
app_id = "<Application ID>"
stage = "dev | test | prod"
...

You can get the application ID from the user interface when you create a new application in STEP 1.

Add the Blockpulsar remote repository by running the following command:

git remote add bp https://<API KEY>:<SECRET KEY>@ci.blockpulsar.com/git

NOTE: You need to do this once for every project and if you change your Blockpulsar Client keys.

STEP 3. Deploy Solana Program

Make sure to commit (git commit) your code before deploying and whenever you modify the blockpulsar.json file. Run the following command to deploy your program.

git push bp master

Instead of the master branch, you can provide any branch name you would like to deploy.

If everything goes well you should see the following output:

Enumerating objects: 37, done.
Counting objects: 100% (37/37), done.
Delta compression using up to 8 threads
Compressing objects: 100% (23/23), done.
Writing objects: 100% (37/37), 52.82 KiB | 52.82 MiB/s, done.
Total 37 (delta 11), reused 33 (delta 10), pack-reused 0
remote: Getting Solana account keys
remote: 
remote: Solana Keys been loded successfully!
remote: Blockpulsar CI starts build process...
remote: Cloning into 'program'...
remote:    Compiling proc-macro2 v1.0.36
remote:    Compiling unicode-xid v0.2.2
remote:    Compiling syn v1.0.89
remote:    Compiling version_check v0.9.4

...

remote:    Compiling borsh v0.9.3
remote:    Compiling serde_bytes v0.11.5
remote:    Compiling bincode v1.3.3
remote:    Compiling blockpulsar-solana-example v0.1.0 (/root/program)
remote:     Finished release [optimized] target(s) in 52.28s
remote: Blockpulsar is checking Solana account balance for dev stage
remote: Solana Account Balance - 0 SOL
remote: Account balance is less than 2 SOL, Blockpulsar will make 2 SOL Airdrop
remote: Requesting airdrop of 2 SOL
remote: 
remote: Signature: AAFjk4BCeWyD5yz8hzAUCQSAcKKVQpYzxVGcWagf9bfnMmjLQcRhQNi6UezwrwFhN1xhd2XRCBT3D132QFm5Vjp
remote: 
remote: Balance unchanged
remote: Run `solana confirm -v AAFjk4BCeWyD5yz8hzAUCQSAcKKVQpYzxVGcWagf9bfnMmjLQcRhQNi6UezwrwFhN1xhd2XRCBT3D132QFm5Vjp` for more info
remote: 
remote: Blockpulsar is deploying program helloworld.so
remote: Program Id: 6T6c9CXpqPedHy1SQ1DYi8cFQqxbKfE6CxCWSwS8do3C
remote: 
To https://ci.blockpulsar.com/git
 * [new branch]      master -> master

Account Info

Now, you can use Blockpulsar API to get your program info. Blockpulsar solana cluster provides JSON RPC API and RPC PubSub WebSocket which fully matches the official Solana JSON RPC API.

@solana/web3.js example:

import * as web3 from '@solana/web3.js';

(async () => {
  const connection = new web3.Connection("https://api.blockpulsar.com/sol-dev?key=<API KEY>&secret=<SECRET KEY>");

  const account = await connection.getAccountInfo(<YOUR PUBLIC KEY>);
  console.log(account);
})();

PUBLIC KEY (Account Address), API KEY and SECRET KEY are available in the user interface when you created your app in STEP 1.

Ready to Scale Your Business?

With the help of Blockpulsar experts, you can deploy a successful workflow solution faster. Our team members employ agile and waterfall project methodologies, along with a range of automation technologies, to guarantee a flexible and user-friendly workflow solution.

Blockpulsar.com

Blockpulsar simplifies workflow automation development by offering smart solutions that are flexible, scalable, and user-friendly.

© 2023 Copyright Blockpulsar Inc.