tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
423 stars 271 forks source link

Using API #544

Open zachariahevans174 opened 1 month ago

zachariahevans174 commented 1 month ago

I was looking at the initial way to set up the Tron Node and server. How do I obtain my private key using the API or is it possible to transfer using api without the private key.

start940315 commented 1 month ago

You must create an account first. An account includes a private key and an address. The method is as below:

const account = TronWeb.createAccount();
zachariahevans174 commented 1 month ago

It already shows my main and side public keys.

Satan-web3 commented 1 month ago

Did you mean to obtain the genesis account? It is exists in the No.0 block. You can obtain it by using api below:

tronWeb.trx.getBlockByNumber(0);