Introducing Virtual TestNets! ⚡ Test and stage dapps on real-time production data. Get started

Networks

Building Dapps on BNB Chain: How to Go Into Production Faster With Tenderly DevNets

Learn how to build dapps on BNB Chain faster using Tenderly DevNets as a development and testing environment. Then, integrate the Tenderly Simulation Infrastructure to allow users to preview transactions before sending them on-chain.

Milica Lukic
Milica Lukic
Sep 8, 2023 · 5 min read

In this post

How to build dapps on BNB Chain with Tenderly DevNets

Build N Build (BNB) Chain is a comprehensive blockchain ecosystem designed to enable decentralized applications and services through various interconnected layers. Currently, BNB offers a suite of solutions that are high-performance and cost-effective on top of its consensus layer, BNB Smart Chain (BSC). BSC is EVM-compatible, offering multi-chain access through its hubs. On the other hand, BNB Beacon Chain is the staking, voting, and governance layer of the BNB Chain. 

Additionally, BNB Chain and its testnet are one of Tenderly’s supported networks, with 6k+ projects building on BNB using Tenderly. You can use the Tenderly full-stack infrastructure to support each stage of your dapp development lifecycle on BNB Chain. With Tenderly DevNets, you can simplify and speed up the early stages of dapp development and get to production faster. 

So, if you’re building on BNB Chain, you can use a diverse set of tooling, APIs, and support programs to accelerate development and focus more on your product. Let’s see how you can get started with Tenderly DevNets to build innovative, high-performing dapps on BNB Chain.

How to use DevNets to build dapps on BNBChain faster?

Tenderly DevNets are a managed, zero-setup environment for developing and testing your smart contracts. You can use DevNets to spin up a private network with both historical and most recent states of the BNB Chain. DevNets also come with an unlimited faucet, so you don’t have to worry about getting test tokens. 

Additionally, DevNets are complementary to HardHat, Foundry, and Truffle, so you can easily integrate them into your existing development flows. 

Here are a few ways to use DevNets when building on BNB Chain. 

1. Simplify and speed up your local development

With DevNets, you get an isolated environment that can help you speed up local development with faster feedback loops, easier collaboration, and efficient debugging. Despite having a private environment, you still get the most recent production data from BNB Chain, with all public accounts unlocked for further experimentation. 

Creating a DevNet environment for BNB Chain
Creating a DevNet environment for BNB Chain

Once in a Tenderly DevNet, you can set up different templates for the BNB Chain network and preview how your smart contracts would behave if sent on-chain. And if you come across a bug, you can use built-in debugging tooling to quickly resolve any issue: 

  • Inspect bugs in detail with Tenderly Debugger: Don’t go live on BNB Chain with overseen bugs. Instead, use a DevNet to quickly preview your smart contract behavior and identify issues early on. Then, jump into Debugger to inspect your code by individual function calls. 
  • Optimize gas consumption with Gas Profiler: BNB Chain offers low gas fees, but you can make them even lower. See exactly how much gas your contract would consume once deployed on BNB Chain with Gas Profiler. Inspect your code granularly and identify the lines of code you can optimize to reduce gas usage.
  • Preview and validate your fixes with Transaction Simulator: In the last stage of your debugging process, head over to Transaction Simulator to preview the effects of your changes. You can update the source code of your contract or change specific transaction parameters. Once you simulate your transaction, you can see whether your fix is successful and then deploy it to BNB Chain with confidence. 

2. Test your dapp against real-time BNB Chain production data

You can also speed up your testing process with DevNets and go live on BNB Chain faster. You can use a DevNet RPC as your JSON RPC provider. This way, you can test against the most recent BNB Chain data while still in development. 

Connecting with a DevNet RPC
Connecting with a DevNet RPC

By using a DevNet for testing, you can: 

  • Test complex scenarios by running stateful transaction simulations within a DevNet. 
  • Automate some of your tests with reusable templates and avoid wasting valuable resources on lengthy setups and redeployments. 
  • Control your testing environment with custom RPC methods and run all your tests under identical conditions. 
  • Get unlimited test tokens that you can get directly from the Tenderly Dashboard, through Tenderly Faucet, or with custom RPC methods. 
Using an unlimited faucet for BNB tokens
Using an unlimited faucet for BNB tokens

3. Make collaboration on BNB Chain easier

When developing and testing with DevNets, your smart contracts are completely private. So, you don’t have to worry about exposing sensitive data on a public testnet. However, despite being private, you can still share DevNets with your team to facilitate collaboration when you’re ready to go public. 

Aside from giving your team members access to your project, you can enable the public sharing of both simulated transactions within a DevNet and entire DevNet runs. This means you can turn your DevNet environments into a public resource and share them across your project to showcase different pieces of code and ensure consistency. 

A DevNet overview page for BNB Chain
A DevNet overview page for BNB Chain

Plus, you can share them with external collaborators too. Even devs who don’t have a Tenderly account can access a publicly shared DevNet. 

How to make your dapp on the BNB Chain accessible to your users? 

You probably want to build one of the top dapps on BNB Smart Chain, but a way to do it is by putting your users first. With transaction simulations, you can do exactly that – create a user-focused dapp that is easy and intuitive to use. 

Integrating Tenderly’s transaction simulations into your dapp enables your users to preview their transactions before sending them on-chain. You can even set up a simulated playground mode to allow your users to get familiar with your dapp. 

This way, they can:

  • Understand their transactions better in general.
  • See what tokens have been transferred and how much they’ve earned.
  • Prevent sending reverted transactions and avoid paying for gas unnecessarily.
  • Get a deeper insight into transaction behavior and even inspect state changes, emitted events, and gas consumption. 

How to integrate simulations into your dapp

With Tenderly’s simulation infrastructure, you have multiple ways to introduce simulations into your dapp: 

  1. Simulation API that persists simulation data and allows you to share it with your users 
  2. Simulation RPC that enables you to simulate transactions through Tenderly’s production node
  3. Tenderly SDK that allows you to integrate transaction simulations with speed and efficiency. 

How to get support building dapps on BNB Chain

BNB Chain offers different types of support programs providing incentives for easier and faster dapp development. BNB Chain strives to foster a thriving environment, providing dapp developers with essential services, support, and guidance. 

As a builder on BNB Chain, you can apply for diverse tools and services that can facilitate your development journey. You can also participate in the growing BNB Chain ecosystem and give back to the community with open-source solutions as a recognized contributor.

Go live on BNB Chain faster with Tenderly

Supported by numerous BNB Chain Developer Programs and Tenderly’s full-stack infrastructure, you can focus on building a product that will bring value to your users. While DevNets can help you speed up and simplify your local development and testing, Tenderly’s transaction simulations enable you to build trust and confidence with your users. 

Start building dapps smarter and get to production faster!

For additional insights, learn more about BNB Beacon Chain or explore the intricacies of BNB Smart Chain