bcloop 0.1.0

A tool for processing Bitcoin-like blockchain data
Documentation
run:
	cargo build -r && ./target/release/bcloop

lint:
	cargo +nightly fix --allow-dirty --allow-staged
	cargo +nightly fmt

check:
	cargo +nightly fmt --check
	cargo clippy --workspace --all-targets --all-features -- -D warnings
	cargo check --workspace --release --locked

update:
	cargo upgrade -i

# -----------------------------------------------------------------------------

HOST=user@mele.local

define EXEC
	ssh -tt $(HOST) 'source ~/.profile; cd /data/bcloop; $(1)'
endef

deploy:
	@rsync -arc --delete-after --exclude={'.git','target','data'} ./ $(HOST):/data/bcloop
	$(call EXEC,cargo build -r)

remote: deploy
	$(call EXEC,./target/release/bcloop utxodump /data/volumes/bch/blocks/ ./data/bch.csv)

blf: deploy
	$(call EXEC, rm -rf ./data; mkdir -p ./data)
	$(call EXEC,./target/release/bcloop utxodump /data/volumes/ltc/blocks/ ./data/ltc.csv)
	$(call EXEC,./target/release/bcloop utxodump /data/volumes/bch/blocks/ ./data/bch.csv)
	$(call EXEC,./target/release/bcloop utxodump /data/volumes/btc/blocks/ ./data/btc.csv)
	rsync -arc --progress --ignore-times $(HOST):/data/bcloop/data/ ./data
	
blf-gen:
	rsync -arc --progress --ignore-times $(HOST):/data/bcloop/data/ ./data
	cargo build -r
	rm -rf /tmp/wals.blf
	@echo "---"
	./target/release/bcloop utxo160 ./data/btc.csv | ../ecloop/ecloop blf-gen -n 200000000 -o /tmp/wals.blf
	./target/release/bcloop utxo160 ./data/bch.csv | ../ecloop/ecloop blf-gen -n 200000000 -o /tmp/wals.blf
	./target/release/bcloop utxo160 ./data/ltc.csv | ../ecloop/ecloop blf-gen -n 200000000 -o /tmp/wals.blf