Send

The Send operation is used to transfer tokens from one account to another on the Keeta Network. It’s the most basic transaction you can perform.

Below is a minimal example that sends 1 KTA to a target address using the KeetaNet SDK. Let’s walk through the minimal example for sending tokens using KeetaNet.

1

Load the Keeta SDK and set up your seed

You import the SDK and use a demo seed to generate an account. In real usage, you’d store this seed securely (never hardcoded).

const KeetaNet = require('@keetanetwork/keetanet-client');

const DEMO_ACCOUNT_SEED = 'D3M0D3M0...';
2

Create your signer account

This generates an account object from the seed at index 0. This account will be used to sign the transaction (i.e., it's the "sender").

const sender = KeetaNet.lib.Account.fromSeed(DEMO_ACCOUNT_SEED, 0);
3

Connect to the Keeta test network

This initializes a client session connected to the testnet, using the sender account to authenticate.

const client = KeetaNet.UserClient.fromNetwork('test', sender);
4

Define the recipient

You define who you're sending tokens to. In this example, it's a faucet address, but it could be any valid Keeta account.

const recipient = KeetaNet.lib.Account.fromPublicKeyString('keeta_...');
5

Initialize a transaction builder

This creates a builder, which is used to queue one or more operations (like send, setRep, etc.) that will be packaged into a transaction.

const builder = client.initBuilder();
6

Add the send operation

builder.send(recipient, 1n, client.baseToken);

This is the core of the operation. Let’s break it down:

Argument
Meaning

recipient

The recipient account object (created earlier)

1n

The amount to send, in tokens (as a BigInt). 1n = 1 KTA

client.baseToken

The token to send (usually Keeta's native token, KTA)

So this line is saying:

“Send 1 KTA to the specified recipient.”

7

(Optional) Compute the blocks

This step lets you preview how the transaction will be constructed before sending it. It’s useful for debugging or simulation.

await client.computeBuilderBlocks(builder);

8

Publish the transaction

This sends your built transaction to the Keeta network, where it will be validated and added to the ledger.

await client.publishBuilder(builder);

If all goes well, you’ve just sent 1 KTA to the recipient. You can now build on this with more operations, like minting, delegating, or managing tokens.

Complete Code Example

const KeetaNet = require('@keetanetwork/keetanet-client');

// ⚠️ Demo seed, replace with working seed
const DEMO_ACCOUNT_SEED = 'D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0D3M0';

async function main() {
	const sender = KeetaNet.lib.Account.fromSeed(DEMO_ACCOUNT_SEED, 0);
	const client = KeetaNet.UserClient.fromNetwork('test', sender);

	const recipient = KeetaNet.lib.Account.fromPublicKeyString(
		'keeta_aabszsbrqppriqddrkptq5awubshpq3cgsoi4rc624xm6phdt74vo5w7wipwtmi'
	);

	const builder = client.initBuilder();
	builder.send(recipient, 1n, client.baseToken); // send 1 KTA

	await client.computeBuilderBlocks(builder); // optional but recommended
	await client.publishBuilder(builder);       // send it to the network

	console.log('✅ Sent 1 KTA');
}

main().catch(console.error);

Last updated