我已经使用arraylist容器对象(块类)在java中实现了一个简单的区块链。
public static ArrayList<Block> blockchain = new ArrayList<Block>();
..。和block类,包含我需要存储到区块链中的事务。
public Block(transaction data,String previousHash ) {
this.data = data;
this.previousHash = previousHash;
this.timeStamp = new Dat
查看各种令牌实现(例如这里和这里)的源代码,它们具有以下API:
// presume can only be "called" by owner.
Transfer(address to, number amount)
// sender (exchange) must be authorised by owner
Transfer(address from, address to, number value) {
require(balanceOf[from] >= value);
balanceOf[from] -= value;
b