A Comprehensive Guide to ORE ChainJS

AIKON’s foundation is deeply rooted in the idea of making blockchain easy to use for people across the globe. Also, apart from simplifying adoption, we are big advocates of privacy and online identity rights. 

That’s why we released the Open Rights Exchange (ORE) and the ORE Protocol — an open-source set of standards providing a unified interface for managing access control, authentication, and settling blockchain transactions. 

ORE ID’s easy-to-use login experience proves instrumental in this regard by enabling consumers to seamlessly access blockchain applications with their Facebook accounts, Gmail logins, Twitter profile logins,  and more login capabilities. 

While we empower businesses and individuals to control and take ownership of their identities and assets, we are large supporters of the open-source community and have left no stone unturned in making developers’ lives easy. 

An example of this is ChainJS, an open-source javascript standard that we launched to let programmers build on multiple blockchains. Let’s dive a bit deeper into how you as a developer can leverage it for your requirements. 

What Is ChainJS? 

At its core, ChainJS is a low-level Javascript helper library — one that makes developmental tasks simpler, so you can write code that is operationally compatible with multiple blockchain networks. 

The library uses a plugin model and a unified interface to complete standard blockchain functions like constructing, signing, and sending blockchain transactions cross-chain. Currently, ChainJS has plugins included for Algorand, EOS, and Ethereum, with more blockchains being added soon. 

Write Once, Run On Any Chain 

One crucial aspect of ChainJS is its Java-like code reusability. While with Java, it is “write once, run anywhere,” with ChainJS, you can say that it is “write once run on any chain.”  

Through a standardized symantic for everyday chain activities, you can use ChainJS to develop a program or a smart contract that finds use in cross-chain applications. 

The best part? Developers can build decentralized apps (dapps) using ChainJS 10x faster. That’s because the plugin maps contract actions, transaction composition, and error types use a unified set. 

Here’s a sample code for creating an account on- chain: 

What Else? Oh, Yes! Native Chain Libraries Are Pre-Included

If you were worrying whether you would still have access to libraries native to their respective blockchains, don’t. Because while you can take care of the usual stuff using the unified ChainJS API, you can still use the native chain library when necessary. ChainJS is full of surprises. What can we say! 

For example, to access the eosjs library for the EOS blockchain network just cast the generic chain object to an EOS-specific chain object. Then you can access the eosjs API. 

For Ethereum,  access web3 directly from the chain object.

As we mentioned earlier, more chain plugins will become a part of the ChainJS Javascript library soon. But until that happens, developers can also build a custom plugin to support the blockchain of your choice. Feel free to open a PR to merge in your plugin or create an issue for a feature request or bug.

How to Use the ChainJS Plugin Library? 

Follow the command line steps below to install  ChainJS blockchain transaction API.

To run ts files (and examples), use ts-node (with the –files option to include local customTypes).

Interested in contributing to our ChainJS library? Check out our GitHub page!

Leave a Reply

ORE ID empowers Telos developers to offer free cloud wallet solutions for their communities! 🎉

%d bloggers like this: