Skip to main content
Version: 6.2.0 - 6.2.1

setPrivateKey <src>

Set a private key used with the TronWeb instance, used for obtaining the address, signing transactions, and getting balances.

❗️WARNING :

Do not use this with any web/user facing TronWeb instances. This will leak the private key.

Usage

TronWeb.setPrivateKey(private key);

Parameters

ParameterDescriptionData Type
private keyThe private key to be setString

Returns

No return value

Example

tronWeb.setPrivateKey('AD71****7509');
tronWeb.defaultPrivateKey
'AD71****7509'