### Vale Writing Style Linter Setup Source: https://context7.com/w3f/polkadot-wiki/llms.txt Guides on setting up and using Vale, a linter for enforcing consistent documentation style based on the Google style guide and Polkadot-specific terminology. Includes installation, checking files/directories, and configuration details. ```bash # Install Vale brew install vale # macOS # Or download from: https://github.com/errata-ai/vale/releases # Check single file vale docs/general/contributing.md # Expected output: docs/general/contributing.md 23:1 warning Use 'Polkadot' instead of Polkadot.WordSwapList 'polkadot'. ✖ 1 warning # Check entire docs directory vale docs/ # Check all files (respects .vale.ini) vale . # Configuration in .vale.ini # [*.md] # BasedOnStyles = Google, Polkadot # Packages = Google, https://github.com/errata-ai/Google/releases/latest/download/Google.zip # Add custom accepted terms # Edit: .github/styles/config/vocabularies/Polkadot/accept.txt ``` -------------------------------- ### Build and Run Polkadot Wiki Locally Source: https://context7.com/w3f/polkadot-wiki/llms.txt Instructions for setting up a local development environment for the Polkadot Wiki. This includes installing dependencies, serving the site locally, and building the production-ready static site. Assumes Python and pip are installed. ```bash # Install Python dependencies pip install -r requirements.txt # Run local development server ENABLE_RPC=false mkdocs serve # Access the site at http://127.0.0.1:8000 # Build production site ENABLE_RPC=false mkdocs build ``` -------------------------------- ### Install @polkadot/api-cli for Staking Operations Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-guides-nominator.md This command installs the Polkadot API CLI globally, which is necessary for managing staking operations directly from your command line. Ensure you have Node.js and npm installed before running this command. This tool allows for network interaction without the Polkadot-JS UI. ```bash npm install -g @polkadot/api-cli ``` -------------------------------- ### Polkadot Password Key Derivation Example Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-account-advanced.md Shows how to derive a password key account on Polkadot using '///' after the mnemonic phrase. This method requires a password in addition to the mnemonic and derivation path to access the account, providing enhanced security. ```text 'caution juice atom organ advance problem want pledge someone senior holiday very///0' ``` -------------------------------- ### Conviction Voting Example Scenario Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-polkadot-opengov.md An example demonstrating how different lock periods affect voting power in Polkadot's OpenGov, even when the number of tokens voted differs. ```plaintext Peter: Votes `No` with 10 DOT for a 32-week lock period => 10 x 6 = 60 Votes Logan: Votes `Yes` with 20 DOT for one week lock period => 20 x 1 = 20 Votes Kevin: Votes `Yes` with 15 DOT for a 2-week lock period => 15 x 2 = 30 Votes ``` -------------------------------- ### Generate Polkadot Addresses using Subkey Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-transaction-construction.md These examples demonstrate how to generate new Polkadot accounts and retrieve their associated secret seed, public key, account ID, and SS58 address using the 'subkey' tool. This is useful for setting up accounts for testing or deployment. ```bash $ subkey --network polkadot generate Secret phrase `pulp gaze fuel ... mercy inherit equal` is account: Secret seed: 0x57450b3e09ba4598 ... ... ... ... ... ... ... .. 219756eeba80bb16 Public key (hex): 0x2ca17d26ca376087dc30ed52deb74bf0f64aca96fe78b05ec3e720a72adb1235 Account ID: 0x2ca17d26ca376087dc30ed52deb74bf0f64aca96fe78b05ec3e720a72adb1235 SS58 Address: 121X5bEgTZcGQx5NZjwuTjqqKoiG8B2wEAvrUFjuw24ZGZf2 $ subkey --network polkadot generate Secret phrase `exercise auction soft ... obey control easily` is account: Secret seed: 0x5f4bbb9fbb69261a ... ... ... ... ... ... ... .. 4691ed7d1130fbbd Public key (hex): 0xda04de6cd781c98acf0693dfb97c11011938ad22fcc476ed0089ac5aec3fe243 Account ID: 0xda04de6cd781c98acf0693dfb97c11011938ad22fcc476ed0089ac5aec3fe243 SS58 Address: 15vrtLsCQFG3qRYUcaEeeEih4JwepocNJHkpsrqojqnZPc2y ``` -------------------------------- ### Polkadot Hard Key Derivation Example Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-account-advanced.md Demonstrates how to derive a hard key child account on Polkadot using '//' after the mnemonic phrase. This method ensures that the private key of the root address cannot be derived from the child account's private key. ```text 'caution juice atom organ advance problem want pledge someone senior holiday very//0' ``` -------------------------------- ### RPC Macro Example in Python for Polkadot Wiki Source: https://github.com/w3f/polkadot-wiki/blob/master/README.md This Python code defines the signature for an 'rpc' macro used within MkDocs for the Polkadot Wiki. It allows dynamic fetching and rendering of data from the network, with options for different read-out formats. ```python def rpc(network, module, call, default_value, is_constant=False, readable="") # Function implementation to fetch and format RPC data pass ``` -------------------------------- ### Polkadot Soft Key Derivation Example Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-account-advanced.md Illustrates deriving a soft key child account on Polkadot using '/' after the mnemonic phrase. Soft derivation allows for the possibility of determining the initial account's private key if the derived account's private key is known. ```text 'caution juice atom organ advance problem want pledge someone senior holiday very/0' ``` -------------------------------- ### POST /api/tx/broker/startSales Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/general/extrinsics.md Begins the Bulk Coretime sales rotation. Requires Root or AdminOrigin. ```APIDOC ## POST /api/tx/broker/startSales ### Description Begin the Bulk Coretime sales rotation. The origin must be Root or pass `AdminOrigin`. This will call [`Self::request_core_count`] internally to set the correct core count on the relay chain. ### Method POST ### Endpoint /api/tx/broker/startSales ### Parameters #### Query Parameters - **end_price** (u128) - Required - The price after the leading period of Bulk Coretime in the first sale. - **extra_cores** (u16) - Required - Number of extra cores that should be requested on top of the cores required for `Reservations` and `Leases`. ### Request Example ```json { "end_price": "500000000000000000", "extra_cores": 2 } ``` ### Response #### Success Response (200) - **result** (object) - The result of the transaction. #### Response Example ```json { "result": "Transaction included and processed." } ``` ``` -------------------------------- ### Build and Deploy to Netlify Workflow in GitHub Actions Source: https://github.com/w3f/polkadot-wiki/blob/master/README.md This GitHub Actions workflow builds the documentation site and deploys it to Netlify. For pull requests, it generates a preview deployment. For pushes to the 'master' branch, it deploys to the production URL. ```yaml name: Build and Deploy to Netlify on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Build site uses: withastro/astro-build@v1 with: package-manager: npm build-script: build - name: Deploy to Netlify uses: netlify/actions/cli@master with: args: deploy --prod env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} ``` -------------------------------- ### Start Lottery Configuration - Substrate Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/general/extrinsics.md The startLottery extrinsic initiates a lottery with specified configuration parameters. It requires the ManagerOrigin and takes price, length, delay, and a repeat boolean as arguments. ```rust pub fn startLottery(origin: OriginFor, price: u128, length: u32, delay: u32, repeat: bool) -> DispatchResult { // Implementation details... Ok(()) } ``` -------------------------------- ### enableAutoRenew Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/general/extrinsics.md Enables auto-renewal of coretime for a task on a specific core. The caller's account will be charged at the start of every bulk period. This extrinsic must be called by the sovereign account of the task. ```APIDOC ## POST /api/broker/enableAutoRenew ### Description Extrinsic for enabling auto renewal. Callable by the sovereign account of the task on the specified core. This account will be charged at the start of every bulk period for renewing core time. ### Method POST ### Endpoint /api/broker/enableAutoRenew ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **core** (u16) - Required - The core to which the task to be renewed is currently assigned. - **task** (u32) - Required - The task for which we want to enable auto renewal. - **workload_end_hint** (Option) - Optional - Should be used when enabling auto-renewal for a core that is not expiring in the upcoming bulk period (e.g., due to holding a lease) since it would be inefficient to look up when the core expires to schedule the next renewal. ### Request Example ```json { "core": 1, "task": 123, "workload_end_hint": 1678886400 } ``` ### Response #### Success Response (200) - **result** (string) - Indicates the success of the operation. #### Response Example ```json { "result": "Auto-renewal enabled successfully." } ``` ``` -------------------------------- ### Manual Netlify Deployment and Workflow Source: https://context7.com/w3f/polkadot-wiki/llms.txt Manual command to execute the Netlify deployment script (`scripts/deploy.sh`). The script is expected to perform dependency installation, build the site, generate static files, and deploy to Netlify. Preview URLs are automatically generated for pull requests. ```bash # Manual deployment sh scripts/deploy.sh # Expected flow: # 1. Install dependencies from requirements.txt # 2. Build site with mkdocs build # 3. Generate static files in ./site # 4. Deploy to Netlify # Preview URLs generated for PRs automatically # Production URL: https://wiki.polkadot.network ``` -------------------------------- ### forceNewEraAlways Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/general/extrinsics.md Forces new eras at the end of sessions indefinitely. Requires Root dispatch origin. Warning: The election process may not have enough blocks to get a result if called just before a new era is triggered. ```APIDOC ## POST /api/tx/staking/forceNewEraAlways ### Description Forces new eras at the end of sessions indefinitely. Requires Root dispatch origin. Warning: The election process may not have enough blocks to get a result if called just before a new era is triggered. ### Method POST ### Endpoint /api/tx/staking/forceNewEraAlways ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **result** (string) - Indicates the success of the operation. #### Response Example ```json { "result": "Operation successful." } ``` ``` -------------------------------- ### Build and Deploy MkDocs Projects Source: https://context7.com/w3f/polkadot-wiki/llms.txt Commands for building the MkDocs site, optionally enabling RPC support, and deploying to Netlify. The deployment script (`scripts/deploy.sh`) is expected to handle the build and deployment process. ```bash # Custom build with RPC enabled ENABLE_RPC=true mkdocs build # Deploy to Netlify (automatic via CI/CD) sh scripts/deploy.sh ``` -------------------------------- ### Get Transaction Hash with TxWrapper Core Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-transaction-construction.md Calculate the transaction hash of a signed transaction using the `getTxHash` function from `@substrate/txwrapper-polkadot`. This function takes the signed transaction hex string and returns its unique hash, which can be used for tracking. ```typescript import { getTxHash } from ‘@substrate/txwrapper-polkadot’; const txHash = getTxHash(signedTx); ``` -------------------------------- ### forceNewEra Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/general/extrinsics.md Forces a new era at the end of the next session. After this, behavior resets to normal. Requires Root dispatch origin. Warning: The election process may not have enough blocks to get a result if called just before a new era is triggered. ```APIDOC ## POST /api/tx/staking/forceNewEra ### Description Forces a new era at the end of the next session. After this, behavior resets to normal. Requires Root dispatch origin. Warning: The election process may not have enough blocks to get a result if called just before a new era is triggered. ### Method POST ### Endpoint /api/tx/staking/forceNewEra ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **result** (string) - Indicates the success of the operation. #### Response Example ```json { "result": "Operation successful." } ``` ``` -------------------------------- ### Convert Public Key to Polkadot Address with Utility Script Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-account-advanced.md This JavaScript code snippet, found in the w3f/utility-scripts repository, demonstrates how to convert a public key into a Polkadot SS58 address. It's a practical example for programmatic address generation and verification. ```javascript import { pubkeyToAddress } from "@polkadot/util-crypto"; const publicKey = "0x192c3c7e5789b461fbf1c7f614ba5eed0b22efc507cda60a5e7fda8e046bcdce"; const ss58Prefix = 0; // Polkadot network prefix const polkadotAddress = pubkeyToAddress(publicKey, ss58Prefix); console.log(`Polkadot Address: ${polkadotAddress}`); ``` -------------------------------- ### Netlify Deployment Configuration Source: https://context7.com/w3f/polkadot-wiki/llms.txt The `netlify.toml` file configures production and preview deployments for the Polkadot Wiki on Netlify. It specifies build commands, publish directories, and environment variables, including `ENABLE_RPC` which is set to true for production and preview contexts. ```toml # netlify.toml - Deployment configuration [build] publish = "site" command = "sh scripts/deploy.sh" [context.production.environment] command = "sh scripts/deploy.sh" publish = "site" environment = { ENABLE_RPC = "true" } [context.deploy-preview] command = "sh scripts/deploy.sh" publish = "site" environment = { ENABLE_RPC = "true" } [context.dev] command = "sh scripts/deploy.sh" publish = "site" environment = { ENABLE_RPC = "false" } ``` -------------------------------- ### Load Chain Metadata Source: https://github.com/w3f/polkadot-wiki/blob/master/docs/learn/learn-guides-vault.md Fetches and prepares chain metadata for the Asset Hub on Kusama. This command requires the RPC endpoint for the Asset Hub and outputs a file in the 'in_progress' directory. The filename includes a version number that may change with network updates. ```bash cargo run load-metadata -d -u wss://kusama-asset-hub-rpc.polkadot.io ```