The Simplest Blockchain with Twitter and OAuth (400 lines)

Hi, I'm leo_hio 極度消耗(しなさい) .
Keaton_Mask.png

This week,I wanted to make the simplest blockchain in this world by JavaScript and Json format.
Here we have this.
(the english ver is coming soon,pls use g translate for now ^^;)

In short, your retweeted counts will be token(happa). When you want to get your tweet retweeted,you can use happa token.

Algorithm

Process

(1) A Twitter account counts his retweeted tweet by TwitterAPI and increase number of his happa balance, make it as a new block.

(2) Next Twitter account check (1)'s increase of number by counting retweet by API,and make new block like (1) to add to (1)'s block.

~What can we do with this blockchain~

(1) Send happa by tweeting

(2) Have your tweet more retweeted

(3) Simple smart contract in 140 letters

無題のプレゼンテーション (14).jpg

~Why is this blockchain the simplest?~

(1) Because this blockchain is rather centrized

BlockChain is syncronized by my web site now.Next we should do it by broadcasting and cookies in browser.

(2) Because this blockchain is on Twitter(Layer 7) not on Internet(TCP/IP Layer3).

All difficult parts like P2P and Electronic signature are replaced by Twitter and OAuth.

(3) Not Proof of Work

Difficulty of a hash calculation is replaced by the difficulty of getting retweeted.It's galanteed by Twitter.We abandoned full decentrized policy and trustlessness.We chose simpleness and less line codes.

In short,this is a toy. We don't need Toyota's engines for toy cars.
Q: Why don't we use Ethereum instead of making new blockchain?
A: I don't want to pay GAS.I don't want to make complex and unreadable EVM byte codes.

pexels-photo-136320.jpeg

How can I use this?

This blockchain can be used for 2 things

(1) Light token for websites and applications with Twitter OAuth.

In this blockchain,tweets can be token in easiest way.You can change this by Copy and Rewrite (HardFork). And attach it on your web site.

(2) Rapid experiments and trials as a basic blockchain.

Blockchains are always BIG and COMPLEX because of their BIG business.They aren't cut out for small experiments in general.
On the other hand,event though this is a toy blockchian,there are many processings which should be coded to galantee blochchain functions because "blockchain" is a protocol on the premiss that malicious nodes exit in the ecosystem.

PLS HardFork by the process below
(1) Copy blockchain or this genesis-block(block number 0)
(2) Copy Client Code
(3) Launch WebSite to upload or download the blockchain,OR you construct a syncronize system.

(IMPORTANT) Code is protected by copyright.PLS don't forget to DM to us.
極度消耗(しなさい)CoRe

Code Detail

take a look at this CODE

function main() {

OAuth.popup('twitter').done(callbackGetInfo).fail(callbackError).always(callbackReturn);

}

All processing is here.
Authorizing with "callbackGetInfo"、and calling startMining function. In startMining,we have below.

easyBlockChainCheck().then(collectTweetData).then(checkAllChain, callbackError);

(1) We have the shallow check of blocks first.In that process,we are listing up the account names to download their timelines by TwitterAPI. Do that in "collectTweetData".

(2) Using these results,we check all of blocks deeply in checkAllChain,and decide which block to add the new block to.

(3) Finally,we call "make_block",and increase the number of your balance in the new block,upload that by API.

Happy HardFork

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now