Instantiate a PrivateKeyWallet with a given private key. This wallet is capable of signing transactions and messages, interacting with smart contracts, and performing other blockchain operations. This wallet type is intended for backend applications only, due to the sensitive nature of private keys.


var wallet = await PrivateKeyWallet.Create(client, "yourPrivateKeyHex");


Here is an example of creating a PrivateKeyWallet to sign a simple message. This example assumes you have a ThirdwebClient instance already created:

var client = ThirdwebClient.Create("yourClientId");
var privateKeyHex = "yourPrivateKeyHex"; // Should be securely stored and accessed
var wallet = await PrivateKeyWallet.Create(client, privateKeyHex);
Console.WriteLine($"PrivateKeyWallet address: {await wallet.GetAddress()}");
// Sign a message
var message = "Hello, Thirdweb!";
var signature = await wallet.PersonalSign(message);
Console.WriteLine($"Signature: {signature}");

Note: The PrivateKeyWallet is intended for use in secure, backend environments. Ensure private keys are never exposed or hard-coded in client-side applications. Use InAppWallet and SmartWallet for client-side applications.