<

Neb.js Quickstart

The Nebulas JavaScript API

Neb.js from Nebulas.io is the JavaScript solution for interacting with the Nebulas blockchain. It exports a suite of powerful tools:

  • HTTPRequest
  • Neb
  • Account
  • Transaction
  • Utils
  • CryptoUtils
  • Unit

Let's start by adding Neb.js to a new project.

Prerequisites

  • Node.js
  • Git
1. Clone the starter project

To get up-and-running as quickly as possible, clone the following repository from GitHub: webpack-boilerplate.

git clone https://github.com/cvgellhorn/webpack-boilerplate.git
When cloning a repository, you can change the name of the projects root folder by adding an argument after the repositories URL:
git clone https://github.com/cvgellhorn/webpack-boilerplate.git neb-tutorial

2. Install the projects dependencies

After cloning the repo, navigate into the directory and install it's dependencies:

cd webpack-boilerplate && npm install

3. Add Neb.js

Now lets add Neb.js to our project:

npm install --save nebulas

If the previous command doesn't work, you can try installing directly from GitHub:

npm install --save https://github.com/nebulasio/neb.js.git

4. Test Neb.js

Once we've added Neb.js, we're good to go! Let's confirm it's working. Open up your favorite code editor and add the following to the bottom of app/index.js

import * as Neb from "nebulas" let account = Neb.Account.NewAccount() alert(account.getAddressString())

Now run the project:

npm run dev

Finally navigate to http://localhost:8080/ in your browser to see it in action.

Live Example

Here's a live example of the previous directions applied to Nebulearn.com!

Generated Address: n1dZ7SfjpfyeSdoVceyFXW9CTxqc8PUE1u1

Congratulations, you've added Neb.js to your project and are ready to develop your epic DApp. Have fun exploring the exported modules mentioned at the start of this tutorial. Live long and Nebulas! 👾


Return to the homepage

Contribute to Nebulearn.com on GitHub

Support Nebulearn (NAS): n1HY4ob2kBRacVHoJKGqmwsvhE6BN5pvEy2
All donated funds go towards hosting and the continued development of Nebulearn.com
Disclaimer: Nebulearn.com is not affiliated with Nebulas.io
Go to top of page.