
使用Kotlin实现的区块链基本逻辑!
源码地址
启动方式
启动参数添加 -Dserver.port=8080,启动不同的端口,模拟不同的节点。
假设目前启动了8080和8081两个端口:
- 通过POST http://localhost:8080/peer 来添加节点的互通。body为peer=ws://localhost:8081/endpoint
- 添加完成后,8080与8081节点即建立了链接
- 通过POST http://localhost:8080/block来添加区块。body为data=11111