-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtutorial-excerpt.sh
executable file
·123 lines (83 loc) · 2.17 KB
/
tutorial-excerpt.sh
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
set -x
shopt -s expand_aliases
source ./aliases.sh
# Wait for bitcoin node to finish startup and respond to commands
until b-cli getchaintips
do
echo "Waiting for bitcoin node to finish loading..."
sleep 2
done
# create default wallet if it doesn't exist
b-cli createwallet "" || true
b-cli rescanblockchain
b-cli getwalletinfo
# Wait for e1 node to finish startup and respond to commands
until e1-cli getchaintips
do
echo "Waiting for e1 to finish loading..."
sleep 2
done
e1-cli createwallet "" || true
e1-cli rescanblockchain
e1-cli getwalletinfo
# Wait for e2 node to finish startup and respond to commands
until e2-cli getchaintips
do
echo "Waiting for e2 to finish loading..."
sleep 2
done
e2-cli createwallet "" || true
e2-cli rescanblockchain
e2-cli getwalletinfo
# Exit on error
set -o errexit
### Basic Operations ###
ADDRGENB=$(b-cli getnewaddress)
ADDRGEN1=$(e1-cli getnewaddress)
ADDRGEN2=$(e2-cli getnewaddress)
e1-cli sendtoaddress $(e1-cli getnewaddress) 21000000 "" "" true
e1-cli generatetoaddress 101 $ADDRGEN1
sleep 10
e1-cli sendtoaddress $(e2-cli getnewaddress) 10500000 "" "" false
e1-cli generatetoaddress 101 $ADDRGEN1
sleep 10
e1-cli getwalletinfo
e2-cli getwalletinfo
ADDR=$(e2-cli getnewaddress)
echo $ADDR
e2-cli getaddressinfo $ADDR
TXID=$(e2-cli sendtoaddress $ADDR 1)
sleep 10
e1-cli getrawmempool
e2-cli getrawmempool
e1-cli getblockcount
e2-cli getblockcount
e2-cli generatetoaddress 1 $ADDRGEN2
sleep 10
e1-cli getrawmempool
e2-cli getrawmempool
e1-cli getblockcount
e2-cli getblockcount
e2-cli gettransaction $TXID
# Ignore error
set +o errexit
echo "This may error - that is ok, not aware of tx"
e1-cli gettransaction $TXID
# Exit on error
set -o errexit
e1-cli getrawtransaction $TXID 1
e1-cli importaddress $ADDR
e1-cli gettransaction $TXID true
e1-cli importblindingkey $ADDR $(e2-cli dumpblindingkey $ADDR)
e1-cli gettransaction $TXID true
### Issued Assets ###
e1-cli getwalletinfo
e1-cli dumpassetlabels
ISSUE=$(e1-cli issueasset 100 1)
ASSET=$(echo $ISSUE | jq -r '.asset')
TOKEN=$(echo $ISSUE | jq -r '.token')
ITXID=$(echo $ISSUE | jq -r '.txid')
IVIN=$(echo $ISSUE | jq -r '.vin')
echo $ASSET
e1-cli listissuances