run-test-node.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env bash
  2. set -e
  3. SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
  4. cd $SCRIPT_PATH
  5. # Location used to store chain data, generated spec file and initial members
  6. # and balances for the test chain.
  7. DATA_PATH=./data
  8. # Initial account balance for Alice
  9. # Alice is the source of funds for all new accounts that are created in the tests.
  10. ALICE_INITIAL_BALANCE=100000000
  11. mkdir -p ${DATA_PATH}
  12. echo "{
  13. \"balances\":[
  14. [\"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\", ${ALICE_INITIAL_BALANCE}]
  15. ]
  16. }" > ${DATA_PATH}/initial-balances.json
  17. # Make Alice a member
  18. echo '
  19. [{
  20. "member_id": 0,
  21. "root_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  22. "controller_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  23. "handle":"alice_with_a_long_handle",
  24. "avatar_uri":"https://alice.com/avatar.png",
  25. "about":"Alice",
  26. "name": "Alice",
  27. "registered_at_time": 0
  28. },
  29. {
  30. "member_id": 1,
  31. "root_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
  32. "controller_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
  33. "handle":"bob_with_a_long_handle",
  34. "avatar_uri":"https://bob.com/avatar.png",
  35. "about":"Bob",
  36. "name": "Bob",
  37. "registered_at_time": 0
  38. }
  39. ]
  40. ' > ${DATA_PATH}/initial-members.json
  41. function cleanup() {
  42. rm -Rf ${DATA_PATH}/alice
  43. }
  44. trap cleanup EXIT
  45. # Create a chain spec file
  46. ../../target/release/chain-spec-builder new -a Alice \
  47. --chain-spec-path ${DATA_PATH}/chain-spec.json \
  48. --initial-balances-path ${DATA_PATH}/initial-balances.json \
  49. --initial-members-path ${DATA_PATH}/initial-members.json \
  50. --deployment dev \
  51. --sudo-account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
  52. ../../target/release/joystream-node --base-path ${DATA_PATH}/alice \
  53. --validator --chain ${DATA_PATH}/chain-spec.json --alice --unsafe-ws-external --rpc-cors all