How I Constructed an API to Confirm Claims of Feat

Lisk Hacker Noon profile picture


We empower builders with a software program improvement equipment for blockchain purposes written in JavaScript.

A couple of weeks in the past, I began engaged on a challenge that I later submitted to the Lisk Builder Program. The core concept of the challenge was to supply a single API to confirm claims of feats – on a resume for instance. The total presentation of the concept could be learn on this put up.

Normal Course of

The group registers as an issuer. As soon as registered as an issuer, it may create a kind of feat which could be seen as an outline of what has been achieved by the one who will obtain it, and at last, the group can award folks with these feats.

Really, solely three sorts of transactions exist right here: CreateIssuer, CreateFeatType, AwardFeat.

Implementing Customized Transactions

The CreateIssuer transaction merely initializes the asset of the account with the issuer data and an empty featTypes object.

The CreateFeatType transaction comes so as to add an entry to that featTypes object. The important thing to that entry is the ID of the transaction. Storing the ID of the transaction permits us to later retrieve the transaction, with the intention to have data similar to, when was the time of the creation, who created the transaction. This interprets to enterprise questions, similar to when was this feat sort first used, or which group is behind that award.

In fact, we might additionally instantly retailer the ID of the issuer and the time of the transaction within the object. Nevertheless, one has to decide and I believed in a blockchain surroundings storage prices greater than compute energy, so I most popular to solely retailer the ID.

Observe: I additionally saved the variety of individuals allotted with this award, as Lisk presently would not provide a fast and simple approach so as to add a customized SQL request and expose it by an endpoint. As a way to obtain this, it will have been essential to create a whole customized module for this, which might not be worthwhile.

Lastly, the AwardFeat transaction pushes data contained in the asset of the receiver account:

I added two properties of metadata: the date of the occasion and a remark that permits the issuers to set a point out for a certificates. It may be the factors on which the award was given, i.e the Feat Sort is the “winner of a cookery contest” and the metadata can be the date of the competition (versus the date the award is attributed), and what was truly achieved, which on this case may very well be “cooked a French soufflé”.

As soon as once more, I used the ID of the transaction as the important thing of the thing entry, with the intention to permit later retrieval. Since I used the identical approach earlier, the featTypeId is definitely the ID of the transaction that created the featType and due to this fact incorporates its data. Therefore making it very straightforward to question!

Many awards can be attributed throughout the identical interval of the yr to lots of people directly. To mitigate the community congestion, you may specify an array of addresses so you may award many individuals concurrently when sending an AwardFeat transaction.

The ReactJS Frontend

The front-end has been constructed with ReactJS + Redux + RxJs. 

For comfort, I made a display screen to create an account that’s robotically furnished with sufficient tokens to execute a number of transactions.

As soon as logged in, you might be redirected to your area the place you may obtain your QR code and see what awards you’ve obtained, (if any).

If you happen to grow to be an authority it is possible for you to to create some feat sorts and awards accounts, after which see them on the account you awarded.

I attempted to be as easy as attainable so issues are straightforward to know and attain.

Lastly, the general public display screen “Confirm an account” shows the feats for a selected account within the community.

For additional particulars in regards to the FeatChain challenge and the code, take a look at its GitHub repository.

If you happen to really feel impressed and need to construct your individual proof of idea blockchain utility, take a look at the Lisk Builders program. Extra details about this system and the appliance process could be discovered on the Lisk net web page for the Lisk Builders program.

Disclaimer: This weblog put up was written by our group member, Jonathan Massuchetti ( username: JesusTheHun) as a part of his participation in the Lisk Builders program.

Lisk Hacker Noon profile picture
by Lisk @lisk. We empower builders with a software program improvement equipment for blockchain purposes written in JavaScript.Go to us


Be a part of Hacker Midday