Blockchain A simple implementation of blockchain i

我要开发同款
匿名用户2021年11月30日
111阅读

技术信息

系统类型
Web3
授权协议
Apache-2.0 License

作品详情

Asimpleimplemetatioofblockchai

Thisprojectaimstocreateasimpleimplemetatioofblockchaicoceptaddemostrateitiauserfriedlyway.

DesigCocept

Thisprojectcosistsoftwomaiparts:agetaditerface.

Aget

Aagetstadsforoepeerwhichisabletostoreadmieblocksitheetwork.EveryagetiscoectedtoalltheotheragetsitheetworktocostructaP2Pdistributedetwork.Thebasicfuctiosforaagetare:

Sedmessagetootheragets,iordertobroadcastitsewlymiedblockReceivemessagefromotheragets,iordertoreceiveblocksmiedbyotheragetsMie,validateadgrowblocksoitsowbloackchaiSyclatestblockchaiwithotheragets

Thealgorithmformiigisthekeyofablockchai.IthisprojectweolyuseSHA256hashtosimulatethemiigprocedure.

Iterface

AiterfaceimplemetedwithSprigbootisicludedithisprojecttodemostratetheusageoftheblockchai.Itmightmakepeoplefeellikeacetralizedmaagemetiterface,howeverweeedtouderstadthatagetscaalsoruidepedetly.TheiterfaceisRESTfuladallreturdataisijsoformat.Asiglepageapplicatioisalsoprovidedtovisualizetheblockchaicoceptiabetterway.

QuickStartStartserver

Navigatetoprojectrootdiradstarttheserver:

$gradlebootRuUsewebiterface

Opehttps://localhost:8080/ibrowseradtryitfromwebpage.Basicactiosare:

AddaagettotheetworkDeleteaagetfromtheetworkMieaewblockadbroadcasttotheetwork.Acolorschemeisusedtomarkdifferetblockscreatedbydifferetagets.

Userestiterface

Usecurldirectlyfromcommadlietoiteractwiththeserver:

Createewagetcurl-XPOST"https://localhost:8080/aget?ame=A1&port=1001"{"ame":"A1","port":1001,"blockchai":[{"idex":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"}]}curl-XPOST"https://localhost:8080/aget?ame=A2&port=1002"{"ame":"A2","port":1002,"blockchai":[{"idex":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"}]}curl-XPOST"https://localhost:8080/aget?ame=A3&port=1003"{"ame":"A3","port":1003,"blockchai":[{"idex":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"}]}Mieblockcurl-XPOST"https://localhost:8080/aget/mie?aget=A1"{"idex":1,"timestamp":1502194172250,"hash":"2461f27f811df15a969391c70f136869a282224e8cc6fe8b628d16a499515d21","previousHash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480"}curl-XPOST"https://localhost:8080/mie?ame=A3"{"timestamp":1502194200235,"status":404,"error":"NotFoud","message":"Nomessageavailable","path":"/mie"}Showagetsadblockscurlhttps://localhost:8080/aget?ame=A1{"ame":"A1","port":1001,"blockchai":[{"idex":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"},{"idex":1,"timestamp":1502194172250,"hash":"2461f27f811df15a969391c70f136869a282224e8cc6fe8b628d16a499515d21","previousHash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480"}]}curlhttps://localhost:8080/aget?ame=A3{"ame":"A3","port":1003,"blockchai":[{"idex":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"},{"idex":1,"timestamp":1502194172250,"hash":"2461f27f811df15a969391c70f136869a282224e8cc6fe8b628d16a499515d21","previousHash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480"}]}curlhttps://localhost:8080/aget/allRemoveagetcurl-XDELETEhttps://localhost:8080/aget/allChagelog20170902Letewlyaddedagetsycthelatestblockchaifrompeers.20170818Addawebiterface.20170807Serversidecodebasewithrestiterface.

Thisprojectisispiredbyaivechai.

功能介绍

A simple implementation of blockchain This project aims to create a simple implementation of bloc...

示例图片

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论