|
| 1 | +# Bootstrapping |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +Bootstrapping is the process where the Polykey agent sets itself up as a new |
| 6 | +Polykey node. This involves creating the encrypted-at-rest node state, and |
| 7 | +connecting to the [mainnet](https://mainnet.polykey.com/) or a custom specified |
| 8 | +network domain. |
| 9 | + |
| 10 | +## Setting Up Your Node |
| 11 | + |
| 12 | +### Creating the Root Key |
| 13 | + |
| 14 | +When you first start the Polykey agent, it automatically generates a random root |
| 15 | +key. |
| 16 | + |
| 17 | +This root key is an asymmetric key pair consisting of a public key representing |
| 18 | +your identity and used for verifying signatures, and a private key which is used |
| 19 | +for signing. |
| 20 | + |
| 21 | +Afterwards, encryption keys are derived from this root key, which is used for |
| 22 | +encryption and decryption of all node state and secret data managed by Polykey. |
| 23 | + |
| 24 | +You will be prompted to provide a root password. This password encrypts the root |
| 25 | +key. |
| 26 | + |
| 27 | +:::note Remember to keep your password in a secure location as you will need it |
| 28 | +each time you start the Polykey agent. ::: |
| 29 | + |
| 30 | +### Starting the Polykey Agent |
| 31 | + |
| 32 | +You can start the Polykey agent in the foreground of your terminal by running: |
| 33 | + |
| 34 | +```bash |
| 35 | +polykey agent start --verbose |
| 36 | +``` |
| 37 | + |
| 38 | +Running the agent in the foreground allows you to monitor its output directly in |
| 39 | +the terminal. Ensure this terminal session remains active to keep the agent |
| 40 | +running. You can execute Polykey commands from any other terminal session while |
| 41 | +this runs. |
| 42 | + |
| 43 | +### Starting Polykey in the Background |
| 44 | + |
| 45 | +Alternatively, in the demo video and other scenarios where you do not wish to |
| 46 | +occupy your terminal, you can start the agent in the background: |
| 47 | + |
| 48 | +```bash |
| 49 | +polykey agent start --verbose --background |
| 50 | +``` |
| 51 | + |
| 52 | +### Stopping the Polykey Agent |
| 53 | + |
| 54 | +You can stop the Polykey agent by pressing **Control+C** in the terminal where |
| 55 | +it's running in the foreground, or by running: |
| 56 | + |
| 57 | +```bash |
| 58 | +polykey agent stop |
| 59 | +``` |
| 60 | + |
| 61 | +#### Troubleshooting |
| 62 | + |
| 63 | +If the Polykey agent does not terminate properly, you can force quit the process |
| 64 | +through the Activity Monitor on your machine. If you encounter this or any other |
| 65 | +issue, please consider making a |
| 66 | +[bug report](https://github.com/MatrixAI/Polykey-CLI/issues/new/choose) to help |
| 67 | +improve Polykey. |
| 68 | + |
| 69 | +## Check Agent Status |
| 70 | + |
| 71 | +To check the status of your Polykey node, use the following command: |
| 72 | + |
| 73 | +```bash |
| 74 | +polykey agent status |
| 75 | +``` |
| 76 | + |
| 77 | +This command provides detailed information about your node's current state, |
| 78 | +including its connectivity and activity within the network. |
| 79 | + |
| 80 | +### Example Output |
| 81 | + |
| 82 | +```bash |
| 83 | +status LIVE |
| 84 | +pid 96992 |
| 85 | +nodeId vgijtpv0h8m1eajeir77g73muq88n5kj0413t6fjdqsv9kt8dq4pg |
| 86 | +clientHost ::1 |
| 87 | +clientPort 54975 |
| 88 | +agentHost :: |
| 89 | +agentPort 60358 |
| 90 | +upTime 8 |
| 91 | +startTime 1716509093 |
| 92 | +connectionsActive 3 |
| 93 | +nodesTotal 11 |
| 94 | +version 1.2.3-alpha.4-1-1 |
| 95 | +sourceVersion 1.2.3-alpha.4 |
| 96 | +stateVersion 1 |
| 97 | +networkVersion 1 |
| 98 | +``` |
| 99 | + |
| 100 | +## Check Network Status |
| 101 | + |
| 102 | +When your agent has started, it should show as a node on the network. By default |
| 103 | +the network is [mainnet](https://mainnet.polykey.com/). Check out the network |
| 104 | +dashboard to see your placement on the world map. |
| 105 | + |
| 106 | +## Monitoring Network Connections |
| 107 | + |
| 108 | +To view the nodes currently connected to the network, including the seed nodes, |
| 109 | +run: |
| 110 | + |
| 111 | +```bash |
| 112 | +polykey nodes connections |
| 113 | +``` |
| 114 | + |
| 115 | +This will list all active connections, including details about each node. |
| 116 | + |
| 117 | +### Example Output |
| 118 | + |
| 119 | +```bash |
| 120 | +host hostname nodeIdEncoded port timeout usageCount |
| 121 | +3.145.86.40 N/A v6p14qcvvftnnscuavsehu37t22vfvnhse054pbkb3ehemmjsrdh0 1314 46873 0 |
| 122 | +13.239.117.143 N/A vncm2mkk41vgp2fmplqiu1je7b2l3v6fhgltlqf5f3f85923ve0j0 1314 116186 0 |
| 123 | +1.145.55.96 N/A vg6gldhfdstju8frtbguav2p2svmev85dvpdb34gffmiagpgjf2pg 1200 102086 0 |
| 124 | +``` |
| 125 | + |
| 126 | +## Checking Node Activity |
| 127 | + |
| 128 | +To determine if a specific node is active, use the ping command: |
| 129 | + |
| 130 | +```bash |
| 131 | +polykey nodes ping <nodeID> |
| 132 | +``` |
| 133 | + |
| 134 | +This will tell you whether the node is active within the network. |
| 135 | + |
| 136 | +### Example Output |
| 137 | + |
| 138 | +```bash |
| 139 | +polykey nodes ping v6p14qcvvftnnscuavsehu37t22vfvnhse054pbkb3ehemmjsrdh0 |
| 140 | +Node is Active |
| 141 | +``` |
| 142 | + |
| 143 | +## Conclusion |
| 144 | + |
| 145 | +Bootstrapping your node is the first step to using Polykey effectively. It |
| 146 | +prepares your node for managing and sharing secrets securely within the network. |
| 147 | +By following these guidelines, you ensure that your node is well-configured, |
| 148 | +secure, and ready for advanced operations in the Polykey ecosystem. |
| 149 | + |
| 150 | +Stay tuned for upcoming sections where we will discuss managing multiple nodes, |
| 151 | +assigning different file paths to each node, and other advanced configurations. |
0 commit comments