Set up your NEAR BOS environment

Building on the NEAR Blockchain Operating System (BOS) starts with a clean, connected development workspace. Unlike traditional blockchains where you might juggle multiple testnets and complex node configurations, NEAR’s architecture is designed for rapid iteration. The network is fully sharded and quantum-adaptive, maintaining 100% uptime on mainnet for over five years while supporting high throughput with 600ms blocks and 1.2-second finality [src-serp-1].

To interact with the BOS effectively, you need to install the official development tools and configure your local environment to recognize the NEAR protocol. This setup ensures that your smart contracts and decentralized applications (dApps) can communicate seamlessly with the network’s cross-chain execution layers and confidential settlement systems.

1
Install the NEAR CLI

Begin by installing the NEAR Command Line Interface (CLI). This tool is your primary interface for interacting with the NEAR protocol, allowing you to deploy contracts, manage accounts, and query state. Run npm install -g near-cli in your terminal. This installs the necessary binaries to connect your local machine to the NEAR blockchain infrastructure.

NEAR BOS Crypto Infrastructure in
2
Create a NEAR Account

Next, create a developer account on the NEAR network. You can do this via the CLI using near create-account dev-<your-account>.testnet. Using a testnet account is recommended for initial development to avoid transaction costs while you refine your BOS integrations. This account serves as your identity and signing key for all subsequent interactions.

3
Configure Your Environment Variables

Set up your environment variables to store your private key and network endpoint securely. Create a .env file in your project root and add NEAR_ENV=testnet and NEAR_ACCOUNT_ID=dev-<your-account>.testnet. This ensures that your development tools automatically point to the correct network and use your credentials without exposing sensitive data in your code.

4
Verify Connection with a Test Transaction

Finally, verify that your environment is correctly configured by sending a small test transaction. Use the CLI command near send <your-account>.testnet <your-account>.testnet 0.001. If the transaction succeeds, your local setup is fully connected to the NEAR blockchain operating system, and you are ready to begin building.

  • NEAR CLI installed globally
  • Testnet account created
  • Environment variables configured
  • Test transaction successful

Deploy your first composable frontend

The core promise of BOS is that you can build decentralized frontends that actually solve Web2 data ownership issues. Instead of hardcoding your UI into a single chain or relying on centralized hosting, you deploy components that live on-chain and can be composed by anyone. This is the difference between renting a storefront and owning the building.

Follow these steps to get your first component live. You will use the NEAR CLI to scaffold, test, and deploy your code to the BOS network.

1
Install the NEAR CLI

Before you can interact with the network, you need the command-line tools. Install the NEAR CLI globally using npm:

Unknown component: br
Unknown component: br

npm install -g near-cli

Unknown component: br
Unknown component: br

Verify the installation by running near --version. This tool handles the heavy lifting of signing transactions and interacting with the NEAR mainnet.

2
Scaffold a BOS Component

Create a new project directory and initialize a standard NEAR contract structure. BOS components are essentially smart contracts that render HTML/JSX.

Unknown component: br
Unknown component: br

Run near create and select the "contract" option. This sets up the Rust or AssemblyScript environment you will use to define your frontend logic.

3
Write the Component Logic

Open the main contract file. You will write a function that returns a JSX template. This template defines what the user sees.

Unknown component: br
Unknown component: br

For a simple test, render a static string like "Hello BOS" or a basic button. Ensure you import the necessary BOS libraries to handle state and interaction correctly.

4
Test Locally

Before deploying to the mainnet, test your component locally. Use the NEAR dev account to simulate the deployment.

Unknown component: br
Unknown component: br

Run near dev deploy to build and deploy your contract to a development account. This allows you to verify that your UI renders correctly without spending real NEAR tokens on gas.

5
Deploy to Mainnet

Once your component works locally, deploy it to the NEAR mainnet. This makes your frontend accessible to the entire BOS ecosystem.

Unknown component: br
Unknown component: br

Run near deploy with your mainnet account credentials. After deployment, you can view your component on the BOS explorer or compose it into other apps.

This process demonstrates how BOS allows developers to create, deploy, and store frontends in a secure and decentralized way. By following this sequence, you move from a local prototype to a live, composable asset on the blockchain.

Integrate autonomous AI agent harnesses

Connecting AI agents to the NEAR stack requires more than just standard API calls. You need to leverage NEAR’s specific architecture for private inference and secure harnesses. This setup ensures that agent actions are both confidential and verifiable on-chain, addressing the core thesis of NEAR as the "currency of agents."

The integration process focuses on three main components: cross-chain execution, confidential settlement, and the agent harness itself. By combining these, you create an environment where AI models can process data securely while their outputs are settled transparently.

First, set up your private inference layer. This allows your AI models to process data without exposing the underlying information to the public chain. NEAR’s infrastructure supports this by keeping the computation private while only posting the final, verified result on-chain.

Next, integrate the secure agent harness. This harness acts as the bridge between your off-chain AI logic and the on-chain NEAR protocol. It handles the signing and execution of transactions, ensuring that every action taken by the agent is authentic and traceable.

Finally, test the cross-chain execution. If your agent interacts with other ecosystems, use NEAR’s cross-chain capabilities to ensure seamless communication. This step verifies that your agent can operate across different blockchain environments while maintaining security and integrity.

Handle cross-chain execution with NEAR Intents

NEAR Intents allow you to execute transactions across multiple blockchains without manually managing bridges or wrapping tokens. Instead of locking assets in a bridge contract and waiting for confirmation on the destination chain, Intents use a decentralized network of solvers to find the most efficient route for your transaction.

This approach reduces the friction of cross-chain interactions. You specify what you want to achieve—such as swapping a token on a different chain—and the Intents protocol handles the routing, settlement, and finality. This expands the utility of your infrastructure beyond the NEAR ecosystem, enabling seamless interoperability.

To compare this with traditional methods, consider the differences in cost and latency between direct bridging and using NEAR Intents:

MethodCostLatencyComplexity
Direct BridgingHigh (multiple fees)Slow (minutes to hours)High (manual steps)
NEAR IntentsLow (optimized routing)Fast (near real-time)Low (single transaction)

When building on Near BOS, integrating NEAR Intents means your applications can support users on any chain without requiring them to hold native tokens for gas on every network. The solvers take care of the underlying mechanics, presenting a unified experience to the end user.

For developers, this means less code to maintain and fewer security risks associated with custom bridge contracts. By leveraging the existing liquidity and routing algorithms of the Intents network, you can focus on building unique features rather than reinventing cross-chain infrastructure.

Monitor performance and costs

You’ve deployed your infrastructure, but keeping it running efficiently requires a different set of eyes. Think of monitoring like the dashboard of a car: you aren’t just watching the speedometer; you’re checking fuel efficiency, engine temperature, and navigation to ensure you’re not burning cash or hitting roadblocks. On Near, this means tracking transaction throughput, finality times, and the actual gas costs associated with your smart contracts.

Start by integrating Near’s official explorer and node APIs into your observability stack. You want to see real-time data on block production and shard distribution. If your application relies on Aurora for EVM compatibility, you’ll also need to monitor EVM-specific metrics like gas price fluctuations. This isn’t about waiting for a crash; it’s about spotting trends—like a gradual increase in latency—that signal underlying inefficiencies before they impact your users.

Cost management is equally critical. Near’s sharded architecture is designed for low fees, but complex computations or excessive storage can add up. Use the [PriceWidget] below to contextualize current NEAR token values against your operational spend. Regularly audit your contract interactions to ensure you aren’t over-provisioning resources. For instance, if a simple query is triggering a full state read, you’re likely paying for more compute than necessary. Finally, set up alerts for anomalous activity. Whether it’s a sudden spike in failed transactions or an unexpected drop in node performance, immediate notification allows you to pivot quickly. The goal is to maintain 100% uptime—a standard Near has maintained for over five years—without letting operational costs erode your margins. Keep your monitoring tools tight, your alerts specific, and your cost audits regular.

Common questions about NEAR BOS

Understanding the underlying architecture helps you build with confidence. Here are the most frequent technical questions about NEAR's structure and compatibility.

Helpful gear

Use these product recommendations as a starting point, then choose the size, material, and price point that fit how you actually use the gear.