Skip to content

Your first transaction

A complete round trip: fund an account, send KNYX, and verify the result on chain.

1. Set up

bash
npm install ethers
js
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://rpc.testnet.kriptonyx.com');
const wallet   = new ethers.Wallet(process.env.PRIVATE_KEY, provider);

console.log('address:', wallet.address);
console.log('balance:', ethers.formatEther(await provider.getBalance(wallet.address)), 'KNYX');

If the balance is zero, fund the address from the faucet.

2. Send KNYX

js
const tx = await wallet.sendTransaction({
  to: '0xRecipientAddress',
  value: ethers.parseEther('0.001'),
});

console.log('submitted:', tx.hash);

const receipt = await tx.wait();
console.log('block:', receipt.blockNumber);
console.log('status:', receipt.status === 1 ? 'success' : 'failed');

parseEther converts 0.001 KNYX into aknyx. Never pass a decimal number as a value — see KNYX and denominations.

3. Verify it

Open the transaction in the explorer:

https://explorer.testnet.kriptonyx.com/tx/<hash>

Check the hash, block, sender, recipient, value and status. The same information is available from the chain data API:

bash
curl -s https://api.testnet.kriptonyx.com/api/v2/transactions/<hash>

4. Watch it happen live

Rather than polling, subscribe to the address over WebSocket and receive the update as it is indexed.

Deploying a contract

Contracts deploy exactly as on Ethereum:

js
const factory = new ethers.ContractFactory(abi, bytecode, wallet);
const contract = await factory.deploy(...args);
await contract.waitForDeployment();

console.log('deployed at:', await contract.getAddress());

Then verify its source so others can read it.

Next

Learn which API to use for what you are building.

KriptoNyx testnet — chain ID 3009 (kriptonyx_3009-1)