架构设计:
服务用户(和用户行为有关)
- 捕获用户输入、展示处理结果
- 自己相当于 View,背后有对应的 Controller/Model
- 核心的有:查账、转账,账号系统
服务自己(和用户行为无关,启动软件就自动运行)
- 自己就是一个服务(goroutine),以及与之关联的 .P2P、Mempool 也是服务
- 启动时偷偷做事,如同步区块数据(和链有关)
- 核心的有:同步块数据、同步交易数据
软件 CMD
derod
DERO : A secure, private blockchain with smart-contracts
Usage:
derod [--help] [--version] [--testnet] [--debug] [--sync-node] [--boltdb | --badgerdb] [--disable-checkpoints] [--socks-proxy=<socks_ip:port>] [--data-dir=<directory>] [--p2p-bind=<0.0.0.0:18089>] [--add-exclusive-node=<ip:port>]... [--add-priority-node=<ip:port>]... [--min-peers=<11>] [--rpc-bind=<127.0.0.1:9999>] [--lowcpuram] [--mining-address=<wallet_address>] [--mining-threads=<cpu_num>] [--node-tag=<unique name>]
derod -h | --help
derod --version
Options:
-h --help Show this screen.
--version Show version.
--testnet Run in testnet mode.
--debug Debug mode enabled, print log messages
--boltdb Use boltdb as backend (default on 64 bit systems)
--badgerdb Use Badgerdb as backend (default on 32 bit systems)
--disable-checkpoints Disable checkpoints, work in truly async, slow mode 1 block at a time
--socks-proxy=<socks_ip:port> Use a proxy to connect to network.
--data-dir=<directory> Store blockchain data at this location
--rpc-bind=<127.0.0.1:9999> RPC listens on this ip:port
--p2p-bind=<0.0.0.0:18089> p2p server listens on this ip:port, specify port 0 to disable listening server
--add-exclusive-node=<ip:port> Connect to specific peer only
--add-priority-node=<ip:port> Maintain persistant connection to specified peer
--sync-node Sync node automatically with the seeds nodes. This option is for rare use.
--min-peers=<11> Number of connections the daemon tries to maintain
--lowcpuram Disables some RAM consuming sections (deactivates mining/ultra compact protocol etc).
--mining-address=<wallet_address> This address is rewarded when a block is mined sucessfully
--mining-threads=<cpu_num> Number of CPU threads for mining
--node-tag=<unique name> Unique name of node, visible to everyone
help
diff
dev_verify_pool
dev_verify_chain_doublespend
mempool_flush
mempool_delete_tx
mempool_print
peer_list
print_bc
print_block
print_height
print_tx
status
start_mining
stop_mining
sync_info
version
bye
exit
quit
架构设计:
启动、管理服务(本身是 for 死循环,一并启动管理 Blockchain、Mempool、P2P、RPC、Store 等其它服务)
命令处理、核心业务层(解析输入命令,调用对应服务进行处理)