Pendulum Docs
  • Learn
    • Welcome to Pendulum
    • Our Journey
    • Litepaper
    • Tokenomics
      • Token Utility
      • Unlocking Vesting Tokens
    • Roadmap
    • Grants Received
  • Build
    • Introduction
    • Network Parameters
    • Build Environment
      • Local relay chain setup
      • Local Pendulum chain setup
      • Pre-Configured Pendulum
        • Install
        • Configure
        • Launch
        • Sub-commands
          • export-genesis
          • generate-specs
          • generate-docker
      • Foucoco (testnet)
      • Troubleshooting
    • Developing dApps
      • ink!
    • Node Operators
      • Collators
        • Collators List
        • Set up Collator
          • Hardware Requirements
          • Ubuntu Installation
          • Docker Installation
          • Keys Management
          • Become a Collator
          • Node upgrade instructions
      • Spacewalk Vaults
    • Integrations
      • Indexers
      • Oracles
      • Wallets
    • Spacewalk (Stellar bridge)
      • User
        • Spacewalk Step-by-step guide
          • Asset Redemption Post-Vault Liquidation
      • Operating a Vault client
        • Getting Started
          • Testing it locally
            • Building pallets and testchain
            • Creating test accounts
            • Testing the vault client
        • Usage
          • Issue assets
          • Redeem assets
        • Collateral and Liquidation
          • Recovering a vault after liquidation
        • Fees, Costs and Incentives
        • Vault rewards
          • Claiming Vault rewards
        • Troubleshooting
          • Generating metadata
    • Forex AMM
      • Architecture
      • Swap User Guide
      • LP User Guide
        • Swap Pools
        • Backstop Pool
        • Cross Interaction
      • Coverage Ratio and Slippage
      • Deployment Parameters
      • Security and Audits
    • Technical FAQ
    • Status reports
      • 22-10-11 Foucoco stopped after runtime upgrade
  • Community
    • Crowdloan
      • Sign T&Cs for rewards
    • Staking
      • Choosing a Collator to Stake with for $PEN Staking Rewards
      • Delegation
      • Rewards
      • Further Operations on Delegators
    • Testnet Faucet
    • On chain identity guide
    • Cross-chain transfer KSM
    • Using Ledger
    • Governance
    • PEN and AMPE Wallets
    • Add PEN/DOT Liquidity to StellaSwap
    • Pendulum Grant Program
    • Amplitude Grants Program
    • Ambassador Program
    • Ambassador Bounties
  • Resources
    • FAQ
    • Links
      • Website
      • Github
      • Social Media
    • Audits
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Build
  2. Spacewalk (Stellar bridge)
  3. Operating a Vault client
  4. Troubleshooting

Generating metadata

This page describes how to generate a metadata scale file manually from your parachain in order to execute the Vault properly.

The metadata file is used by the Vault client in order to interact with the Substrate Chain, since it contains all the extrinsics and events that are used by it. In the vault client, the metadata files that you need for running Spacewalk in a testchain or pendulum, are included.

But if for some reason, you're experiencing troubles with the types or the extrinsic calls, you may want to obtain this file yourself. There are many tools that can be used to fetch this file, namely subxt from Parity among others, but here we will focus on how to do it without them. First of all, it is really important that we get this file from the chain we are connecting to. If you're adding the pallet to a Parachain, then make sure you extract the metadata from the collator node.

When connecting to a parachain, make sure to write down the ws port in which the collator node is listening to.

Even though you might have specified the port with --ws-portwhen launching the collator node, if it conflicts with a port already in use, a random one would be used instead.

Once the node is running, we need to send a jsonrpc call to it and execute the state_getMetadata extrinsic. So find your favorite tool for connecting to a websocket (eg. Postman), and send the following request to ws://localhost:{your_node_port}:

{  
    "id": 1,  
    "jsonrpc": "2.0",  
    "method": 
    "state_getMetadata",  
    "params": []
}

If successful, this would give you a result similar to this one:

{  
    "jsonrpc": "2.0",  
    "result": "0x6d6574610b7c1853797374656d3a3a4163..."
    "id": "1"
}

Copy the resulting hex to a file and save it.

Now, we need to process that file i.e. convert it into bytes representation and save it as metadata-parachain.scale. Here is a piece of Rust code that will do it for you. Replace the filename in the code to match your file and run it.

fn main() {
    // replace metadata.txt with your file's name 
    let content = fs::read_to_string("./metadata.txt").expect("Unable to read file");

    let bytes = hex::decode(content.trim_start_matches("0x")).unwrap();

    std::io::stdout().write_all(&bytes).unwrap();
}

Now with this, run the project and pipe the output to a file cargo run --release > metadata-parachain.scale Now that we have the scale file, you need to copy it to clients/runtime/metadata-parachain.scale, since it will be used later when running the vault.

PreviousTroubleshootingNextForex AMM

Last updated 1 year ago

Was this helpful?