run-local-node-test.sh 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Location that will be mounted as the /data volume in containers
  2. # This is how we access the initial members and balances files from
  3. # the containers and where generated chainspec files will be located.
  4. DATA_PATH="test-data"
  5. # Initial account balance for Alice
  6. # Alice is the source of funds for all new accounts that are created in the tests.
  7. ALICE_INITIAL_BALANCE=100000000
  8. rm -Rf ${DATA_PATH}
  9. mkdir -p ${DATA_PATH}
  10. echo "{
  11. \"balances\":[
  12. [\"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\", ${ALICE_INITIAL_BALANCE}]
  13. ]
  14. }" > ${DATA_PATH}/initial-balances.json
  15. # Make Alice a member
  16. echo '
  17. [{
  18. "member_id": 0,
  19. "root_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  20. "controller_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  21. "handle":"alice_with_a_long_handle",
  22. "avatar_uri":"https://alice.com/avatar.png",
  23. "about":"Alice",
  24. "name": "Alice",
  25. "registered_at_time": 0
  26. },
  27. {
  28. "member_id": 1,
  29. "root_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
  30. "controller_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
  31. "handle":"bob_with_a_long_handle",
  32. "avatar_uri":"https://bob.com/avatar.png",
  33. "about":"Bob",
  34. "name": "Bob",
  35. "registered_at_time": 0
  36. }
  37. ]
  38. ' > ${DATA_PATH}/initial-members.json
  39. # Create a chain spec file
  40. ./target/release/chain-spec-builder generate -a 2 -e 2 -k ${DATA_PATH} --chain-spec-path ${DATA_PATH}/chain-spec.json --initial-balances-path ${DATA_PATH}/initial-balances.json --initial-members-path ${DATA_PATH}/initial-members.json --deployment live > ${DATA_PATH}/seeds
  41. jq -c '.id = "js_babylon_test"' ${DATA_PATH}/chain-spec.json > tmp.$$.json && mv tmp.$$.json ${DATA_PATH}/chain-spec.json
  42. jq -c '.protocolId = "js/babylon/test"' ${DATA_PATH}/chain-spec.json > tmp.$$.json && mv tmp.$$.json ${DATA_PATH}/chain-spec.json
  43. timeout 3s ./target/release/joystream-node --base-path ${DATA_PATH}/alice3 --validator --chain ${DATA_PATH}/chain-spec.json
  44. timeout 3s ./target/release/joystream-node --base-path ${DATA_PATH}/bob4 --validator --port 30334 --ws-port 9945 --chain ${DATA_PATH}/chain-spec.json
  45. mv ${DATA_PATH}/auth-0/* ${DATA_PATH}/alice3/chains/js_babylon_test/keystore
  46. mv ${DATA_PATH}/auth-1/* ${DATA_PATH}/bob4/chains/js_babylon_test/keystore
  47. rm -Rf ${DATA_PATH}/alice3/chains/js_babylon_test/db
  48. rm -Rf ${DATA_PATH}/bob4/chains/js_babylon_test/db
  49. # RUN
  50. #./target/release/joystream-node --base-path test-data/alice3 --validator --chain test-data/chain-spec.json --pruning=archive --log runtime,txpool,transaction-pool
  51. #./target/release/joystream-node --base-path test-data/bob4 --validator --port 30334 --ws-port 9945 --chain test-data/chain-spec.json --pruning=archive --log runtime,txpool,transaction-pool