[NEAR Series] #1: NEAR’s BOS, Operating System for the Open Web

resister-boy
CURG
Published in
11 min readJul 20, 2023

Jaehun Lee | Researcher of CURG hassanpumped17@gmail.com

Contents

[NEAR Series] #1: NEAR’s BOS, An Operating System for the Open Web

[NEAR Series] #2: NEAR’s FastAuth, A Game Changer for Blockchain Mass Adoption

TL;DR

NEAR has announced its Blockchain Operating System (BOS), which means NEAR will be an operating system to abstract other blockchain include NEAR.

BOS solves two main problems which are Front-end Censorship and Discoverability.

BOS is an important milestone towards realizing NEAR’s vision of an Open Web.

In May 2023, NEAR’s BOS was released. In this article, we will take a look about NEAR’s BOS.

What is BOS?

https://www.blockhead.co/content/images/size/w1304/2023/03/Near.jpg

Earlier 2023, NEAR’s Blockchain Operating System (BOS) was released at ETH Denver. BOS is literally a blockchain operating system, and as its name implies, it enables multiple applications to be serviced on top of a system called a blockchain.

When we think about operating systems, we consider of Linux, MacOS, and Windows. An operating system abstracts the hardware, manages system resources to allow users and applications to utilize the hardware conveniently and efficiently, and provides functions common to users and applications.

The BOS can be understood similarly. Linux, MacOS, and Windows abstracted hardware, BOS abstracts the blockchain. The entity behind the BOS is NEAR itself. Users will be able to interact with other blockchains, including NEAR, through BOS. For now, it only supports Ethereum, but the company plans to expand the number of supported chains to include Solana and Cosmos.

The problem BOS is trying to solve

Now let’s take a look at what problems BOS solves and what it does specifically.

Censorship of Frontends

The first problem is Censorship of front-end, which is a problem that both Web2 and Web3 have. Typically, front-ends are deployed in the cloud, like AWS. And there is a problem that user who using the application can not know what is going on under the application, even though it might contain malicious logic. User have to trust the developers.

Discoverability

Discoverability is one of the old problems of Web3. While blockchain explorers like Etherscan exist, it is difficult for users to find the information they are looking for based on transaction hashes or account addresses alone, especially if the information users looking for is not a simple transfer record, it becomes structurally impossible in an interface like Etherscan.

What BOS provides

The BOS offers a wide range of features like real operating system, but they can be separated into two broad categories.

Development

Developers can develop front-end code (written according to JSX syntax) called Components and deploy them to the NEAR on-chain. A Component can be an entire application, a small button, or a combination of components.

By deploying your front-end code to the NEAR on-chain, you can get other developers audit and contribution to your application, making it more secure (decentralized), and your application’s users can use it without worrying about phishing (stealing private keys).

Another benefit of deploying your code on-chain is that you can reuse other developers code by making it into a widget. Of course, you can also write your own code, make it into a widget, and contribute it as open source.

You can deploy your own Components from the url below.

NEAR | SANDBOX

Discovery

Finding what users are looking for on the blockchain is still a challenge. With Gateway, users can search for the information they are looking for in a flow similar to a Web2 service, even on a blockchain.

Earlier, we mentioned that you can develop front-end code through BOS and deploy it to the NEAR on-chain, where you can store not only code but also text or images.

On one of the gateways, near.social, users can manage their profiles and post text or images, just like on social media. They can also follow other users, and all of this is stored on the NEAR on-chain.

And all of this is possible without paying for gas because of NEAR’s FastAuth. If you do not have account based on FastAuth, you will have to pay for every action because they are all transaction saving on NEAR on-chain and it includes log in to near.org or create Components.

You can search for Components, Applications, and Gateways in the url below.

NEAR | NEAR.ORG

Entities & Roles of BOS

Until now we have talked about the problems what BOS solving and the features it provides, let’s take a look about the entities in this ecosystem and what their roles are. BOS can be broken down into five tiers.

Blockchain

Blockchain means to a blockchain network, such as Near, Ethereum, or Solana or Cosmos, which actually acts as a database where data is stored and retrieved.

Data Platform

The Data Platform refers to the tools that allow Gateway to access on-chain data. This includes RPC APIs for interacting with Near, Indexer for quick access to on-chain data, and Meta Transaction Relayer for supporting payments in FastAuth.

Gateway (Discovery)

The Gateway is a virtual machine that renders the front-end of a NEAR, Ethereum-based decentralized application which called Components and we will talk about what is Components later.

Currently, BOS’s Gateways include near.org, bos.gg, near.social, and welldone gateway. A Gateway is not limited to just being a website, it can be a browser itself, a desktop application, or a mobile application.

If you are a developer, you can also deploy your own gateway by refer to the url below.

Application

An Application is an service built based on BOS ecosystem. Developers can develop applications with Components deployed on-chain through BOS, and also can get the source code and commit history of applications at near.org/applications.

Currently, there are various applications available at near.org/application, including the NEAR Query API to create custom indexers, the Developer Hub to connect with developers contributing to the NEAR ecosystem, and the 1inch BOS Components.

Components

Components are front-end source code written in the JSX syntax and they are interacting with Contracts. They are consist of two types which is custom Components and Built-In Components. Custom Components means Components developer will deploy yourself below, and Built-In Components means Components provided by the BOS. Components are also publicly available with all source code and commit history. If you want more information about Built-In Components provided by BOS at the url below.

NEAR | Built-In Components

BOS-APIs

Additionally, there is a BOS-API which is APIs provided by BOS for portability and decentralization between blockchains and gateways in Components. BOS-APIs can be categorized into four main types.

First, there are APIs such as Cache, Clipboard, Fetch, and Storage that are provided at the browser level. You may be wondering why we need these APIs when we already have them provided by the browser. But do not forget that Components can be rendered by Gateways other than the browser. BOS is not just a website.

The second is an API for interacting with NEAR. It contains methods to look up or call blocks or smart contracts.

Third, there is State, which allows you to manage the state of your application.

In addition, there is a Social API to get data from NEAR Social and a Primitives API provided by NEAR Social. More specific API specifications can be found at the url below.

NEAR | BOS-API

Deploying BOS Components

Now let’s create a Component directly through the BOS and deploy it to the NEAR on-chain. There are two ways to deploy a Component. The first is to near.org/sandbox and the second is to your local environment. In this article, we will walk through the process of deploying a Component from near.org/sandbox and downloading the deployed Component locally.

Deploying Components from near.org/sendbox

First, go to near.org/sendbox and sign up or log in. It is important because if you are account was not created by NEAR’s FastAuth, you will have to pay a gas fee when you deploy your Components.

Write your code in the code space. It follows JSX syntax. At this point, you can also insert Components written by other developers and be aware that not all HTML tags are supported yet.

You can also define Props or Metadata in your Components.

If you have written all of your code, click the Publish button on the right, and then click the Save Data button on the popup window that appears to finally deploy the Component (means generate the transaction).

You can see the Components you have deployed at https://near.org/components or in your profile.

Importing deployed Components locally

Next, let’s import the deployed Components locally.

To get the deployed Components locally, you need to have BOS-CLI installed. BOS-CLI is written in Rust, so you have to install Rust in your development environment to use it.

BOS-CLI
BOS-CLI providing various feature, but most important one is to deploy components locally and make components that were previously deployed on-chain available locally. Enter the command below to install BOS-CLI locally.

First, let’s install BOS-CLI. You can install BOS-CLI by typing the command below in the terminal.

cargo install --gitr <https://github.com/FroVolod/bos-cli-rs>

If your current development environment is Window, you probably do not have open-ssl and perl installed. Because of this, you may not be able to install BOS-CLI if you did not install them before. So you will need to install open-ssl and perl first.

Also, near-crypto v0.17.0, which BOS-CLI relies on, requires Rustc to be installed at 1.69.0 or higher, so if you are using Rustc below 1.69.0, please upgrade your version.

If BOS-CLI installed successfully, you will be able to use the command bos in the terminal. If you type bos in the terminal, you should see a screen like the one below.

If you select Components from Componrnts and SocialDB, you can see the screen below.

To download a deployed component, select download and enter the account of the user who deployed the component you want to download.

(<ACCOUNT_NAME>.near or .testnet).

Finally, select a network.

Now we downloaded all the Components wedeployed to resister_boy.near (my current account) locally. Now We can edit code BOS Components in our local environment.

It is also possible to deploy Components locally. However, different on near.org, in local environment we should pay when deploying Components because we did not set FastAuth in local environment. We will not talk about how to set up FastAuth in this post, but you can find an example of how to set up FastAuth at the url below.

BOS-Loader
Additionally, there is a utility called BOS-Loader that can be useful when developing Components in local environment. With BOS-Loader, you can run your Components locally to see how they render and if the logic works. It also build by Rust so if you want use BOS-Loader, you should install Rust previously.

You can install BOS-Loader (executable file) for your operating system from the url below.

Run BOS-Loader and enter the account you want to deploy and the Components you want to deploy in the CLI in the format below, and BOS-Loader will render the Components in your local environment.

Now go to near.org/flags and enter http://127.0.0.1:3030를 in the form.

Finally, you can see the Components you created in your local environment by entering a URL in your browser’s search bar that looks like this.

<https://near.org/><ACCOUNT_ID>/widget/<COMPONENTS>

What the BOS makes possible

Developer perspective

  1. By storing front-end code on-chain, you can develop fully decentralized dapps.
  2. Based on NEAR, developers can build dapps that work on multiple chains, including Ethereum.
  3. Developers can reuse front-end code deployed by other developers by turning it into a Widget.

User perspective

  1. You can create your own profile on-chain, which is data that belongs to you and not to third parties.
  2. FastAuth allows you to create profiles that are stored on-chain with no gas fees.
  3. Dapps deployed through BOS are safe from phishing.

Open Web & BOS

In 2020, NEAR wrote on their article that NEAR would be the platform that would drive the Open Web. NEAR’s Open Web is an ecosystem where value-added data is stored on the blockchain and accessible to all, leading from Open Money and Open Finance.

Since NEAR announced the Open Web and the feature that Open Web should support as a platform. NEAR has introduced Sharding for faster transaction processing speed, Account Model and Keypom for user on boarding, and BOS is one of NEAR’s important milestones for the Open Web.

Conclusion

In this article, we talked about NEAR’s Blockchain Operating System (BOS). BOS deploys previously centralized front-ends to the NEAR on-chain, making them more decentralized, secure, and reusable.

It also allows users to create on-chain profiles so that they can manage their own profiles, and further improves the ease of searching and accessing information stored on the blockchain. All of this will be the foundation of the Open Web. It will be interesting to see if NEAR can deliver on the Open Web ecosystem, and if the Open Web that NEAR is talking about is the future of blockchain.

Reference

NEAR Official Documents: https://docs.near.org/bos/overview

NEAR Discovery Repository: https://github.com/near/near-discovery

INTRODUCING THE BLOCKCHAIN OPERATING SYSTEM (BOS): https://medium.com/nearprotocol/introducing-the-blockchain-operating-system-bos-8004345d02ba

Near BOS-CLI Repository: https://github.com/bos-cli-rs/bos-cli-rs

Near BOS-Loader Repository: https://github.com/near/bos-loader

Near Gateway: https://near.org/

Near BOS-API Documentation: https://docs.near.org/bos/api/home

Near Social VM Repository: https://github.com/NearSocial/VM

NEAR SOCIAL: BUILDING THE FOUNDATION OF THE OPEN WEB: https://medium.com/nearprotocol/near-social-building-the-foundation-of-the-open-web-65672f4152dc

The Evolution of the Open Web: https://near.org/blog/the-evolution-of-the-open-web/

--

--