How to Construct your First Project on Blockless

Blockless
5 min readApr 20, 2023

--

This guide will walk you through how to use both Blockless CLI and Dashboard to create the next generation of trustless applications.

In this comprehensive guide, we will walk you through the process of using the Blockless CLI and Dashboard to create your project on Blockless, the first verifiable serverless platform for Web3.

You’ll learn how to start a new project using the Blockless CLI, install and configure the necessary tools, test your project locally, and finally, deploy your trustless application to the Blockless Network.

Getting Started with Blockless CLI

The Blockless CLI allows you to create, test, and deploy your Blockless Function projects.

Install Blockless CLI

To install Blockless CLI, you can either use curl or wget.

Installing Blockless CLI with curl:

$ sudo sh -c "curl <https://raw.githubusercontent.com/BlocklessNetwork/cli/main/download.sh> | bash"

Installing Blockless CLI with wget:

$ sudo sh -c "wget <https://raw.githubusercontent.com/BlocklessNetwork/cli/main/download.sh> -v -O download.sh; chmod +x download.sh; ./download.sh; rm -rf download.sh"

To install on Windows, go to the releases page on GitHub and download the x86 version of the Blockless CLI.

Get familiar with Blockless Commands

To see a list of available commands, you can run the bls or bls help command:

bls help

Log in to your account

To log in to Blockless, run:

$ bls login

A pop up window will take you to connect your Web3 wallet. If your default browser (Safari, etc.) does not support Web3 wallets such as MetaMask, you may have to copy&paste the login URL manually into your Chromium browser.

Create a new Functions project

To create a new Functions project, run:

$ bls functions init

In your terminal, you will be asked a series of questions related to your project.

Test your project locally

In your project directory, the bls function init command has generated the following files:

  1. bls.toml: Your Blockless configuration file (Function Manifest)
  2. readme.md: Project readme file
  3. index.ts: A minimal Hello World Function written in TypeScript
  4. package.json: A minimal Node dependencies configuration file.
  5. asconfig.json: AssemblyScript configuration.

After creating your first Blockless Function, run bls components install to install the local runtime environment. This will enable you to test your function locally.

Next, execute the following command to build your function. Once the build sequence is complete, a build folder will appear in your project directory.

$ bls function build

To test your function, simply run the bls function invoke command. You will see your function result returned to the terminal after execution.

Deploy your project

With your project configured, you can now deploy your Function to the Blockless Network.

$ bls function deploy

You will be able to view your deployed function either via the bls function list command or via the Blockless Dashboard.

Get Started with Blockless Dashboard

Blockless Dashboard is a Graphic User Interface (GUI) for creating and managing Functions on Blockless. Let’s get started.

Login in with Web3 Address

To get started with Blockless Dashboard, first connect your Web3 wallet via https://dashboard.blockless.network/ using the browser that has your Web3 wallet app in it.

Install one of the supported wallet if you don’t have one already. Then click Connect and your wallet would present you with a Signature Request.

After signing in via your wallet, you would be taken to the Blockless Dashboard where you can manage your existing functions and create new ones.

Connect Your GitHub Account

If you click Create Function, the Dashboard will guide you to connect your GitHub with Blockless.

You would then be asked to install and authorize Blockless Deploy, which will allow Blockless to access programs you’ve stored under your GitHub repository.

Deploy a Serverless Function on Dashboard

After you link your GitHub account, you can either connect and deploy functions in your existing repository, or play with the simple “Hello World” use case example offered on the lower left corner.

Depending on the size of the function you are deploying, it may take up to a few minutes for the process to finalize. The Hello World function here for instance takes around 10 seconds to build and deploy.

In the background, your function and its configurations just got stored on IPFS and the CID is broadcasted to Execution Nodes within the Blockless Network for install.

After your function is deployed, you can click on the invocation URL to have your function executed by the Blockless Network. When this happens, the Blockless Network will do an Execution Node roll-call to select nodes that are online and meet the hardware and software requirements for executing a function. The network will then select the most suitable Nodes out of this pool of eligible nodes based on past performances.

The selected nodes will then execute your function and return the result. In this example, “Hello, world!”:

What’s Next?

Now you have learned how to use the Blockless CLI and Dashboard to create serverless functions powered by a global and trustless network of nodes, it is time to dig deeper, explore ideas, and ship your application.

You can find more about configuring your function and expanding its functional capacity in this article on Blockless Manifest and Extension.

We will also share an real-life example of how to create a serverless web app using Blockless functions. Join our community channel now to stay connected!

About Blockless

Blockless is a zk verifiable serverless execution platform that makes dApp building easier than ever.

Website | Twitter | Discord | Telegram | Blog | Medium | Mirror | Linkedin

--

--