Watr Developer Portal
  • Home
  • Quickstart
    • Block Explorer
    • Creating a Polkadot Wallet
    • Requesting Watr Tokens
    • Connecting to Testnet
    • Keystore Setup
    • Submitting a Transaction
    • Building & Running Locally
  • Builders
    • Adding an Asset
    • Substrate Contracts
    • Ethereum Contracts
      • Deploy ERC-20 Contracts
      • Interact with ERC-20 Contract
      • Polkadot/Ethereum Address Translation
      • Add Watr to Metamask Wallet
      • Send WATR to/from Metamask Wallet
      • Launch local Ethereum block explorer
      • Remix
    • Watr SS58 Spec
  • Running A Node
    • Node Types
    • Standard Requirements
    • Deployment
Powered by GitBook
On this page
  • Keystore Setup
  • Adding a Key via Mnemonic Seed
  1. Quickstart

Keystore Setup

Interacting with the API programmatically requires setting up a keystore. The only differentiating factor for setting up a keystore for use on Watr vs on other substrate based chains is the address prefix. For Watr the address prefix is 19 which results in all Watr addresses starting with the number 2

Keystore Setup

import { Keyring } from "@polkadot/api"

class Keystore {
    private keystore: Keyring
    constructor() {
                this.keystore = new Keyring({ type: 'sr25519' })
                // we set the kestore to Watr Format
                this.keystore.setSS58Format(19) 
            }
        )
    }
}

Adding a Key via Mnemonic Seed

const mnemonic = "outer exit wish coconut category liberty fade diagram logic noodle frozen safe"
const account = keyring.addFromMnemonic(mnemonic)
PreviousConnecting to TestnetNextSubmitting a Transaction

Last updated 2 years ago