Smart Contract for Swarm Redistribution using flat tax, 180 lines of code

in #basicincome8 years ago (edited)

Swarm Redistribution uses transaction-pathways to redistribute wealth, extracts tax on each transaction, and shares it with a swarm of nodes whose branching schemes are connected to the transaction being taxed.

Ethereum, a blockchain computer and a new type of state-technology, makes it easy to build and deploy smart-contracts, and allows anyone to build decentralized applications which can do what was previously only possible to do with government institutions.

To build a Swarm Redistribution contract, I used the Ethereum standard token framework to issue a coin, RES. To learn about tokens on Ethereum, have a look at https://blog.ethereum.org/2015/12/03/how-to-build-your-own-cryptocurrency/

The RES smart-contracts issues a coin, it is secured by the Ethereum blockchain, and ready to be used.

To separate the token standard, which is not exclusive to my project, the Swarm Redistribution contract is a separate contract, and it includes the token.

This PoC uses a fixed tax. There are no Taxemes in it, and it is a chance to test the swarm-redistribution idea.

When a transaction of RES is made, the Swarm Redistribution contract creates a dividend pathway. These are the transaction-pathways which are used to redistribute wealth.

The branching process in the Resilience protocol is chronological. Each node will grow a branch from every point in time when they receive a transaction. If P makes a transaction to R, then P will only receive shares from transactions which R makes after that point in time.

Transfer() invokes SwarmRedistribution(_to, taxCollected), which in turn invokes iterateThroughSwarm(). The function looks at all the dividend pathways which are connected to the address that receives the transaction, _to, and then looks at all the dividend pathways that are connected to each single address which had a dividend pathway to _to, and so on. If _to has no dividend pathways connected to it, then the tax is returned to the sender.

The tax (taxCollected) is then shared between all human accounts in that swarm, and all dividend pathways have the taxed amount deducted from them, which means that they are gradually used up, they decay similar to a mycelium.

View the contract on GitHub, SwarmRedistribution.sol

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 61937.20
ETH 3004.64
USDT 1.00
SBD 2.49