So, it took three days of coding, but i’ve finished the first ever bank on blockchain.

Regular banks take deposits, promising an interest and give away loans, with higher interest. The difference help them to cover ‘bad debts’ and even earn some profits. The reason, why people return the loans to bank is that they are controlled by the state, if they will not return loan, they will be prosecuted by police, might loose their property etc.

So, it requires quite complicated system to get the opportunity to give away loans and have a relatively low rate of bad debts. This system requires verification, property rights management, maybe even integration with real world goverments… This is still a far away future of blockchain.

If Nebulas team can give away thousands of NAS tokens to promote DApps development around people, why can’t i give away several hundreds for trying to make people understand, how blockchain works?

So here it is, the alpha version of future banking system.

https://hold.nebulas.ru/

So far all it can do is to HOLD your nebulas on smart contract, paying out a small amount of premium. I thought about going for Ponzt schema, which would make payouts much more attractive, but decided we need some education, instead of hype.

The idea of blockchain financial projects, is that they don’t need any audits, balance checks or anything like this. You always know the smart contract address, you can always check, how many supplies it has and make sure, that it has enough tokens to cover its liabilities. More than that, you can check the source (or we can organize some kind of public verification, where experts checks smart contracts and rate them), and see that the contract owner can not have access to your funds.

Let’s try and study smart contract source, you can check the source by hash here. We are interested, if there is any way to withdraw funds, to steal from the bank. Just hit CTRL + F and look for ‘Blockchain.transfer’, this is the only method of getting funds out of contract. We can see it in several places: in ‘withdraw’ function, which processes the payouts, in ‘cancel’ function, which allows to cancel deposits and in ‘retrieveSupply’ function.

First two are absolutely legit, but what does the third one for? Luckily the function is very simple. Here is the code:

retrieveSupply: function(retrieveAmountRAW) {

if (!this._isOwner()) {

throw new Error("Only " + this._owner + " can change supply");

} else if (!this._isEmpty()) {

throw new Error("Please set transaction value to 0");

} let withdrawalAddress = Blockchain.transaction.from; let retrieveAmount = new BigNumber(retrieveAmountRAW);

let currentSupply = this.supply; if (retrieveAmount.gt(currentSupply)) {

throw new Error("You can retrieve only " + currentSupply + " WEI from supply.");

} else if (retrieveAmount.lt(1)) {

throw new Error("Bad retrieve amount, please provide amount in WEI");

} // Decrease our supplies

this.supply = currentSupply.sub(retrieveAmount); // Proceed with withdrawal

let withdrawalResult = Blockchain.transfer(withdrawalAddress, retrieveAmount); if (!withdrawalResult) {

throw new Error("Unable to retrieve supply " + retrieveAmount + " WEI");

}

}

First it checks if it is called by the owner, then it compares requested amount for withdrawal with variable ‘supply’ and don’t allow to withdraw more, than it.

Digging deeper in the code for what is stored in ‘supply’ variable, we can notice, that it is decreased after each payout and each deposit. It is the money, the bank have ‘available’ to guarantee payout of future interest. So while owner can take this money any time, he can not take money, which guarantee interest for deposits, not even speaking about taking deposits themselves.

When you want to put money into the bank, you want to look for something reputable, you want to hear good reviews, you want them to show how much money they have, this way they can get your trust and, eventually, money. But we all heard, that even the best of the banks can crash, ruining their client’s savings.

It is the whole different thing with blockchain, you don’t need opinions, you don’t need audits or any guarantees. Math is the only guarantee, 3 is always larger than 2, if there is condition in contract which disallows owner to withdraw more, than his earnings — this means that owner will never be able to get clients funds.

Of course, a lot of work needs to be done, to build this ecosystem, where smart contracts are reviewed by experts and enterprises are being under constant monitoring of community and clients. But we are making first steps here, so far it is interesting and entertaining. Pleas join!