diff --git a/CODE_OF_CONDUCT.adoc b/CODE_OF_CONDUCT.md similarity index 80% rename from CODE_OF_CONDUCT.adoc rename to CODE_OF_CONDUCT.md index c5b21d93fb0c..400c9b3901e2 100644 --- a/CODE_OF_CONDUCT.adoc +++ b/CODE_OF_CONDUCT.md @@ -1,10 +1,10 @@ -= Contributor Covenant Code of Conduct +# Contributor Covenant Code of Conduct -== Our Pledge +## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. -== Our Standards +## Our Standards Examples of behavior that contributes to creating a positive environment include: @@ -22,32 +22,31 @@ Examples of unacceptable behavior by participants include: * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting -=== Facilitation, Not Strongarming +### Facilitation, Not Strongarming We recognise that this software is merely a tool for users to create and maintain their blockchain of preference. We see that blockchains are naturally community platforms with users being the ultimate decision makers. We assert that good software will maximise user agency by facilitate user-expression on the network. As such: * This project will strive to give users as much choice as is both reasonable and possible over what protocol they adhere to; but * use of the project's technical forums, commenting systems, pull requests and issue trackers as a means to express individual protocol preferences is forbidden. -== Our Responsibilities +## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. -== Scope +## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. -== Enforcement +## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at admin@parity.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. -== Attribution +## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://contributor-covenant.org/version/1/4 -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ +[homepage]: https://contributor-covenant.org diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.md similarity index 58% rename from CONTRIBUTING.adoc rename to CONTRIBUTING.md index b789e03ed114..0cdc739bad40 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.md @@ -1,50 +1,52 @@ -= Contributing +# Contributing `Substrate` projects is a **OPENISH Open Source Project** -== What? +## What? Individuals making significant and valuable contributions are given commit-access to a project to contribute as they see fit. A project is more like an open wiki than a standard guarded open source project. -== Rules +## Rules There are a few basic ground-rules for contributors (including the maintainer(s) of the project): -. **No `--force` pushes** or modifying the Git history in any way. If you need to rebase, ensure you do it in your own repo. -. **Non-master branches**, prefixed with a short name moniker (e.g. `gav-my-feature`) must be used for ongoing work. -. **All modifications** must be made in a **pull-request** to solicit feedback from other contributors. -. A pull-request *must not be merged until CI* has finished successfully. -. Contributors should adhere to the https://github.com/paritytech/polkadot/wiki/Style-Guide[house coding style]. +- **No `--force` pushes** or modifying the Git history in any way. If you need to rebase, ensure you do it in your own repo. +- **Non-master branches**, prefixed with a short name moniker (e.g. `gav-my-feature`) must be used for ongoing work. +- **All modifications** must be made in a **pull-request** to solicit feedback from other contributors. +- A pull-request _must not be merged until CI_ has finished successfully. +- Contributors should adhere to the https://github.com/paritytech/polkadot/wiki/Style-Guide[house coding style]. -Merging pull requests once CI is successful: +#### Merging pull requests once CI is successful: -. A pull request that does not alter any logic (e.g. comments, dependencies, docs) may be tagged https://github.com/paritytech/substrate/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3AA2-insubstantial[`insubstantial`] and merged by its author. -. A pull request with no large change to logic that is an urgent fix may be merged after a non-author contributor has reviewed it well. -. All other PRs should sit for 48 hours with the https://github.com/paritytech/substrate/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`pleasereview`] tag in order to garner feedback. -. No PR should be merged until all reviews' comments are addressed. +- A pull request that does not alter any logic (e.g. comments, dependencies, docs) may be tagged https://github.com/paritytech/substrate/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3AA2-insubstantial[`insubstantial`] and merged by its author. +- A pull request with no large change to logic that is an urgent fix may be merged after a non-author contributor has reviewed it well. +- All other PRs should sit for 48 hours with the https://github.com/paritytech/substrate/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`pleasereview`] tag in order to garner feedback. +- No PR should be merged until all reviews' comments are addressed. + +#### Reviewing pull requests: -.Reviewing pull requests: When reviewing a pull request, the end-goal is to suggest useful changes to the author. Reviews should finish with approval unless there are issues that would result in: -. Buggy behaviour. -. Undue maintenance burden. -. Breaking with house coding style. -. Pessimisation (i.e. reduction of speed as measured in the projects benchmarks). -. Feature reduction (i.e. it removes some aspect of functionality that a significant minority of users rely on). -. Uselessness (i.e. it does not strictly add a feature or fix a known issue). +- Buggy behaviour. +- Undue maintenance burden. +- Breaking with house coding style. +- Pessimisation (i.e. reduction of speed as measured in the projects benchmarks). +- Feature reduction (i.e. it removes some aspect of functionality that a significant minority of users rely on). +- Uselessness (i.e. it does not strictly add a feature or fix a known issue). + +#### Reviews may not be used as an effective veto for a PR because: -.Reviews may not be used as an effective veto for a PR because: -. There exists a somewhat cleaner/better/faster way of accomplishing the same feature/fix. -. It does not fit well with some other contributors' longer-term vision for the project. +- There exists a somewhat cleaner/better/faster way of accomplishing the same feature/fix. +- It does not fit well with some other contributors' longer-term vision for the project. -== Releases +## Releases Declaring formal releases remains the prerogative of the project maintainer(s). -== Changes to this arrangement +## Changes to this arrangement This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change. -== Heritage +## Heritage These contributing guidelines are modified from the "OPEN Open Source Project" guidelines for the Level project: https://github.com/Level/community/blob/master/CONTRIBUTING.md diff --git a/README.adoc b/README.md similarity index 69% rename from README.adoc rename to README.md index c7f414707fdb..9b76570b4f48 100644 --- a/README.adoc +++ b/README.md @@ -1,55 +1,59 @@ -= Polkadot -:Author: Polkadot developers -:Revision: 0.3.0 -:toc: -:sectnums: +--- +author: Polkadot developers +revision: 0.3.0 +--- + +# Polkadot Implementation of a https://polkadot.network node in Rust. -== NOTE +## NOTE -In 2017 we split our implementation of "Polkadot" from its platform-level component "Substrate". When we split them, we split the Polkadot code off into another repo (this repo), leaving the link:https://github.com/paritytech/substrate[**Substrate** repo] to be what used to be Polkadot, along with its branches and releases. +In 2017 we split our implementation of "Polkadot" from its platform-level component "Substrate". When we split them, we split the Polkadot code off into another repo (this repo), leaving the [**Substrate** repo][substrate-repo] to be what used to be Polkadot, along with its branches and releases. We are actively building both Substrate and Polkadot, but things will be a little odd for a while. If you see "substrate" and are wondering why you need it for Polkadot, now you know. To connect on the "Kusama" canary network, you will want the `v0.6` code, which is in this **Polkadot** repo. To play on the ("Alexander") testnet, you'll want the PoC-4 code instead. Note that PoC-3 uses the Alexander testnet, but will not be able to sync to the latest block. -* **Kusama** is in this link:https://github.com/paritytech/polkadot/tree/v0.6[**Polkadot**] repo branch `v0.6`. +* **Kusama** is in this [**Polkadot**][polkadot-v0.6] repo branch `v0.6`. -* **Polkadot PoC-4 "Alexander"** is in this link:https://github.com/paritytech/polkadot/tree/v0.4[**Polkadot**] repo branch `v0.4`. +* **Polkadot PoC-4 "Alexander"** is in this [**Polkadot**][polkadot-v0.4] repo branch `v0.4`. -* **Polkadot PoC-3 "Alexander"** is in this link:https://github.com/paritytech/polkadot/tree/v0.3[**Polkadot**] repo branch `v0.3`. +* **Polkadot PoC-3 "Alexander"** is in this [**Polkadot**][polkadot-v0.3] repo branch `v0.3`. -* **Polkadot PoC-2 "Krumme Lanke"** is in the link:https://github.com/paritytech/substrate/tree/v0.2[**Substrate**] repo branch `v0.2`. +* **Polkadot PoC-2 "Krumme Lanke"** is in the [**Substrate**][substrate-v0.2] repo branch `v0.2`. +[substrate-repo]: https://github.com/paritytech/substrate +[polkadot-v0.6]: https://github.com/paritytech/polkadot/tree/v0.6 +[polkadot-v0.4]: https://github.com/paritytech/polkadot/tree/v0.4 +[polkadot-v0.3]: https://github.com/paritytech/polkadot/tree/v0.3 +[substrate-v0.2]: https://github.com/paritytech/substrate/tree/v0.2 -== To play +## To play -=== Install Rust +### Install Rust If you'd like to play with Polkadot, you'll need to install a client like this one. First, get Rust (1.32.0 or later) and the support software if you don't already have it: -[source, shell] ----- + +```bash curl https://sh.rustup.rs -sSf | sh ----- +``` -You may need to add Cargo's bin directoy to your PATH environment variable. Restarting your computer will do this for you automatically. Once done, finish installing the support software: +You may need to add Cargo's bin directoy to your PATH environment variable. Restarting your computer will do this for you automatically. Once done, finish installing the support software: -[source, shell] ----- +```bash sudo apt install make clang pkg-config libssl-dev ----- +``` If you already have Rust installed, make sure you're using the latest version by running: -[source, shell] ----- +```bash rustup update ----- +``` -=== Install "Kusama" Canary Network +### Install "Kusama" Canary Network Build Kusama by cloning this repository and running the following commands from the root directory of the repo: @@ -65,9 +69,11 @@ Connect to the global Kusama canary network by default by running: ./target/release/polkadot --name "hello world!" ``` -You can see your node on link:https://telemetry.polkadot.io/#list/Kusama%20CC2[telemetry]. +You can see your node on [telemetry]. + +[telemetry]: https://telemetry.polkadot.io/#list/Kusama%20CC2 -=== Install PoC-4 on "Alexander" Testnet +### Install PoC-4 on "Alexander" Testnet Build Polkadot PoC-4 by cloning this repository and running the following commands from the root directory of the repo: @@ -90,145 +96,153 @@ Finally, connect to the global "Alexander" testnet by default by running: ./target/release/polkadot ``` -=== Install PoC-3 "Alexander" Testnet +### Install PoC-3 "Alexander" Testnet _Note: Connecting to the current Alexander testnet with this version will not allow synchronization._ Install Polkadot PoC-3 and have a `polkadot` binary installed to your `PATH` with: -[source, shell] +```bash cargo install --git https://github.com/paritytech/polkadot.git --branch v0.3 polkadot +``` Connect to the global "Alexander" testnet by default by running: -[source, shell] +```bash polkadot +``` -=== Install PoC-2 "Krumme Lanke" Testnet +### Install PoC-2 "Krumme Lanke" Testnet Install Polkadot PoC-2 and have a `polkadot` binary installed to your `PATH` with: -[source, shell] +``` cargo install --git https://github.com/paritytech/substrate.git --branch v0.2 polkadot +``` Connect to the global "Krumme Lanke" testnet by default by running: -[source, shell] +```bash polkadot +``` -=== Install a custom Testnet version +### Install a custom Testnet version You can run the following to get the very latest version of Polkadot, but these instructions will not work in that case. -[source, shell] +```bash cargo install --git https://github.com/paritytech/polkadot.git polkadot +``` If you want a specific version of Polkadot, say `0.2.5`, you may run -[source, shell] +```bash cargo install --git https://github.com/paritytech/substrate.git --tag v0.2.5 polkadot +``` -=== Obtaining DOTs +### Obtaining DOTs If you want to do anything on it (not that there's much to do), then you'll need to get an account and some Alexander or Krumme Lanke DOTs. Ask in the Polkadot watercooler ( https://riot.im/app/#/room/#polkadot-watercooler:matrix.org ) or get some from the Polkadot Testnet Faucet ( https://faucet.polkadot.network/ ). -=== Development +### Development You can run a simple single-node development "network" on your machine by running in a terminal: -[source, shell] +```bash polkadot --dev +``` 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 and choose "Alexander (hosted by Parity)" from the Settings menu. -== Building +## Building -=== Hacking on Polkadot +### Hacking on Polkadot If you'd actually like hack on Polkadot, you can just grab the source code and build it. Ensure you have Rust and the support software installed: -[source, shell] ----- +```bash curl https://sh.rustup.rs -sSf | sh ----- +``` -You may need to add Cargo's bin directoy to your PATH environment variable. Restarting your computer will do this for you automatically. Once done, finish installing the support software: +You may need to add Cargo's bin directoy to your PATH environment variable. Restarting your computer will do this for you automatically. Once done, finish installing the support software: -[source, shell] ----- +```bash sudo apt install cmake pkg-config libssl-dev git clang ----- +``` Then, grab the Polkadot source code: -[source, shell] ----- +```bash git clone https://github.com/paritytech/polkadot.git cd polkadot ----- +``` Then build the code: -[source, shell] ----- +```bash ./scripts/init.sh # Install WebAssembly. Update Rust cargo build # Builds all native code ----- +``` You can run the tests if you like: -[source, shell] +```bash cargo test --all +``` You can start a development chain with: -[source, shell] +```bash cargo run -- --dev +``` Detailed logs may be shown by running the node with the following environment variables set: -[source, shell] +```bash RUST_LOG=debug RUST_BACKTRACE=1 cargo run —- --dev +``` -=== Local Two-node Testnet +### Local Two-node Testnet If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet. You'll need two terminals open. In one, run: -[source, shell] +```bash polkadot --chain=local --validator --key Alice -d /tmp/alice +``` And in the other, run: -[source, shell] +```bash polkadot --chain=local --validator --key Bob -d /tmp/bob --port 30334 --bootnodes '/ip4/127.0.0.1/tcp/30333/p2p/ALICE_BOOTNODE_ID_HERE' +``` Ensure you replace `ALICE_BOOTNODE_ID_HERE` with the node ID from the output of the first terminal. -=== Using Docker -link:doc/docker.adoc[Using Docker] +### Using Docker +[Using Docker](doc/docker.md) -=== Shell Completion -link:doc/shell-completion.adoc[Shell Completion] +### Shell Completion +[Shell Completion](doc/shell-completion.md) -=== Polkadot Networks -link:doc/networks/networks.adoc[Polkadot Networks] +### Polkadot Networks +[Polkadot Networks](doc/networks/networks.md) -== Contributing +## Contributing -=== Contributing Guidelines +### Contributing Guidelines -link:CONTRIBUTING.adoc[Contribution Guidelines] +[Contribution Guidelines](CONTRIBUTING.md) -=== Contributor Code of Conduct +### Contributor Code of Conduct -link:CODE_OF_CONDUCT.adoc[Code of Conduct] +[Code of Conduct](CODE_OF_CONDUCT.md) -== License +## License -https://github.com/paritytech/polkadot/blob/master/LICENSE[LICENSE] +[LICENSE](https://github.com/paritytech/polkadot/blob/master/LICENSE) -== Important Notice +## Important Notice https://polkadot.network/testnetdisclaimer diff --git a/doc/docker.adoc b/doc/docker.md similarity index 81% rename from doc/docker.adoc rename to doc/docker.md index 2ca294419033..146b29c3031f 100644 --- a/doc/docker.adoc +++ b/doc/docker.md @@ -1,69 +1,75 @@ - -=== The easiest way +### The easiest way The easiest/faster option is to use the latest image. Let´s first check the version we have. The first time you run this command, the polkadot docker image will be downloaded. This takes a bit of time and bandwidth, be patient: -[source, shell] +```bash docker run --rm -it chevdor/polkadot:0.3.14 polkadot --version +``` You can also pass any argument/flag that polkadot supports: -[source, shell] +```bash docker run --rm -it chevdor/polkadot:0.3.14 polkadot --chain alex --name "PolkaDocker" +``` Once you are done experimenting and picking the best node name :) you can start polkadot as daemon, exposes the polkadot ports and mount a volume that will keep your blockchain data locally: -[source, shell] +```bash docker run -d -p 30333:30333 -p 9933:9933 -v /my/local/folder:/data chevdor/polkadot:0.3.14 polkadot --chain alex +``` Additionally if you want to have custom node name you can add the `--name "YourName"` at the end -[source, shell] -docker run -d -p 30333:30333 -p 9933:9933 -v /my/local/folder:/data chevdor/polkadot:0.3.14 polkadot --chain alex --name "PolkaDocker" +```bash +docker run -d -p 30333:30333 -p 9933:9933 -v /my/local/folder:/data chevdor/polkadot:0.3.14 polkadot --chain alex --name "PolkaDocker" +``` +```bash docker run -d -p 30333:30333 -p 9933:9933 -v /my/local/folder:/data chevdor/polkadot:0.3.14 polkadot --rpc-external --chain alex +``` -if you want to connect to rpc port 9933, then must add polkadot startup parameter: --rpc-external. +if you want to connect to rpc port 9933, then must add polkadot startup parameter: `--rpc-external`. **Note:** The `--chain alex` argument is important and you need to add it to the command line. If you are running older node versions (pre 0.3) you don't need it. -=== Limiting Resources +### Limiting Resources -Chain syncing will utilise all available memory and CPU power your server has to offer, which can lead to crashing. +Chain syncing will utilise all available memory and CPU power your server has to offer, which can lead to crashing. -If running on a low resource VPS, use `--memory` and `--cpus` to limit the resources used. E.g. To allow a maximum of 512MB memory and 50% of 1 CPU, use `--cpus=".5" --memory="512m"`. Read more about limiting a container's resources [here](https://docs.docker.com/config/containers/resource_constraints). +If running on a low resource VPS, use `--memory` and `--cpus` to limit the resources used. E.g. To allow a maximum of 512MB memory and 50% of 1 CPU, use `--cpus=".5" --memory="512m"`. Read more about limiting a container's resources [here](https://docs.docker.com/config/containers/resource_constraints). Start a shell session with the daemon: -[source, shell] +```bash docker exec -it $(docker ps -q) bash; +``` Check the current version: -[source, shell] +```bash polkadot --version +``` - -=== Build your own image +### Build your own image To get up and running with the smallest footprint on your system, you may use the Polkadot Docker image. You can build it yourself (it takes a while...) in the shell session of the daemon: -[source, shell] ----- +```bash cd docker ./build.sh ----- +``` -=== Reporting issues +### Reporting issues If you run into issues with polkadot when using docker, please run the following command (replace the tag with the appropriate one if you do not use latest): -[source, shell] +```bash docker run --rm -it chevdor/polkadot:latest polkadot version +``` This will show you the polkadot version as well as the git commit ref that was used to build your container. Just paste that in the issue you create. diff --git a/doc/networks/alexander.adoc b/doc/networks/alexander.md similarity index 76% rename from doc/networks/alexander.adoc rename to doc/networks/alexander.md index 623dd9ac6d78..ede2f20db4ac 100644 --- a/doc/networks/alexander.adoc +++ b/doc/networks/alexander.md @@ -1,3 +1,3 @@ -=== Alexander +### Alexander -Alexander is a testnet network used during the developement of PoC-3. \ No newline at end of file +Alexander is a testnet network used during the developement of PoC-3. diff --git a/doc/networks/dev.adoc b/doc/networks/dev.md similarity index 90% rename from doc/networks/dev.adoc rename to doc/networks/dev.md index c92209709e0b..dde7bb19ac3b 100644 --- a/doc/networks/dev.adoc +++ b/doc/networks/dev.md @@ -1,9 +1,10 @@ -=== Dev network +### Dev network You can run a simple single-node development "network" on your machine by running in a terminal: -[source, shell] +```bash polkadot --dev +``` 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. diff --git a/doc/networks/krummelanke.adoc b/doc/networks/krummelanke.md similarity index 81% rename from doc/networks/krummelanke.adoc rename to doc/networks/krummelanke.md index fb081baab2a9..07c56e785024 100644 --- a/doc/networks/krummelanke.adoc +++ b/doc/networks/krummelanke.md @@ -1,4 +1,4 @@ -=== Krumme Lanke +### Krumme Lanke Krumme Lanke is a testnet network used during the developement of PoC-2. diff --git a/doc/networks/local.adoc b/doc/networks/local.md similarity index 89% rename from doc/networks/local.adoc rename to doc/networks/local.md index a0a332495afe..a2e16169fa5f 100644 --- a/doc/networks/local.adoc +++ b/doc/networks/local.md @@ -1,16 +1,18 @@ -=== Local Two-node Testnet +### Local Two-node Testnet If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet. You'll need two terminals open. In one, run: -[source, shell] +```bash polkadot --chain=local --validator --key Alice -d /tmp/alice +``` and in the other, run: -[source, shell] +```bash polkadot --chain=local --validator --key Bob -d /tmp/bob --port 30334 --bootnodes '/ip4/127.0.0.1/tcp/30333/p2p/ALICE_BOOTNODE_ID_HERE' +``` Ensure you replace `ALICE_BOOTNODE_ID_HERE` with the node ID from the output of the first terminal. diff --git a/doc/networks/networks.adoc b/doc/networks/networks.adoc deleted file mode 100644 index 98ca843eb56d..000000000000 --- a/doc/networks/networks.adoc +++ /dev/null @@ -1,8 +0,0 @@ - -== Polkadot networks - -include::dev.adoc[] - -include::local.adoc[] - -include::krummelanke.adoc[] diff --git a/doc/networks/networks.md b/doc/networks/networks.md new file mode 100644 index 000000000000..7ba5b04401dd --- /dev/null +++ b/doc/networks/networks.md @@ -0,0 +1,8 @@ + +## Polkadot networks + +[dev](./dev.md) + +[local](./local.md) + +[krummelanke](./krummelanke.md) diff --git a/doc/shell-completion.adoc b/doc/shell-completion.md similarity index 88% rename from doc/shell-completion.adoc rename to doc/shell-completion.md index c5697acf9c9b..965a722308c3 100644 --- a/doc/shell-completion.adoc +++ b/doc/shell-completion.md @@ -1,12 +1,13 @@ -== Shell completion +## Shell completion 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. Assuming you built a release version using `cargo build --release` and use `bash` run the following: -[source, shell] +```bash source target/release/completion-scripts/polkadot.bash +``` You can find completion scripts for: - bash @@ -17,25 +18,23 @@ You can find completion scripts for: To make this change persistent, you can proceed as follow: -=== First install +### First install -[source, shell] ----- +```bash COMPL_DIR=$HOME/.completion mkdir -p $COMPL_DIR cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/ echo "source $COMPL_DIR/polkadot.bash" >> $HOME/.bash_profile source $HOME/.bash_profile ----- +``` -=== Update +### Update When you build a new version of Polkadot, the following will ensure you auto-completion script matches the current binary: -[source, shell] ----- +```bash COMPL_DIR=$HOME/.completion mkdir -p $COMPL_DIR cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/ source $HOME/.bash_profile ----- +```