資源簡介
Java實現區塊鏈,成語接龍實例。
代碼片段和文件信息
package?tech.topcoder.blockchain;
import?java.sql.Timestamp;
import?org.apache.commons.lang.StringUtils;
public?class?Block?{
????int?index;?//?索引
????String?proof;?//?工作量證明,在這個例子里面,其實就是一個經過驗證的正確的成語
????String?previousHash;?//?前一個區塊的Hash值
????Timestamp?createTime;?//?區塊創建時間戳
????/*
?????*?數據塊
?????*
?????*?用戶每接上一個成語,會得到系統10元錢的獎勵,同時會贏得前面一個用戶的2元錢?數據區同時需要記錄自己的用戶名和回答出上一個成語的用戶名
?????*
?????*/
????String?sender;?//?回答出上一個成語的用戶名
????String?recipient;?//?回答出當前這個成語的用戶名
????final?int?moneyAward?=?10;?//?系統獎勵,數額固定
????final?int?moneyWin?=?2;?//?贏取獎勵,數額固定
????public?Block(int?index?String?proof?String?hash?Timestamp?t?String?sender?String?recipient)?{
????????this.index?=?index;
????????this.proof?=?proof;
????????this.previousHash?=?hash;
????????this.createTi
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1276??2018-04-21?17:59??BlockChain\.classpath
?????文件???????1086??2018-03-12?15:36??BlockChain\.project
?????文件????????639??2018-03-12?15:24??BlockChain\.settings\.jsdtscope
?????文件????????162??2018-03-12?16:30??BlockChain\.settings\org.eclipse.core.resources.prefs
?????文件????????430??2018-03-12?15:24??BlockChain\.settings\org.eclipse.jdt.core.prefs
?????文件????????106??2018-03-12?15:36??BlockChain\.settings\org.eclipse.ltk.core.refactoring.prefs
?????文件?????????90??2018-03-12?15:11??BlockChain\.settings\org.eclipse.m2e.core.prefs
?????文件?????????86??2018-03-12?15:36??BlockChain\.settings\org.eclipse.m2e.wtp.prefs
?????文件????????597??2018-03-12?15:24??BlockChain\.settings\org.eclipse.wst.common.component
?????文件????????292??2018-03-12?15:34??BlockChain\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件?????????49??2018-03-12?15:24??BlockChain\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2018-03-12?15:24??BlockChain\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件?????????50??2018-03-12?15:24??BlockChain\.settings\org.eclipse.wst.validation.prefs
?????文件?????????87??2018-03-12?15:36??BlockChain\.settings\org.eclipse.wst.ws.service.policy.prefs
?????文件???????1617??2018-03-12?17:27??BlockChain\pom.xm
?????文件???????2615??2018-03-13?10:11??BlockChain\src\main\java\tech\topcoder\blockchain\Block.java
?????文件???????9382??2018-03-13?11:01??BlockChain\src\main\java\tech\topcoder\blockchain\BlockChain.java
?????文件??????24868??2018-03-12?17:34??BlockChain\src\main\java\tech\topcoder\blockchain\DateUtil.java
?????文件????????406??2018-03-12?17:17??BlockChain\src\main\java\tech\topcoder\blockchain\InitListener.java
?????文件???????1517??2018-03-13?10:57??BlockChain\src\main\webapp\answer.jsp
?????文件????????309??2018-03-13?08:56??BlockChain\src\main\webapp\chain.jsp
?????文件???????1822??2018-03-13?11:04??BlockChain\src\main\webapp\detail.jsp
?????文件???????1502??2018-03-13?09:31??BlockChain\src\main\webapp\index.jsp
?????文件??????93113??2018-03-12?17:38??BlockChain\src\main\webapp\js\jquery-1.10.2.js
?????文件????????614??2018-03-13?09:13??BlockChain\src\main\webapp\login.jsp
?????文件????????566??2018-03-12?18:04??BlockChain\src\main\webapp\sync.jsp
?????文件????????757??2018-03-12?17:13??BlockChain\src\main\webapp\WEB-INF\web.xm
?????文件???????2749??2018-04-21?18:02??BlockChain\target\classes\tech\topcoder\blockchain\Block.class
?????文件???????8925??2018-04-21?18:02??BlockChain\target\classes\tech\topcoder\blockchain\BlockChain.class
?????文件??????12757??2018-04-21?18:02??BlockChain\target\classes\tech\topcoder\blockchain\DateUtil.class
............此處省略32個文件信息
- 上一篇:ssm入門級(mysql數據庫)
- 下一篇:java 錄屏 小工具源碼(idea)
評論
共有 條評論