Testnet Tensor
  • Introduction
  • Explorer
  • GPT
  • DSN Dashboard
  • Create Account
    • Wallet
    • CLI
    • Faucet
  • Hypertensor CLI
    • Hypertensor CLI
  • Run A Subnet Node
    • Getting Started
    • Wiki
      • Running on AMD GPU
      • Running on Windows Using WSL
      • Troubleshooting
    • Generate Keypair
    • Register & Stake
    • Add
    • Start Validator Node
    • Start Bootstrap Node
    • Activate
    • Update Delegate Reward Rate
    • Deactivate
    • Remove
    • Keys
  • Delegate Staking
    • Introduction
    • Add Delegate Stake
    • Transfer Delegate Stake
    • Remove Delegate Stake
    • Claim Delegate Stake
  • Node Delegate Staking
    • Introduction
    • Add Node Delegate Stake
    • Transfer Node Delegate Stake
    • Remove Node Delegate Stake
    • Claim Node Delegate Stake
  • Delegate Staking Utils
    • Introduction
    • Subnet to Node
    • Node to Subnet
  • Build a Subnet
    • Introduction
    • DSN Standard
    • Subnet Consensus Protocol (SCP)
      • Incentives
      • Accounting
      • Proposals
    • Subnet
      • Registration
      • Activation
      • Deactivation
    • Subnet Nodes
      • Registration
      • Activation
      • Deactivate
  • Contribute
Powered by GitBook
On this page
  1. Delegate Staking Utils

Subnet to Node

Transfer your subnet delegate stake balance to a subnet node.

keypair = Keypair.create_from_uri('//Alice') # replace with your mnemonic phrase

call = substrate.compose_call(
  call_module='Network',
  call_function='transfer_from_subnet_to_node',
  call_params={
    'from_subnet_id': from_subnet_id,
    'to_subnet_id': to_subnet_id,
    'to_subnet_node_id': to_subnet_node_id,
    'delegate_stake_shares_to_be_switched': delegate_stake_shares_to_be_switched,
  }
)

extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)

receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
const api = await ApiPromise.create();

// Construct the keyring after the API (crypto has an async init)
const keyring = new Keyring({ type: 'sr25519' });

// Replace //Alice with your mnemonic phrase
const keypair = keyring.addFromUri('//Alice');

const fromSubnetId = 1;
const toSubnetId = 2;
const toSubnetNodeId = 1;
const delegateStakeSharesToBeSwitched = 1000;

const extrinsic = api.tx.network.transferFromNodeToSubnet(
    fromSubnetId
    toSubnetId
    toSubnetNodeId
    delegateStakeSharesToBeSwitched
);

const hash = await extrinsic.signAndSend(keypair);

PreviousIntroductionNextNode to Subnet

Last updated 1 month ago