Agent-Based Simulation of Blockchains