Guest User

Untitled

a guest
Jul 6th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. SIMNET_NODES_ROOT=~/dcrdsimnetnodes
  6. MASTERNODE_ADDR=127.0.0.1:19555
  7. NODE1_ADDR=127.0.0.1:19501
  8. NODE2_ADDR=127.0.0.1:19502
  9. RPCUSER="USER"
  10. RPCPASS="PASS"
  11. WALLET_SEED="b280922d2cffda44648346412c5ec97f429938105003730414f10b01e1402eac"
  12. WALLET_MINING_ADDR="SsWKp7wtdTZYabYFYSc9cnxhwFEjA5g4pFc" # NOTE: This must be changed if the seed is changed.
  13.  
  14. mkdir -p "${SIMNET_NODES_ROOT}/"{master,1,2,wallet}
  15.  
  16. # masternode.conf
  17. cat > "${SIMNET_NODES_ROOT}/masternode.conf" <<EOF
  18. rpcuser=${RPCUSER}
  19. rpcpass=${RPCPASS}
  20. simnet=1
  21. logdir=${SIMNET_NODES_ROOT}/master/log
  22. datadir=${SIMNET_NODES_ROOT}/master/data
  23. listen=${MASTERNODE_ADDR}
  24. connect=${NODE1_ADDR}
  25. connect=${NODE2_ADDR}
  26. miningaddr=${WALLET_MINING_ADDR}
  27. EOF
  28.  
  29. # node1.conf
  30. cat > "${SIMNET_NODES_ROOT}/node1.conf" <<EOF
  31. simnet=1
  32. logdir=${SIMNET_NODES_ROOT}/1/log
  33. datadir=${SIMNET_NODES_ROOT}/1/data
  34. listen=${NODE1_ADDR}
  35. connect=${MASTERNODE_ADDR}
  36. connect=${NODE2_ADDR}
  37.  
  38. EOF
  39.  
  40. # node2.conf
  41. cat > "${SIMNET_NODES_ROOT}/node2.conf" <<EOF
  42. simnet=1
  43. logdir=${SIMNET_NODES_ROOT}/2/log
  44. datadir=${SIMNET_NODES_ROOT}/2/data
  45. listen=${NODE2_ADDR}
  46. connect=${MASTERNODE_ADDR}
  47. connect=${NODE1_ADDR}
  48.  
  49. EOF
  50.  
  51. # dcrctl.conf
  52. cat > "${SIMNET_NODES_ROOT}/dcrctl.conf" <<EOF
  53. simnet=1
  54. rpcuser=${RPCUSER}
  55. rpcpass=${RPCPASS}
  56. EOF
  57.  
  58. # dcrwallet.conf
  59. cat > "${SIMNET_NODES_ROOT}/dcrwallet.conf" <<EOF
  60. simnet=1
  61. username=${RPCUSER}
  62. password=${RPCPASS}
  63. appdata=${SIMNET_NODES_ROOT}/wallet
  64. promptpass=1
  65. enablevoting=1
  66. enableticketbuyer=1
  67. ticketbuyer.nospreadticketpurchases=1
  68. ticketbuyer.maxperblock=5
  69. EOF
  70.  
  71. # dcrctlw.conf
  72. cat > "${SIMNET_NODES_ROOT}/dcrctlw.conf" <<EOF
  73. simnet=1
  74. wallet=1
  75. rpcuser=${RPCUSER}
  76. rpcpass=${RPCPASS}
  77. rpccert=${SIMNET_NODES_ROOT}/wallet/rpc.cert
  78. EOF
  79.  
  80. echo "Launch the dcrd simnet instances with the following config files:"
  81. echo "dcrd -C ${SIMNET_NODES_ROOT}/masternode.conf"
  82. echo "dcrd -C ${SIMNET_NODES_ROOT}/node1.conf"
  83. echo "dcrd -C ${SIMNET_NODES_ROOT}/node2.conf"
  84. echo ""
  85. echo "Create the wallet -- MAKE SURE TO USE THE PRINTED SEED!!!"
  86. echo "dcrwallet -C ${SIMNET_NODES_ROOT}/dcrwallet.conf --create"
  87. echo "Seed: ${WALLET_SEED}"
  88. echo ""
  89. echo "Launch the wallet:"
  90. echo "dcrwallet -C ${SIMNET_NODES_ROOT}/dcrwallet.conf"
  91. echo ""
  92. echo "To interface with the master dcrd node via dcrctl:"
  93. echo "dcrctl -C ${SIMNET_NODES_ROOT}/dcrctl.conf <command>"
  94. echo ""
  95. echo "To interface with the wallet via dcrctl:"
  96. echo "dcrctl -C ${SIMNET_NODES_ROOT}/dcrctlw.conf <command>"
  97. echo ""
  98. echo "To generate blocks with the CPU miner via dcrctl:"
  99. echo "dcrctl -C ${SIMNET_NODES_ROOT}/dcrctl.conf generate 1"
  100. echo ""
  101. echo "NOTE: Because the simnet difficulty is so low, the blocks will be found"
  102. echo "faster than the tickets can be purchased during the initial bringup, so"
  103. echo "it is recommended to generate enough blocks to reach the voting height"
  104. echo "with a script that sleeps after each block is generated as follows:"
  105. echo ""
  106. echo "for i in \$(seq 1 1 144); do"
  107. echo "dcrctl -C ${SIMNET_NODES_ROOT}/dcrctl.conf generate 1"
  108. echo "sleep 1"
  109. echo "done"
Add Comment
Please, Sign In to add comment