KLYNTAR Docs
TwitterDiscordSiteGitHub
  • Klyntar project intro
  • Project litepaper and main features
    • About project
    • Unique architecture - take the best from L1 and L2 chains
    • Multilevel sharding and modularity
    • Multistaking - native liquid staking, multichain multiasset staking and much more!
    • Checkpoints mechanism
    • Advanced cryptography - zk, mpc, fhe, post-quantum and much more!
    • Virtual machines - EVM, WASM, containers and much more!
    • Parallelization
    • Abstractions - for account, storage and chain
    • RWX - codeless smart contracts for real world usage
    • Unique shared security model
    • Mutations - add new functionality and improvements simple and fast
    • Forgetfulness - a blockchain cleaning mechanism
    • Low validator requirements and mobile validation
    • AI layer
    • Quantum future
    • Bring your social value to alternative economy
    • Ecosystem & Future services
  • Other resources & links
    • Official links
    • Brand assets
    • Partnerships
    • Tokenomics
    • 📚Glossary & Taxonomy
      • Our repositories and codebase
      • Architecture
      • Types of transactions
      • Types of accounts
      • Virtual machines
      • Consensus
      • RWX codeless smart contracts
  • Wallets usage
    • Wallets to work with WVM and native environment
    • EVM compatible wallets
  • build core and join network
    • ☁️Build the core
      • Build process
    • 🕸️Networks
      • Testnet
        • Your own private testnet
          • Netrunner
          • Netrunner and PM2
        • Public testnets
          • Testnet faucets
          • Setup testnet node
      • Mainnet
        • Setup mainnet node
    • 🪙Staking
      • Default staking
        • Staking
        • Unstaking
        • Native liquid staking
      • Multichain multiasset staking
        • Supported networks and tokens
        • Full list of supported assets
        • Work with native coins
        • Work with ERC-20 tokens
        • Work with ERC-721 tokens
        • Other
          • Work with Bitcoin, Litecoin and Doge
          • Work with XRP network
          • Work with TRON network
          • Work with Solana
        • Social value points
          • Telegram
          • Github
          • Instagram
          • Facebook (Meta)
          • YouTube
          • LinkedIn
          • Twitter
          • Discord
          • TikTok
          • Spotify
          • Hirsch index
          • Business value
        • Add your own asset
        • Connect your stakes from EigenLayer, Karak, Babylon, Solayer, etc.
      • Claiming rewards
    • 🕵️Become a validator
    • Mobile & low power devices validators
    • ⚙️Customizations
      • Create own mutation
      • Create own plugin
      • Run your node over TOR
      • Plugins usage
    • Explorers and how to use them
      • Public Explorer
      • Your own custom explorer
      • Usage guide
        • Network Parameters
        • Searchbar
        • Network Info
          • Epoches data
          • Hostchain checkpoints
  • Web1337
    • Web1337 intro
    • 🟢Simple API requests
      • Block API
      • Epoch API
      • State API
      • Misc API
      • Consensus related API
      • Transactions API
    • 🟠Transactions and smart-contracts
      • Useful advices & FAQ
      • 🔐Default Ed25519 transactions
      • 🤝BLS multisig transactions
      • 🛡️TBLS thresholdsig transactions
      • ⚛️Post-quantum transactions
      • 📃KLY-WVM - deploy and interact with the smart-contract to WASM vm
        • Interaction with a smart-contract
      • 📃KLY-EVM - deploy and interact with the smart-contract to EVM
        • Interaction with a smart-contract
      • Transfer coins between EVM and native environment
    • 🔴Advance Web1337 usage
      • Parallel execution
      • Interaction with a system smart contracts
      • 🪄Abstraction
        • 🦸‍♂️Account abstraction 2.0
        • 💾Storage Abstraction
          • 🔃Manual deployment of the storage for your contract
          • ☄️Dump EVM & WASM contract storage
          • Pay for storage rent
        • ⛓️Chain abstraction
      • 🌩️Thundercloud
        • 🏷️Using KLY Aliases in transactions
        • 🦾Deploy KIP
      • Using boosts & subscriptions
    • 🌐Networking
      • 🙈Using proxy
      • ⚡Interact with node via websockets
  • Smart Contracts and vms
    • Intro
    • 👩‍💻KLY-EVM
      • Smart contracts examples
      • 🧙‍♂️Magic address
      • Beyond the VM
        • ❎Call WASM from EVM
        • ❎Call JS from EVM
    • 👨‍💻KLY-WVM
      • Smart contracts examples
      • 🔁Simple cross-contract call (WVM-WVM)
      • Beyond the VM
        • ❎Call EVM from WASM
        • ❎Call JS from WASM
    • Containers
    • 🤓Writing smart contracts
      • Get random value from contract
    • 🧠Advanced VMs usage
      • 🔐Cryptography
        • 🎲VRF
        • ⚛️Post-quantum cryptography
        • 👀zkSNARK
        • 🤫Secure Secret Sharing
        • 🤹Using MPC
        • 🙈Using FHE
      • ⛈️Thundercloud
        • 👀KLY Oracles
          • ⏳Get the real time
          • 🌏Call any API
  • 🗺️RWX contracts
    • ℹ️Intro to real-world-execution smart contracts
    • How to use RWX contracts in your project or business
      • Web2 usage
        • User-User - agreements between default people
        • User-Business - agreements between customer and business
      • Web3 usage
        • Use in standalone blockchain projects
        • Use in DApps
    • 🤝Create RWX contract and deploy with Web1337
    • 🕵️‍♂️Become verifier
  • 👀Interesting features you must know
    • 😦Return of lost funds
  • Misc
    • 🏷️KLY Aliases
      • Web2 domain to KLY Alias
      • Web3 domain to KLY Alias
      • Social media handle to KLY Alias
  • Bots
    • 🤖Intro
  • Nodes management and maintaining
    • Core version update
    • State pruning
    • Launch own PoD (point of distribution)
    • Recovery process
    • Fast sync
  • Shared security usage
    • For blockchain networks
    • For DApps
    • For bridges
    • For oracles
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub

Last updated 4 months ago

Was this helpful?

Intro

When unstaking, you withdraw your coins from the staking balance of the validator you previously staked on.

Method 1 - via user interface

Again, the easiest way to do this is through the interface on our website. As you remember:

  1. We staked 27 coins

  2. On the pool 6XvZpuCDjdvSuot3eLr24C1wqzcf2w4QqeDh9BnDKsNE

  3. From our account 0x9f8E68B1974069B854eE481deC0819697B901f1D

Our account is still on the list of stakers and receives rewards:

On site - choose the mode Unstake . Input the amount and your pool

Confirm the transaction

Check the transaction status via explorer

Unstaking also require some time. So, now we know that unstaking transaction was in block in epoch 12:

So, let's wait for epoch 12 + 3 = 15

After this - you should receive your stake back

And if you visit the page of pool info:

You will see that your account is not in the stakers list

As you can see, your account has been removed from the list of stakers in this pool. From this moment on, you will no longer receive rewards.

Method 2 - programmatic way using SDK

Let's assume that we have this:

  1. Your address - 3JAeBnsMedzxjCMNWQYcAXtwGVE9A5DBQyXgWBujtL9R

  2. Pool you staked on - 9GQ46rqY238rk2neSwgidap9ww5zbAN4dyqyC7j5ZnBK

Let's assume that we want to do the following:

  1. Unstake 30 coins - this will return to our balance

  2. 70 coins remain in the pool - you will continue to receive rewards from the validator

1. Call system smart contract to unstake

Output:

2. Check the unstaking tx status

Go to explorer and try to find your transaction

3. Wait untill the next epoches

There is also a delay for the unstaking procedure. Since the transaction was in epoch 61

Then you will receive the coins in epoch 61+3=64

4. Check that you have less coins in pool and receive your coins back

We waited for a while and now the epoch is 64. Let's try to go to the pool page and see the list of stakers now:

Now in pool you have 70 coins instead of 100

And if you visit the page of your account you will see that 30 coins was sent to your address back

Calculation:

Transaction finished with Success status

As you can see, everything is correct

import Web1337 from 'web1337';


let web1337 = new Web1337({

    chainID:'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
    workflowVersion:0,
    nodeURL: 'http://localhost:7332'

});


let keypair = {

    pub:"3JAeBnsMedzxjCMNWQYcAXtwGVE9A5DBQyXgWBujtL9R",

    prv:"MC4CAQAwBQYDK2VwBCIEIDteWfNev7NOlNmwP8Irwg5miWKoErYGV+UU5VrFgYev"

};

const shardID = "shard_0";


let payload = {

    shard: shardID,

    contractID:'system/staking',

    method:'unstake',

    gasLimit:0,

    params:{

        poolPubKey:'9GQ46rqY238rk2neSwgidap9ww5zbAN4dyqyC7j5ZnBK',
        amount: '30000000000000000000'

    },

    imports:[]

}


const fee = 2;

const nonce = await web1337.getAccount(shardID,keypair.pub).then(account=>account.nonce+1);

const txType = "WVM_CALL";

let tx = web1337.createEd25519Transaction(shardID,txType,keypair.pub,keypair.prv,nonce,fee,payload);

console.log(tx);

web1337.sendTransaction(tx).then(value =>{

    console.log('Sent => ',value)

    console.log(`TX ID is => `,web1337.blake3(tx.sig))

}).catch(err=>console.error('Error with unstaking: ',err));
{
  v: 0,
  creator: '3JAeBnsMedzxjCMNWQYcAXtwGVE9A5DBQyXgWBujtL9R',
  type: 'WVM_CALL',
  nonce: 2,
  fee: '2000000000000000000',
  payload: {
    shard: 'shard_0',
    contractID: 'system/staking',
    method: 'unstake',
    gasLimit: 0,
    params: {
      poolPubKey: '9GQ46rqY238rk2neSwgidap9ww5zbAN4dyqyC7j5ZnBK',
      amount: '30000000000000000000'
    },
    imports: []
  },
  sigType: 'D',
  sig: 'YkfiMMLFopmxwuf3pmuKgNrpcdOuhxg3D+szrMQyIwk6DcUCS0Tl4taNIbGX1nGsQRMXiuNpKASxqyUCJxZ0Cg=='
}
Sent =>  { status: 'OK' }
TX ID is =>  ee8053b379a44662252afcd42a316e152f47a45353f7accd294a9ee321a38aed
Init balance: 20_000_000 (20 millions)

Balance after staking: 20_000_000 - 100(staking) - 2(fee) = 19_999_898

Balance after unstaking: 19_999_898 + 30(unstaking) - 2(fee) = 19_999_926
  1. build core and join network
  2. 🪙Staking
  3. Default staking

Unstaking

PreviousStakingNextNative liquid staking
  • Intro
  • Method 1 - via user interface
  • Check the transaction status via explorer
  • Method 2 - programmatic way using SDK
  • 1. Call system smart contract to unstake
  • 2. Check the unstaking tx status
  • 3. Wait untill the next epoches
  • 4. Check that you have less coins in pool and receive your coins back
🟢
✅