Building Javascript Apps With Polkadot

By: Jesse Abramowitz
Blockchain Developer

Our fondness for Polkadot and Substrate is an open secret here at BlockX Labs. To date, we now have delivered 2 web based applications for the ecosystem and are planning on developing more. In the meantime, I thought this would be a great opportunity to write about our experiences building on Polkadot and how you can as well. A lot of things need to be built and the more people building the better it is for this ecosystem long term.

First things first, if you have never touched Polkadot, I recommend reading their whitepaper here or checking out their medium. If you have a base understanding, let’s get you up and running with some of the tools.

Create an Account

First thing you need to do when dealing with any blockchain is create an account. This is more like generating a key pair instead of creating an account because accounts are not placed into the state trie until they receive a balance of > 0.1 dots.

Let’s worry about the DOTs later, for now you can generate your key pair with Enzyme built by us at BlockX Labs or on Poc-3.

Most applications currently on the Polkadot ecosystem will allow you to generate both ed25519 and sr25519 key types. If you are looking for more information about the differences, check out the Polkadot Wiki here. The sentiment seems that sr25519 is the preferred type however, currently ed25519 is the default key generation type.

Funding your account

Next, let’s get that account into the global state trie to do this we need to receive a balance. This can be done by two faucets. The Universal Faucet (built and maintained by us) or another faucet here.

Sending Dots

Now it’s time to send DOTs. You can do that with Enzyme like this:

After clicking send, you can verify the transaction with a third party such as Polkascan.

If you want to go deeper and build your own applications, you can also do this programmatically with Polkadot.js.

This is a snippet of code from the Faucet that demonstrates programatically sending a transaction.

Checking Balance

Most applications I can think of require checking balance. This again can be done with Polkascan, Enzyme, or Polkadot.js.

Checking balance would require a similar setup as the gist above. You can use this to get a response:

const balance = await api.query.balances.freeBalance(address);


I am pleased to announce that by the time this article has come out, we will be supporting parachains on our Universal Faucet (that is on Enzyme’s roadmap).

A quick primer on Parachains. Polkadot is built with runtime modules called Substrate. The whole idea is that Polkadot is meant to coordinate all of these parachains that can be application specific blockchains.

Building something on Polkadot can be limiting if you don’t consider integrating with all the parachains. To learn more on Parachains you can read up on it here.

The great thing with polkadot.js is that it is dynamically created for you when you build a parachain. Thus, you can use the same library and a new endpoint for most cases.

The only thing you would need is an endpoint and custom data types.

In the Faucet I have connected to Robonomics and Edgeware, Joystream and Centrality are coming soon.

Let’s take Robonomics as an example:

const getRobonomicsApi = async (provider) => {const api = await ApiPromise.create({provider,types: {Order: {model: ‘Vec<u8>’,objective: ‘Vec<u8>’,cost: ‘Balance’},Demand: {order: ‘Order’,sender: ‘AccountId’},Offer: {order: ‘Order’,sender: ‘AccountId’},Liability: {order: ‘Order’,promisee: ‘AccountId’,promisor: ‘AccountId’,result: ‘Option<Vec<u8>>’},LiabilityIndex: ‘u64’}});return api}

That is it, while connecting to the API you just add in some custom data types and you are able to use polkadot.js as normal.


Polkadot is a work in progress and is building a strong ecosystem around it. We are personally working very hard on Enzyme so that hopefully it can support DApp integration soon and we can start to see DApps take off as well.

We’ve said it before, but in our opinion, this is definitely a project to watch closely.


Jesse Abramowitz is a Blockchain Developer at BlockX Labs. He has worked on multiple DApps, projects, and Blockchain Networks. Currently, he is also a professor at George Brown College in Toronto. He is always looking to help, teach and build on the blockchain. You can reach him at:

BlockX Labs specializes in building developer tools and solutions for blockchain ecosystems. We aim to sift through the noise to bring some sense and clarity into the Blockchain space. Our accomplishments include AIWA — a wallet and DApp interaction tool for the Aion Network, and Universal Faucet — a test token faucet for Aion, Ethereum, Polkadot, Stellar, Tron, IOTA.

Follow Us on Twitter: @BlockXLabs

BlockX Labs builds developer tools for blockchain ecosystems. We also focus on building solutions for private/public blockchains. More info @