PWR is a C# library for interacting with the PWR network. It provides an easy interface for wallet management and sending transactions on PWR.
Play with Code Examples 🎮
PWR is available on The NuGet Gallery. Add this dependency to your .csproj
file:
dotnet add package PWR
Import the library:
using PWR;
using PWR.Models;
Set your RPC node:
var rpc = new RPC("https://pwrrpc.pwrlabs.io/");
Generate a new random wallet:
var wallet = new Wallet(12);
Import wallet by Seed Phrase:
string seedPhrase = "your seed phrase here";
var wallet = new Wallet(seedPhrase);
Get wallet address:
string address = await wallet.GetAddress();
Get wallet balance:
ulong balance = await wallet.GetBalance();
Transfer PWR tokens:
var response = await wallet.TransferPWR("recipientAddress", amount);
Sending a transcation to the PWR Chain returns a Response object, which specified if the transaction was a success, and returns relevant data. If the transaction was a success, you can retrieive the transaction hash, if it failed, you can fetch the error.
WalletResponse response = await wallet.TransferPWR("recipientAddress", amount);
if(response.Success) {
Console.WriteLine("Transcation Hash: " + response.Hash);
} else {
Console.WriteLine("Error: " + response.Error);
}
Send data to a VIDA:
uint vidaId = 123;
byte[] data = Encoding.UTF8.GetBytes("Hello, World!");
var response = await wallet.SendVidaData(vidaId, data);
if(response.Success) {
Console.WriteLine("Transcation Hash: " + response.Hash);
} else {
Console.WriteLine("Error: " + response.Error);
}
Get RPC Node Url:
Returns currently set RPC node URL.
var url = rpc.GetRpcNodeUrl()
Get Fee Per Byte:
Gets the latest fee-per-byte rate.
ulong fee = await rpc.GetFeePerByte();
Get Balance Of Address:
Gets the balance of a specific address.
ulong balance = await rpc.GetBalanceOfAddress("0x...");
Get Nonce Of Address:
Gets the nonce/transaction count of a specific address.
uint nonce = await rpc.GetNonceOfAddress("0x...");
If you consider to contribute to this project please read CONTRIBUTING.md first.
You can also join our dedicated channel for developers on the PWR Chain Discord
Copyright (c) 2025 PWR Labs
Licensed under the MIT license.