setPrivateKey
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
Parameter | Description | Data Type |
---|---|---|
private key | The private key to be set | String |
Returns
No return value
Example
>tronWeb.setPrivateKey('AD71C52E0FC0AB0DFB13B3B911624D4C1AB7BDEFAD93F36B6EF97DC955577509');
undefined
> tronWeb.defaultPrivateKey
'AD71C52E0FC0AB0DFB13B3B911624D4C1AB7BDEFAD93F36B6EF97DC955577509'