【发布时间】:2018-06-23 21:47:10
【问题描述】:
我使用 arraylist 包含对象(块类)在 java 中实现了一个简单的区块链。
public static ArrayList<Block> blockchain = new ArrayList<Block>();
...和包含我需要存储到区块链中的交易的块类。
public Block(transaction data,String previousHash ) {
this.data = data;
this.previousHash = previousHash;
this.timeStamp = new Date().getTime();
this.hash = calculateHash();
}
事务类包含数据:文件病历的病历标题哈希.....
public transaction(String title,String date,String pointer,int version,int nbdoctor,int nbsdoctor ,byte[] patient
,String hashdata , ArrayList<byte []> permission , ArrayList<byte []> spermission ,byte[] newdoctorkey , byte[] newsdoctorkey ,
byte[] removedoctor ,byte[] sremovedoctor)
但我不知道如何从这个区块链中读取数据。 我想根据标题字段将数据放入事务对象中。 我想要一种快速的方法来访问区块链中的数据(进入数组列表)。
谢谢。
【问题讨论】:
标签: arraylist blockchain