From 6c7a256b0bf7bcbf49eb4f9647541780b83b208a Mon Sep 17 00:00:00 2001 From: MadelineMurray <43356962+MadelineMurray@users.noreply.github.com> Date: Fri, 26 Oct 2018 11:20:24 +1000 Subject: [PATCH] Added Reference to Wiki from Docker quickstart (#158) --- docs/DocsArchive0.8.0.html | 202 +------------------------------------ 1 file changed, 1 insertion(+), 201 deletions(-) diff --git a/docs/DocsArchive0.8.0.html b/docs/DocsArchive0.8.0.html index 84a36f0f6b..b0adb94450 100644 --- a/docs/DocsArchive0.8.0.html +++ b/docs/DocsArchive0.8.0.html @@ -887,207 +887,7 @@ KeyPairUtil | Generated new key <key> and stored it to ~/pantheon/build/di
After you're finished running the demo, you can stop the Pantheon client by returning to the terminal window that runs the node and entering Ctrl+c
.
This tutorial describes how to use Pantheon to run a private network of Pantheon nodes in a Docker container.
---Note To run the Docker Quickstart, you must install Pantheon by cloning and building.
-If you have installed Pantheon from the packaged binaries or are running the Docker image, continue with Basic Quickstart or Starting Pantheon.
-
To run this tutorial, you must have the following installed:
-Linux or Mac OS
-A web browser that supports Metamask (currently Chrome, Firefox, Opera, and Brave), and has the MetaMask plug-in installed. This tutorial uses screenshots from Brave.
-As indicated in the installation section, -clone the repository.
-This tutorial uses Docker Compose to simplify assembling images and
-running in a private network. To run the containers, go to the pantheon
directory and run the following shell command:
quickstart/runPantheonPrivateNetwork.sh
This script builds Pantheon, builds the images and runs the containers. It will also scale the regular node container to four containers to simulate a network with enough peers to synchronize.
-When the quickstart/runPantheonPrivateNetwork.sh
script ends, it lists the running services:
Name Command State Ports
------------------------------------------------------------------------------------------------------------------------
-quickstart_bootnode_1 /opt/pantheon/bootnode_sta ... Up 30303/tcp, 30303/udp, 8084/tcp, 8545/tcp
-quickstart_explorer_1 /bin/sh -c npm start Up 0.0.0.0:32770->3000/tcp
-quickstart_minernode_1 /opt/pantheon/node_start.s ... Up 30303/tcp, 30303/udp, 8084/tcp, 8545/tcp
-quickstart_node_1 /opt/pantheon/node_start.s ... Up 30303/tcp, 30303/udp, 8084/tcp, 8545/tcp
-quickstart_node_2 /opt/pantheon/node_start.s ... Up 30303/tcp, 30303/udp, 8084/tcp, 8545/tcp
-quickstart_node_3 /opt/pantheon/node_start.s ... Up 30303/tcp, 30303/udp, 8084/tcp, 8545/tcp
-quickstart_node_4 /opt/pantheon/node_start.s ... Up 30303/tcp, 30303/udp, 8084/tcp, 8545/tcp
-quickstart_rpcnode_1 /opt/pantheon/node_start.s ... Up 30303/tcp, 30303/udp, 8084/tcp,
- 0.0.0.0:32769->8545/tcp, 0.0.0.0:32768->8546/tcp
And a friendly recap of the entrypoints :
-****************************************************************
-JSON-RPC HTTP service endpoint : http://localhost:32769 *
-JSON-RPC WebSocket service endpoint : http://localhost:32768 *
-Web block explorer address : http://localhost:32770 *
-****************************************************************
To display this list at any time, run:
-quickstart/listQuickstartServices.sh
This tutorial uses a block explorer based on the MIX project explorer.
---Note: As Yarn is an Apache 2.0 licensed tool, it has been patched to fit this tutorial's needs. (You can view the patches in the quickstart/explorer folder.)
-
Log in to MetaMask if you don't already have it running. The block explorer displays the network to which MetaMask is connected. If you see a Peer Count of 100 in the block explorer, it's likely MetaMask is connected to mainnet or one of the testnets such as Ropsten.
-To display the private network in the block explorer, you have to configure a custom RPC network.
-After you sign in to MetaMask, connect to the private network RPC endpoint by:
-JSON-RPC HTTP service endpoint
displayed when you started the private network.Save the configuration and return to the MetaMask main screen. Your current network is now set to the private network RPC node.
-If you don't have Metamask running, the block explorer works directly without configuration. The block explorer integrates its own web3 version and knows the RPC node endpoint.
-Access the explorer using the Web block explorer address
displayed when starting the private network.
You will see the already mined blocks on the right, and some stats about the RPC node we are connected to on the left.
-Notice the explorer indicates 6 peers: the 4 regular nodes, the mining node and the bootnode.
-Now lets play with some requests.
-You can run RPC requests on rpcnode
, the node that is exposed to the host in order to listen for requests.
In this tutorial, note that the http://localhost:http-rpc-port
placeholder is http://localhost: 32769
.
--Note: Make sure to replace
-port
with the one provided in thequickstart/listQuickstartServices.sh
commandJSON-RPC HTTP service endpoint
. -The dynamic docker port mapping changes each time you run the network.
Run the following command from the host shell :
-curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:http-rpc-port
The result should be as follows:
-{
- "jsonrpc" : "2.0",
- "id" : 1,
- "result" : "pantheon/0.8.0-SNAPSHOT"
-}
Here we simply query the version of the Pantheon node, which confirms the node is running.
-Now if this works, let's see some more interesting requests.
-Peers are the number of other nodes connected to the RPC node.
-Poll the peer count using net_peerCount
:
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' http://localhost:http-rpc-port
The result should be the following response, indicating that there are 6 peers:
-{
- "jsonrpc" : "2.0",
- "id" : 1,
- "result" : "0x6"
-}
This provides the count of blocks already mined.
-To do so, call eth_blockNumber
to retrieve the number of the most recent block:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:http-rpc-port
The result of this call should be:
-{
- "jsonrpc" : "2.0",
- "id" : 1,
- "result" : "0x8b8"
-}
Here the hexadecimal value 0x8b8
translates to 2232
in decimal; that many blocks have already been mined.
Then call eth_getBalance
to retrieve the balance of the mining address defined in the miner node:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73","latest"],"id":1}' http://localhost:http-rpc-port
The result of this call should be something like :
-{
- "jsonrpc" : "2.0",
- "id" : 1,
- "result" : "0x79f905c6fd34e80000"
-}
0x79f905c6fd34e80000 = 2250000000000000000000 Wei (2250 Ether) (you can use a unit converter )
-Wait a few seconds until new blocks are mined and make this call again. The balance should increase, -meaning that the miner address successfully received the mining reward.
-Also you can see this information in the block explorer. It does exactly the same thing as we -did manually, connecting to the rpc node using http JSON-RPC, but displays information on a web page.
-Now that you are familiar with basic RPC requests you can run JSON-RPC commands to send transactions. -In order to send transactions, you will first need to create an account or use one of the 3 accounts -created during the genesis of this test network.
-This is the mining node codebase account:
-Initial balance : 0xad78ebc5ac6200000 (200000000000000000000 in decimal)
-Address: 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
-Initial balance : 0x90000000000000000000000 (2785365088392105618523029504 in decimal)
-Address: 0xf17f52151EbEF6C7334FAD080c5704D77216b732
---Note: Pantheon does not provide an accounts management system, so if you want to create your own account, you will have to use a third party tool like Metamask.
-
Once you have Configured a custom RPC network, import one of the existing accounts above into -metamask -using the corresponding private key.
-NOTE that here we don't really care about securing the keys as it's just a tutorial, but be sure -to secure your accounts when you run into a real usecase. This will be discussed in a more advanced -chapter.
-Once this is done, try to create another account from scratch -to send some ether to.
-Of course remember that here we are dealing with valueless ether as we are not -on the main network but on a local private network.
-Send some ether -from the first account (containing some ether) to the new one (that have a zero balance) -and go to the explorer to check that your transaction is validated.
-You should see a block in the list with one transaction, and you can look at the detail of the block -and of the transactions.
- -This step is inspired by the PetShop tutorial on Truffle website.
-Use the following instructions to run it with the quick-start Pantheon Docker network and a wallet to manage keys.
-npm install -g truffle
mkdir pet-shop-tutorial
-cd pet-shop-tutorial
-truffle unbox pet-shop
npm install truffle-privatekey-provider
We are going to modify the truffle.js
file to add our wallet provider.
-So modify the file to look like the following :
const PrivateKeyProvider = require("truffle-privatekey-provider");
-const privateKey = "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63";
-const privateKeyProvider = new PrivateKeyProvider(privateKey, "[YOUR HTTP RPC NODE ENDPOINT]");
-
-module.exports = {
- // See <http://truffleframework.com/docs/advanced/configuration>
- // for more about customizing your Truffle configuration!
- networks: {
- development: {
- host: "127.0.0.1",
- port: 7545,
- network_id: "*" // Match any network id
- },
- quickstartWallet: {
- provider: privateKeyProvider,
- network_id: "*"
- },
- }
-};
Then replace the [YOUR HTTP RPC NODE ENDPOINT]
placeholder with your HTTP RPC node endpoint. http://localhost:32769
in this case.
The private address indicated in the file is the miner address so we know we will have funds in it. You don't need to change it.
-Once this is done, you can go through the regular tutorial steps.
-When you have to run a truffle command, you only have to indicate the right network to use, as in the following command using the --network quickstartWallet
option :
truffle migrate --network quickstartWallet
Your are then able to see the transactions and contracts deployed on your local docker network if you have a look in the block explorer.
-To shut down the network, you can use the script quickstart/removePantheonPrivateNetwork.sh
; this will stop and destroy all containers.
Refer to the Pantheon Wiki for the Docker Quickstart Tutorial.
Pantheon nodes can be used for varying purposes as described in the Overview. Nodes can connect to the Ethereum mainnet, public testnets such as Ropsten, or private networks.