|
1 | | -# Polkadot |
| 1 | += Polkadot |
| 2 | +:Author: Polkadot developers |
| 3 | +:Revision: 0.2.0 |
| 4 | +:toc: |
| 5 | +:sectnums: |
2 | 6 |
|
3 | 7 | Implementation of a https://polkadot.network node in Rust. |
4 | 8 |
|
5 | | -## To play |
| 9 | +== To play |
6 | 10 |
|
7 | 11 | If you'd like to play with Polkadot, you'll need to install a client like this |
8 | 12 | one. First, get Rust (1.26.1 or later) and the support software if you don't already have it: |
9 | 13 |
|
10 | | -``` |
| 14 | +[source, shell] |
| 15 | +---- |
11 | 16 | curl https://sh.rustup.rs -sSf | sh |
12 | 17 | sudo apt install make clang pkg-config libssl-dev |
13 | | -``` |
| 18 | +---- |
14 | 19 |
|
15 | 20 | Then, install Polkadot PoC-2: |
16 | 21 |
|
17 | | -``` |
| 22 | +[source, shell] |
18 | 23 | cargo install --git https://github.com/paritytech/polkadot.git --branch v0.2 polkadot |
19 | | -``` |
20 | 24 |
|
21 | 25 | You'll now have a `polkadot` binary installed to your `PATH`. You can drop the |
22 | 26 | `--branch v0.2` or run `cargo install --git https://github.com/paritytech/polkadot.git polkadot` |
23 | 27 | to get the very latest version of Polkadot, but these instructions might not work in that case. |
24 | 28 |
|
25 | | -### Krumme Lanke Testnet |
| 29 | +=== Krumme Lanke Testnet |
26 | 30 |
|
27 | 31 | You will connect to the global Krumme Lanke testnet by default. To do this, just use: |
28 | 32 |
|
29 | | -``` |
| 33 | +[source, shell] |
30 | 34 | polkadot |
31 | | -``` |
32 | 35 |
|
33 | 36 | If you want to do anything on it (not that there's much to do), then you'll need |
34 | 37 | to get some Krumme Lanke DOTs. Ask in the Polkadot watercooler. |
35 | 38 |
|
36 | | -### Development |
| 39 | +=== Development |
37 | 40 |
|
38 | 41 | You can run a simple single-node development "network" on your machine by |
39 | 42 | running in a terminal: |
40 | 43 |
|
41 | | -``` |
| 44 | +[source, shell] |
42 | 45 | polkadot --dev |
43 | | -``` |
44 | 46 |
|
45 | 47 | You can muck around by cloning and building the http://github.com/paritytech/polka-ui and http://github.com/paritytech/polkadot-ui or just heading to https://polkadot.js.org/apps. |
46 | 48 |
|
47 | | -## Local Two-node Testnet |
| 49 | +== Local Two-node Testnet |
48 | 50 |
|
49 | 51 | If you want to see the multi-node consensus algorithm in action locally, then |
50 | 52 | you can create a local testnet. You'll need two terminals open. In one, run: |
51 | 53 |
|
52 | | -``` |
| 54 | +[source, shell] |
53 | 55 | polkadot --chain=local --validator --key Alice -d /tmp/alice |
54 | | -``` |
55 | 56 |
|
56 | 57 | and in the other, run: |
57 | 58 |
|
58 | | -``` |
| 59 | +[source, shell] |
59 | 60 | polkadot --chain=local --validator --key Bob -d /tmp/bob --port 30334 --bootnodes '/ip4/127.0.0.1/tcp/30333/p2p/ALICE_BOOTNODE_ID_HERE' |
60 | | -``` |
61 | 61 |
|
62 | 62 | Ensure you replace `ALICE_BOOTNODE_ID_HERE` with the node ID from the output of |
63 | 63 | the first terminal. |
64 | 64 |
|
65 | | -## Hacking on Polkadot |
| 65 | +== Hacking on Polkadot |
66 | 66 |
|
67 | 67 | If you'd actually like hack on Polkadot, you can just grab the source code and |
68 | 68 | build it. Ensure you have Rust and the support software installed: |
69 | 69 |
|
70 | | -``` |
| 70 | +[source, shell] |
| 71 | +---- |
71 | 72 | curl https://sh.rustup.rs -sSf | sh |
72 | 73 | rustup update nightly |
73 | 74 | rustup target add wasm32-unknown-unknown --toolchain nightly |
74 | 75 | rustup update stable |
75 | 76 | cargo install --git https://github.com/alexcrichton/wasm-gc |
76 | 77 | sudo apt install cmake pkg-config libssl-dev |
77 | | -``` |
| 78 | +---- |
78 | 79 |
|
79 | 80 | Then, grab the Polkadot source code: |
80 | 81 |
|
81 | | -``` |
| 82 | +[source, shell] |
| 83 | +---- |
82 | 84 | git clone https://github.com/paritytech/polkadot.git |
83 | 85 | cd polkadot |
84 | | -``` |
| 86 | +---- |
85 | 87 |
|
86 | 88 | Then build the code: |
87 | 89 |
|
88 | | -``` |
| 90 | +[source, shell] |
| 91 | +---- |
89 | 92 | ./build.sh # Builds the WebAssembly binaries |
90 | 93 | cargo build # Builds all native code |
91 | | -``` |
| 94 | +---- |
92 | 95 |
|
93 | 96 | You can run the tests if you like: |
94 | 97 |
|
95 | | -``` |
| 98 | +[source, shell] |
96 | 99 | cargo test --all |
97 | | -``` |
98 | 100 |
|
99 | 101 | You can start a development chain with: |
100 | 102 |
|
101 | | -``` |
| 103 | +[source, shell] |
102 | 104 | cargo run -- --dev |
103 | | -``` |
104 | | - |
105 | | -## Shell completion |
106 | | - |
107 | | -The Polkadot cli command supports shell auto-completion. For this to work, you will need to run the completion script matching you build and system. |
108 | | - |
109 | | -Assuming you built a release version using `cargo build --release` and use `bash` run the following: |
110 | | -``` |
111 | | -source target/release/completion-scripts/polkadot.bash |
112 | | -``` |
113 | | - |
114 | | -You can find completion scripts for: |
115 | | -- bash |
116 | | -- fish |
117 | | -- zsh |
118 | | -- elvish |
119 | | -- powershell |
120 | | - |
121 | | -To make this change persistent, you can proceed as follow: |
122 | | -### First install |
123 | | -``` |
124 | | -COMPL_DIR=$HOME/.completion |
125 | | -mkdir -p $COMPL_DIR |
126 | | -cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/ |
127 | | -echo "source $COMPL_DIR/polkadot.bash" >> $HOME/.bash_profile |
128 | | -source $HOME/.bash_profile |
129 | | -``` |
130 | | - |
131 | | -### Update |
132 | | -When you build a new version of Polkadot, the following will ensure you auto-completion script matches the current binary: |
133 | | -``` |
134 | | -COMPL_DIR=$HOME/.completion |
135 | | -mkdir -p $COMPL_DIR |
136 | | -cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/ |
137 | | -source $HOME/.bash_profile |
138 | | -``` |
139 | 105 |
|
| 106 | +include::doc/packages.adoc[] |
0 commit comments