11
2- shopt -s expand_aliases
3-
4- rm -r ~ /elementsdir1
5- rm -r ~ /elementsdir2
6- rm -r ~ /bitcoindir
7- mkdir ~ /elementsdir1
8- mkdir ~ /elementsdir2
9- mkdir ~ /bitcoindir
2+ # # Preparations
103
114# First we need to set up our config files to walk through this demo
12-
13- cat << EOF > ~/elementsdir1/elements.conf
14- # Standard bitcoind stuff
15- rpcuser=user1
16- rpcpassword=password1
17- rpcport=18884
18- port=18886
19-
20- # Over p2p we will only connect to local other elementsd
21- connect=localhost:18887
22-
23- regtest=1
24- daemon=1
25- # Make sure you set listen after -connect, otherwise neither
26- # will accept incoming connections!
27- listen=1
28- # Just for looking at random txs
29- txindex=1
30-
31- # This is the script that controls pegged in funds in Bitcoin network
32- # Users will be pegging into a P2SH of this, and the "watchmen"
33- # can then recover these funds and send them to users who desire to peg out.
34- # This template is 1-of-1 checkmultisig
35- #fedpegscript=5121<pubkey>51ae
36-
37- # This is the script that controls how blocks are made
38- # We have to supply a signature that satisfies this to create
39- # a valid block.
40- #signblockscript=5121<pubkey2>51ae
41-
42- # We want to validate pegins by checking with bitcoind if header exists
43- # in best known chain, and how deep. We combine this with pegin
44- # proof included in the pegin to get full security.
45- validatepegin=1
46-
47- # If in the same datadir and using standard ports, these are unneeded
48- # thanks to cookie auth. If not, like in our situation, elementsd needs
49- # more info to connect to bitcoind:
50- mainchainrpcport=18888
51- mainchainrpcuser=user3
52- mainchainrpcpassword=password3
53- EOF
54-
55- cat << EOF > ~/elementsdir2/elements.conf
56- rpcuser=user2
57- rpcpassword=password2
58- rpcport=18885
59- port=18887
60- connect=localhost:18886
61-
62- regtest=1
63- daemon=1
64- listen=1
65- txindex=1
66-
67- #fedpegscript=51<pubkey>51ae
68- #signblockscript=51<pubkey2>51ae
69-
70- mainchainrpcport=18888
71- mainchainrpcuser=user3
72- mainchainrpcpassword=password3
73- validatepegin=1
74- EOF
75-
76- cat << EOF > ~/bitcoindir/bitcoin.conf
77- rpcuser=user3
78- rpcpassword=password3
79- rpcport=18888
80- port=18889
81-
82- regtest=1
83- testnet=0
84- daemon=1
85- txindex=1
86- EOF
5+ # Let's have some testing user directories for 1 bitcoin node and 2 elements nodes.
6+ rm -r ~ /bitcoindir ; rm -r ~ /elementsdir1 ; rm -r ~ /elementsdir2
7+ mkdir ~ /bitcoindir ; mkdir ~ /elementsdir1 ; mkdir ~ /elementsdir2
8+
9+ # Also configure the nodes by copying the configuration files from
10+ # this directory (and read them):
11+ cp ./contrib/assets_tutorial/bitcoin.conf ~ /bitcoindir/bitcoin.conf
12+ cp ./contrib/assets_tutorial/elements1.conf ~ /elementsdir1/elements.conf
13+ cp ./contrib/assets_tutorial/elements2.conf ~ /elementsdir2/elements.conf
14+
15+ # Set some aliases:
16+ cd src
17+ shopt -s expand_aliases
8718
8819ELEMENTSPATH=" ."
8920BITCOINPATH=" ."
@@ -104,6 +35,10 @@ b-dae
10435e1-dae
10536e2-dae
10637
38+ # Alternatively, you can set validatepegin=0 in their configs and don't
39+ # run the bitcoin node, but it is necessary for the two way peg parts of
40+ # this tutorial.
41+
10742# Prime the chain, see "immature balance" holds all funds until genesis is mature
10843e1-cli getwalletinfo
10944
0 commit comments