-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (73 loc) · 3.12 KB
/
Copy pathMakefile
File metadata and controls
96 lines (73 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Load all env vars
ifneq (,$(wildcard .env))
include .env
export $(shell sed -nE "s/^([A-Za-z_][A-Za-z0-9_]*)=.*/\1/p" .env)
endif
define strip_quotes
$(subst ',,$(subst ",,$(1)))
endef
$(foreach v,$(shell sed -nE "s/^([A-Za-z_][A-Za-z0-9_]*)=.*/\1/p" .env),\
$(eval $(v) := $(call strip_quotes,$($(v)))))
BITCOIND=$(shell command -v bitcoind || command -v bitcoin-core.daemon)
bitcoin-start:
$(BITCOIND) -conf="$(CURDIR)/bitcoin.conf" -datadir="$(CURDIR)/bitcoin_data" --port=18444
bitcoin-mining:
chmod +x "$(CURDIR)/scripts/bitcoin.mining_block.sh"
"$(CURDIR)/scripts/bitcoin.mining_block.sh" $(address) $(block)
bitcoin-balance:
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" getbalance
# Pakai scantxoutset untuk balance address spesifik
bitcoin-balanceof:
@if [ -z "$(address)" ]; then \
echo "Usage: make bitcoin-balanceof address=<btc_address>"; exit 1; \
fi
@echo "Checking balance for: $(address)"
@bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" scantxoutset start "[\"addr($(address))\"]" 2>/dev/null | \
{ command -v jq >/dev/null 2>&1 && jq -r '.total_amount' || python3 -c "import sys, json; j=json.load(sys.stdin); print(j.get('total_amount',0))"; }
bitcoin-newwallet:
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" -named createwallet wallet_name="fradium" load_on_startup=true
bitcoin-utxo:
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" listunspent
bitcoin-newaddress:
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" getnewaddress "fradium"
bitcoin-getaddress:
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" getaddressesbylabel "fradium"
bitcoin-send:
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" sendtoaddress $(address) $(amount)
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" generatetoaddress 1 mtbZzVBwLnDmhH4pE9QynWAgh6H3aC1E6M
bitcoin-mine:
bitcoin-cli -conf="$(CURDIR)/bitcoin.conf" generatetoaddress 1 mtbZzVBwLnDmhH4pE9QynWAgh6H3aC1E6M
icp-transfer:
chmod +x "$(CURDIR)/scripts/icp.transfer_token.sh"
"$(CURDIR)/scripts/icp.transfer_token.sh" $(address) $(amount)
icp-balance:
chmod +x "$(CURDIR)/scripts/icp.check_balance.sh"
"$(CURDIR)/scripts/icp.check_balance.sh"
fradium-transfer:
chmod +x "$(CURDIR)/scripts/fradium.transfer_token.sh"
"$(CURDIR)/scripts/fradium.transfer_token.sh" $(address) $(amount)
fradium-balance:
chmod +x "$(CURDIR)/scripts/fradium.check_balance.sh"
"$(CURDIR)/scripts/fradium.check_balance.sh"
ckbtc-transfer:
chmod +x "$(CURDIR)/scripts/ckbtc.transfer_token.sh"
"$(CURDIR)/scripts/ckbtc.transfer_token.sh" $(address) $(amount)
ckbtc-balance:
chmod +x "$(CURDIR)/scripts/ckbtc.check_balance.sh"
"$(CURDIR)/scripts/ckbtc.check_balance.sh"
ckbtc-kyt:
dfx canister call ckbtc_kyt set_api_key '(record { api_key = "" })'
cketh-balance:
chmod +x "$(CURDIR)/scripts/cketh.check_balance.sh"
"$(CURDIR)/scripts/cketh.check_balance.sh"
cketh-transfer:
chmod +x "$(CURDIR)/scripts/cketh.transfer_token.sh"
"$(CURDIR)/scripts/cketh.transfer_token.sh" $(address) $(amount)
kill-port:
@echo "Killing process on port 4943..."
@PID=$$(lsof -t -i :4943); \
if [ -n "$$PID" ]; then \
kill -9 $$PID && echo "Port 4943 has been freed (PID $$PID killed)."; \
else \
echo "No process found on port 4943."; \
fi