Skip to content

Latest commit

 

History

History
185 lines (135 loc) · 8.6 KB

README.md

File metadata and controls

185 lines (135 loc) · 8.6 KB

License GitHub stars

neo3-privatenet-docker

🔥⚡🔥⚡🔥 Run Neo N3 blockchain nodes for development in record time! 🔥⚡🔥⚡🔥

You're 3 commands away to set up a Neo N3 blockchain private network.

🎉 Highlights

  • 💚 This repository relies on git sub-modules pointing to the official neo repository. Then, you can adjust the reference if you want to rely on the latest or an specific commit!
  • 🚀 The neo-cli image is built from a lean Dockerfile.
  • 💯 Includes all available plugins from the neo/src/Plugins!
  • 💥 It just fucking works.

⭐️ Ah, we love GitHub stars to keep our motivation up to the roof! 😉

🚨 Dependencies

🏃‍♂️ How to Run

git clone --recurse-submodules https://github.com/AxLabs/neo3-privatenet-docker.git
cd neo3-privatenet-docker
docker-compose up

Then, check the running privatenet:

docker ps

If you want to stop everything and start from scratch:

docker-compose down -v

After you change something in the config files and want to rebuild everything, without docker cache, run the following:

docker-compose build --no-cache

🎯 Test a bit through JSON-RPC

  • Get the latest block index of neo-client1:
curl http://127.0.0.1:10332 -d '{"jsonrpc":"2.0","method":"getblockcount","params":[],"id":1}'
  • Open the wallet of the neo-consensus through JSON-RPC (only for test purposes!):
curl http://127.0.0.1:40332 -d '{"jsonrpc":"2.0","method":"openwallet","params":["wallet.json","neo"],"id":1}'
  • List the addresses in neo-consensus wallet:
curl http://127.0.0.1:40332 -d '{"jsonrpc":"2.0","method":"listaddress","params":[],"id":1}'
  • Get all NEP-17 balance of neo-consensus' address NXXazKH39yNFWWZF5MJ8tEN98VYHwzn7g3, specifically:
curl http://127.0.0.1:40332 -d '{"jsonrpc":"2.0","method":"getnep17balances","params":["NXXazKH39yNFWWZF5MJ8tEN98VYHwzn7g3"],"id":1}'
  • Send 100 NEO from neo-consensus' address NXXazKH39yNFWWZF5MJ8tEN98VYHwzn7g3 to neo-client1's address NdihqSLYTf1B1WYuzhM52MNqvCNPJKLZaz:
curl http://127.0.0.1:40332 -d '{"jsonrpc":"2.0","method":"sendfrom","params":["0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","NXXazKH39yNFWWZF5MJ8tEN98VYHwzn7g3", "NdihqSLYTf1B1WYuzhM52MNqvCNPJKLZaz",100],"id":1}'
  • Open the wallet of the neo-client1 through JSON-RPC (only for test purposes!):
curl http://127.0.0.1:10332 -d '{"jsonrpc":"2.0","method":"openwallet","params":["wallet.json","neo"],"id":1}'
  • Get all NEP-17 balance of neo-client1' address NdihqSLYTf1B1WYuzhM52MNqvCNPJKLZaz (wait 15 seconds before executing the command, due to the block generation interval):
curl http://127.0.0.1:10332 -d '{"jsonrpc":"2.0","method":"getnep17balances","params":["NdihqSLYTf1B1WYuzhM52MNqvCNPJKLZaz"],"id":1}'

🔨 Useful CLI commands

This is just a collection of useful CLI commands in case you need them.

  • Designate the Oracle role in the Role Management native contract:

First, connect to the neo-consensus:

docker exec -it neo-consensus screen -r

Then, in the CLI, enter the following:

invoke 0x49cf4e5378ffcd4dec034fd98a174c5491e395e2 designateAsRole [{"type":"Integer","value":8},{"type":"Array","value":[{"type":"PublicKey","value":"02607a38b8010a8f401c25dd01df1b74af1827dd16b821fc07451f2ef7f02da60f"},{"type":"PublicKey","value":"037279f3a507817251534181116cb38ef30468b25074827db34cbbc6adc8873932"}]}] NXXazKH39yNFWWZF5MJ8tEN98VYHwzn7g3

If you want to get the list of entries for a particular role:

invoke 0x49cf4e5378ffcd4dec034fd98a174c5491e395e2 getDesignatedByRole [{"type":"Integer","value":8},{"type":"Integer","value":10}] NXXazKH39yNFWWZF5MJ8tEN98VYHwzn7g3

👆The second parameter (integer) is the blockchain height.

💡 Info

The docker-compose file has 3 nodes, each with an account. The consensus node uses one public key for two accounts. One is a multisig account and the other a normal account. The multisig account is required as the validator account. Private keys are encrypted according to NEP-2.

  • Consensus

    • Address: NM7Aky765FG8NhhwtxjXRx7jEL1cnw7PBP
      • ScriptHash: 69ecca587293047be4c59159bf8bc399985c160d
      • Script: 0c21033a4d051b04b7fc0230d2b1aaedfd5a84be279a5361a7358db665ad7857787f1b4156e7b327
      • PubKey: 033a4d051b04b7fc0230d2b1aaedfd5a84be279a5361a7358db665ad7857787f1b
      • PrivKey: 84180ac9d6eb6fba207ea4ef9d2200102d1ebeb4b9c07e2c6a738a42742e27a5
      • NEP-2 encrypted: 6PYM7jHL4GmS8Aw2iEFpuaHTCUKjhT4mwVqdoozGU6sUE25BjV4ePXDdLz
      • WIF: L1eV34wPoj9weqhGijdDLtVQzUpWGHszXXpdU9dPuh2nRFFzFa7E
    • MultiSig Address (from the account above, 1/1): NXXazKH39yNFWWZF5MJ8tEN98VYHwzn7g3
      • Script: 110c21033a4d051b04b7fc0230d2b1aaedfd5a84be279a5361a7358db665ad7857787f1b11419ed0dc3a
      • ScritpHash: 05859de95ccbbd5668e0f055b208273634d4657f
    • JSON-RPC: localhost:40332
  • Client1

    • Address: NV1Q1dTdvzPbThPbSFz7zudTmsmgnCwX6c
      • Script: 0c2102607a38b8010a8f401c25dd01df1b74af1827dd16b821fc07451f2ef7f02da60f4156e7b327
      • ScripthHash: 88c48eaef7e64b646440da567cd85c9060efbf63
      • PubKey: 02607a38b8010a8f401c25dd01df1b74af1827dd16b821fc07451f2ef7f02da60f
      • PrivKey: beae38739915555a75a9281a5928b10ebc265f9c881aa21e963610a6c606a3dc
      • NEP-2 encrypted: 6PYWaAbWpf6oeH1VrqtdAGawYMsTfcN1GJyarhUFVEq1siNcRJwMpoo456
      • WIF: L3cNMQUSrvUrHx1MzacwHiUeCWzqK2MLt5fPvJj9mz6L2rzYZpok
    • JSON-RPC: localhost:10332
  • Client2

    • Address: NhJX9eCbkKtgDrh1S4xMTRaHUGbZ5Be7uU
      • Script: 0c21037279f3a507817251534181116cb38ef30468b25074827db34cbbc6adc88739324156e7b327
      • ScriptHash: b435bf4b8e34b28a73029eb42d0d99a775799eea
      • PubKey: 037279f3a507817251534181116cb38ef30468b25074827db34cbbc6adc8873932
      • PrivKey: 7d82c818dcc23f9312527b36c4959e5976f5df7a3dec7e1bbb24a45d64d131c1
      • NEP-2 encrypted: 6PYNfKunYGT5sMMqmpkQLB3KRrgvdE2vTEhpXsjQBLFh9cTbRkWkTkz9Q1
      • WIF: L1RgqMJEBjdXcuYCMYB6m7viQ9zjkNPjZPAKhhBoXxEsygNXENBb
    • JSON-RPC: localhost:20332
  • Wallet passphrase: neo

  • List of native contract's addresses/hashes:

    • ContractManagement: 0xfffdc93764dbaddd97c48f252a53ea4643faa3fd
    • StdLib: 0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0
    • CryptoLib: 0x726cb6e0cd8628a1350a611384688911ab75f51b
    • LedgerContract: 0xda65b600f7124ce6c79950c1772a36403104f2be
    • NeoToken: 0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5
    • GasToken: 0xd2a4cff31913016155e38e474a2c06d08be276cf
    • PolicyContract: 0xcc5e4edd9f5f8dba8bb65734541df7a1c081c67b
    • RoleManagement: 0x49cf4e5378ffcd4dec034fd98a174c5491e395e2
    • OracleContract: 0xfe924b7cfe89ddd271abaf7210a80a7e11178758
  • Address Info:

🔜 Upcoming Features

  • Pre-fund wallets of neo-client1 and neo-client2 with plenty of NEO and GAS
  • Automatically deploy smart contracts specified in a given local directory

If you would like to see anything else, give us a shout and open an issue.

🙏 Thanks