Using Nameledger Service in Nebulas Dapps

In this post we will be writing about how to use third party smart contracts which are exposed as an api. In our example we will use Nameledger service in your own Nebulas DApps. Lets looks at the code and explain about the same

First call the nameToAddr function of the smart contract address which will give you the address mapped to that address. Then we use nebPay to make the transfer. It’s as simple as that to provide user friendly pay support.


  • Call NameLedger contracts nameToAddr method to get the mapping for name
  • Use the address to initiate a payment

How to Build Nebulas Dapps Tutorials: Part 1

In the previous post we talked about the problem NameLedger is trying to solve. In this post we will take a detailed look at the smart contract itself.


  • Lookup if the name is available
  • reserveName passing in the name to be reserved. Caller address will be mapped to the name.
  • Verify if the name is registered to your address by calling nameToAddr
  • Next, if you want to sell the name registered to someone else you can use setBid to set a price for your name
  • Anyone who wants to buy the name can call transferName by sending the bid amount

Lets start by looking at th on chain storage data

var NameLedger = function () {
  LocalContractStorage.defineProperties(this, {
        owner: null,
        balance: null,
        name_count: null
  LocalContractStorage.defineMapProperty(this, "namemap");
  LocalContractStorage.defineMapProperty(this, "addrmap");
  LocalContractStorage.defineMapProperty(this, "bids");

Building DApps on Nebulas Platform

In this post we will show how we can build a decentralized application aka DApps on Nebulas platform. This is my first app to qualify for Nebulas Incentive program.


As a human being we are more accustomed to remembering people by name rather than by a account address like n1HuE4L28GBecjv11oj9R7ZW3Hnv4k65LKe. So this dapp essentially tries to solves that problem

In this DApp you can create a mapping from name to address and when people want to send NAS they can use this dapp to get the corresponding addr and send it. Ideally this will be handled by a web app or mobile app transparently. Atleast that is the hope. Think of this app as a domain name service for you name.

Ethereum Smartcontracts Monetization and Ownership Transfer

In this part 2 of the tutorial we will see how we can monetize our ethereum smart contracts and transfer ownership of our nameledger entry. Take a look at Part 1

First lets look at how we can buy a nameledger entry

function registerFriendlyName(string name, uint futureSellPrice) public payable {
  require(msg.value >= slotValue);
  require(lookup[name] == address(0));
  reverseLookup[msg.sender] = name;
  lookup[name] = msg.sender;
  bidPrice[name] = futureSellPrice;

Interacting With Solidity Smart Contracts

In this post we are going to see how we can deploy our solidity smart contract to local ethereum blockchain(using ganache).

Real world example:

Let’s say you want to send money to a friend. How would you go about doing that?

  • First you would either get his account number, phone number or email and add it to your bank account and give that beneficiary a name.
  • Once we add the account we lookup by the name and make any transactions.

How do we go about doing that in crypto world? Get their address and if the wallets allow we create a similar mapping from name to address and use that to do any transactions. In our hypothetical example we are going to build a smart contract which will allow to map a name to address and can be used by any third party application to provide feature like name based payments.

So user can register a name to a wallet address. We will be building that feature in this tutorial.

How to Setup Ethereum Development Environment

In this post we will talk about how to setup your laptop for ethereum smartcontract app development. Let’s start by installing these packages


  • Installing Nodejs
    • brew install node
  • Install ethereum testRPC for local development.
    • npm install ethereumjs-testrpc ( This package is deprecated)
    • npm install -g ganache-cli (Use this one). Verify that it is working by running ganache-cli
  • Install web3js. Web3js is a javascript library to interact with ethereum blockchain npm install web3. Verify that it is working by requiring web3 in the node console

Understanding Solidity Libraries

Libraries are a way to separate out common code to help with DRY (Do not repeat yourself) paradigm. We can think of libraries as gems in ruby language or packages in python etc.

In solidity world libraries are a special type of smart contracts which contain common code. A important difference between normal smart contract and libraries is that libraries don’t have storage or ether associated with them.

Libraries also help with saving gas as the code is deployed once and used by many other contracts. You might ask how is it different from just importing the library or inherting the library and using it? Using a base contract instead of a library to split the common code won’t save gas because in Solidity, inheritance works by copying code. And the gas also depends on the size of the smart contract. Libraries also execute in the scope of the calling smart contract and has access to the existing mapping and state variable of the smart contract calling it.

Intro to smart contracts

What are smart contracts?

Smart contracts are reusable code templates or some logic written which gets executed on Ethereum Virtual Machine. We can think of Smartcontract as analgous to AWS Lambda/Google Cloud Function.

As in the current cloud systems like AWS/Google Cloud we pay for request(atleast for lambdas). In ethereum network we need to pay some fees to get our transactions executed. This fees is called Gas in blockchain world.

Tools for decentralized applications

Application development for any platform requires a dedicated set of tools. For example if you are building a web application you might need frameworks like Ruby on Rails, Django, Express etc. Similarly for iOS app development you need Swift/obj-c and IDE’s like xcode.

In this post we will talk about a few tools which will help you in getting started with decentralized app development. Lets begin with the platform

How to build decentralized apps

Decentralized Applications

Blockchain and decentralized applications has been a topic of discussion off late and beginning to catch main stream. Like Mobile, Cloud and AI revolution I see blockchain and decentralized application will flourish in years to come.