nodes = 1
index = 4
Join = false
webrtc = false
chainid = 1024


# generate keys and peers.json file
install:
	docker load < cmpd.tar
	mkdir /tmp/tmpbin && cp bin/* /tmp/tmpbin

conf :
	@rm -rf conf
	@PATH=/tmp/tmpbin:${PATH} CHAINID=${chainid} ./scripts/build-conf.sh $(nodes)  $(webrtc)
	@sed -i 's/300ms/1000ms/g' conf/deploy/node1/config/config.toml 
	@chown ${USER}:${USER} -R ./conf

backup: stop
	cp -r conf/deploy conf/back$(shell date +%m%d-%H%M)

start:
	./scripts/run-testnet.sh $(nodes) $(Join) $(webrtc)

stop:
	./scripts/stop-testnet.sh

account:
	@echo "initial account mykey10 private key:"
	@PATH=/tmp/tmpbin:${PATH} cmpcli --home ./conf/backup/clicfg.all.address keys unsafe-export-eth-key mykey10


reset:
	./scripts/stop-testnet.sh
	rm -rf conf/deploy
	cp -r conf/back0712-1439  conf/deploy 
	./scripts/run-testnet.sh $(nodes) $(Join) $(webrtc)

clean:
	@rm -rf conf/deploy




.PHONY: up build conf start watch stop show bombard send join leave demo backup account reset
