The Klever .NET SDK is a library for integrating with the Klever blockchain, enabling you to create, sign, send, and decode transactions, as well as interact with smart contracts. The project is organized into three main directories:
Clone or add the kleversdk
library to your .NET solution.
using kleversdk.core;
using kleversdk.provider;
You can use the SDK to interact with the Klever blockchain. For example, to create a wallet, query an account, and send a transaction:
// Initialize provider for TestNet
var kp = new KleverProvider(new NetworkConfig(Network.TestNet));
// Create wallet from mnemonic
var mnemonic = "word1 word2 ...";
var wallet = Wallet.DeriveFromMnemonic(mnemonic);
var acc = wallet.GetAccount();
// Sync account data
await acc.Sync(kp);
// Send a transaction
var tx = await kp.Send(acc.Address.Bech32, acc.Nonce, "recipient_address", 100);
var decoded = await kp.Decode(tx);
var signature = wallet.SignHex(decoded.Hash);
tx.AddSignature(signature);
var broadcastResult = await kp.Broadcast(tx);
Console.WriteLine($"Broadcast result: {broadcastResult.String()}");
The demo
directory provides runnable examples that demonstrate how to use the Klever .NET SDK for different blockchain operations. Here are some of the included examples: