Building the Decentralized Organization Chain Project

  • By Korben3 in Apps
  • 09 Jun 2020
  • 8 min read

Description

One of the challenges of new startups is to get initial funding which is needed for rent, equipment and salaries. Decentralized Organization Chain (DOC) allows companies to start their own company blockchain and receive funding by selling tokens to investors. Investors in turn have a chance to make and influence company decisions by creating polls, or run a forging node creating a Decentralized chain and earning rewards. Anyone who bought enough tokens can become a board member and create polls. In addition, token holders can register themselves as investors so they're able to vote on polls. After the poll has ended, the company is expected to follow the most voted answer.

Example:

New poll: Should we hire 2 additional R&D employees?

Options: [Yes] [No]

The DOC application is built with the Lisk SDK and consists of a server and client part, both written in Javascript. The server runs the actual blockchain using NodeJS and a PostgreSQL database. The client part acts as an interface to the server and is built using NodeJS, React, bootstrap, and Lisk Elements. You can access the frontend by going to http://doc.korben3.com

I’ve found that I could reuse parts of the custom transactions of my previous Proof of Concept, Global Data Chain. After a while, you will have many custom transactions made by various developers, making it easier and faster to build a blockchain tailored to your needs.

 

Rules

The following rules are part of DOC:

  • Founders hold a significant amount of tokens, which can also be used for future funding of the company.
  • Initial Token Offering (ITO) allows interested parties to invest in the startup company and even take a board member position.
  • Quarterly profit is used to buy back and then burn tokens from the exchanges, increasing the token price for investors and also decreasing the existing amount of tokens.
  • After a poll ends, the company must follow the most voted decision.
  • If the above rules are violated, then it will result in investors losing faith, selling their tokens and decreasing the value of the Founders tokens.

 

Usage

View polls

You can find all polls by clicking on Polls Overview in the menu on the top left of the page. From there look through the different pages or filter to view All polls, the Open polls or Closed polls.

 

View Polls

 

To vote on a poll, go to Open polls and click on a poll question. This will take you to the Polls detail page. You can even share the link to the poll by copying the url, for example: doc.korben3.com/poll/8097342680131618285L.

 

Login

Before you can create a poll, you first have to login. Go to the top right of the page and enter a valid passphrase for the Decentralized Organization Chain. Alternatively use the already filled in passphrase, which belongs to an investor account and allows you to vote. Then click the Login button.

 

Login

 

After you login an extra menu option appears called Account Info. Here you can check how many DOC tokens the account holds and if it's registered as an investor or board member. Depending on your user type, you can either vote, or vote and create new polls.

 

Account Info

 

Register Account

If you own enough DOC tokens you can register your account by first logging in and then going to Account Info. There you can click on the link called Register as an investor or board member. Or go to doc.korben3.com/register

 

Register

 

To register, create a good username and choose a user type: investor or board member. If the account has enough balance it will be registered after clicking on the Register Account button.

 

Register page

 

Vote on a poll

To vote on a poll select one from the Open polls which you can find in the Polls Overview. Read the question and click on the circle option before the answer you would like to choose. Then click on the Vote button. Remember that for voting you should first login, you should have enough balance and you should be registered as an investor or a board member. You can also see how much time is remaining before the poll closes.

 

Poll detail

 

Create a new poll

To create a new poll you first must be registered as a board member. If you want to try it out, just ask korben3 on Discord for an account. Go to Create Poll and fill in a good business-related question and at least 2 answers. Be sure to review the poll and then click on the Submit Poll button. It will create the poll on an unique address. You can find the created poll by going to Polls Overview and selecting Open polls. Click on the poll and copy the url to share it with others.

 

New poll

 

Custom transactions

The following custom transactions are used:

 

Type

Name

Description

Fee (DOC)

101

RegisterInvestorTransaction

Register as an investor.

1000

102

RegisterBoardMemberTransaction

Register as a board member.

100000

103

AddPollTransaction

Add a new poll.

1000

104

CastVoteTransaction

Cast a vote.

100

 

You can find the source code on GitHub: korben3 - Decentralized Organization Chain

 

Register as investor

Filename: register-investor_transaction.js

This transaction allows token owners to register themselves as investors. Investors are able to vote on polls created by board members. The fee is set to 1000 DOC so the threshold to participate is low.

In the validateAsset() method we make sure the transaction conforms to the following rules:

  • The user.name property is present and equal or smaller than 32 characters
  • The user.type property is present and the value is set to "investor"
  • The transaction contains only 1 asset object and only 2 user properties

Below is the code that makes sure the user.type is set to "investor" or else it will throw an error.

 

 

After the transaction (tx) is validated, the investor type will be applied to the users account. And the user will be allowed to vote on a poll.

 

Register as a board member

Filename: register-board-member_transaction.js

Registering as a board member costs 100000 DOC, this is an intended high fee because members are allowed to create new polls changing the direction of the company. Both the company and investors benefit from good decisions, so any new poll is taken very seriously. Board members are also allowed to vote.

 

Add new poll

Filename: add-poll_transaction.js

With this transaction, board members can create new polls for 1000 DOC. A poll is open for 7 days after which it is not possible to vote on any of the answers. When the poll closes, the company is expected to follow the result, which is the answer with the highest amount of votes. If the company decides to ignore the result, it will decrease trust and investors might decide to sell large parts of their tokens, decreasing the value.

The poll transaction code performs various checks to make sure valid polls are submitted:

  • A Question must be present and of correct length.
  • At least 2 and a maximum of 5 answers are allowed and must be of correct length.
  • No cheating allowed, so it cannot start with votes present.
  • The sender must be registered as a board member.
  • If the poll address already contains a poll. Overwriting is not allowed.

For example, the following code checks if the sender is registered as a board member.

 

 

Cast vote

Filename: cast-vote_transaction.js

Token owners registered as investors or board members are able to vote on any open poll. One vote costs 100 DOC tokens. Multiple votes on an answer are allowed because this shows that someone is willing to spend a lot of tokens to make a certain decision. Token holders only benefit from good decisions, so any vote is considered carefully. After the poll closes it is not possible to vote any more and the vote is rejected by the blockchain. The cast vote transaction checks if the vote asset is valid, if the poll is still open and if the sender is registered as a board member or investor.

The code below in the applyAsset method adds the vote.

  • If there are no votes, it simply adds a new vote asset with the first vote of the sender.
  • If the answer is already voted on, it increases the vote count of that answer.
  • If there are already votes but this is a new answer, it stores all the previous votes and adds the new answer with a value of 1.

 

 

API

The public API is available at: 167.179.98.242:4000. For a list of available endpoints see the API documentation on Lisk.io

 

Example calls:

Retrieve balance of an account: http://167.179.98.242:4000/api/accounts?address=10572594784286738319L

See the status of the node: http://167.179.98.242:4000/api/node/status

 

Extending DOC

The current version of Decentralized Organization Chain could be extended with small features such as setting a custom poll duration, adding a user type for founders or creating a “Create New Account” page. Or with new ways to move more structure and communication from a company to the DOC blockchain besides polls. For instance: Allowing founders to post monthly news in a blog format. Adding employee user types and awarding them automatically for certain achievements or paying them a monthly bonus in DOC tokens. Creating short and long term company goals and triggering certain actions upon success or failure.

There are so many possibilities with the custom transactions from the Lisk SDK. Having a decentralized company blockchain can increase trust, transparency and efficiency. Feel free to use the code on GitHub to explore and create your own versions!

 

For further details about the Decentralized Organization Chain project and the code, check out its GitHub repository

If you feel inspired and want to build your own proof of concept blockchain application, check out the Lisk Builders program. More information about the program and the application procedure can be found on the Lisk web page for the Lisk Builders program.

Disclaimer: This blog post was written by our community member, Korben3 (Lisk.chat username: korben3) as part of his participation in the Lisk Builders program. 

 

Korben3

Korben3 is a full-stack developer based in the Netherlands with eight Lisk projects under his belt. He is a member of the Lisk.Builders developer community as well as Sidechain Solutions, a software solutions company supporting the Lisk ecosystem. Korben3 has built tools including Lisk Wall, Lisk Land, Lisk Pay 2 Enter, Lisk Pay 2 Download, Lisk Delegate Visualization and EliteX Market Data Telegram Bot. View them all on Lisk Discovery.