--- title: setPrivateKey --- # 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 ```JavaScript TronWeb.setPrivateKey(private key); ``` ## Parameters | Parameter | Description | Data Type | | ----------- | ------------------------- | --------- | | private key | The private key to be set | String | ## Returns No return value ## Example ```JavaScript tronWeb.setPrivateKey('AD71****7509'); tronWeb.defaultPrivateKey // output-start 'AD71****7509' // output-end ```