Quickstart
Purpose
The purpose of it is to set up a complete private network for Tron development by docker.
#Build
Dependencies
Minimum Hardware Requirements
- CPU: 64-bit x86_64, 2+ Cores
- RAM: 4 GB+
Environment
- The latest version Docker
- Node.JS Console
Pull the image using docker:
docker pull trontools/quickstart
Run the container:
docker run -it \
-p 9090:9090 \
--rm \
--name tron \
trontools/quickstart
Note
- The --rm option automatically removes the container after it exits. This is very important because the container cannot be restarted, it MUST be run from scratch to correctly configure the environment.
Verify the image is running correctly:
After the command form shell1,you should see something like shell2
docker exec -it tron ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 20044 1900 pts/0 Ss+ 01:42 0:00 bash ./quickstart v2.0.0
root 13 0.2 0.0 50148 1740 pts/0 Sl+ 01:42 0:00 redis-server *:6379
root 15 0.0 0.0 20044 40 pts/0 S+ 01:42 0:00 bash ./quickstart v2.0.0
root 16 11.5 19.2 5277964 393692 pts/0 Sl+ 01:42 0:31 java -jar FullNode.jar -c fullnode.conf --witness
root 43 0.1 1.8 930932 37456 ? Ssl 01:42 0:00 PM2 v3.3.1: God Daemon (/root/.pm2)
root 54 0.2 2.6 939316 54880 ? Ssl 01:42 0:00 /tron/eventron/eventron
root 67 0.5 3.1 941540 64212 pts/0 Sl+ 01:42 0:01 node /tron/app
root 72 412 32.0 5208448 655136 pts/0 Sl+ 01:42 18:49 java -jar BlockParser.jar --Node-list 127.0.0.1 --intial-block 1 -end -1 --event-server http://127.0.0.1:8060 --secret-key TNSpckEZhGfZ4ryidHG2fYWMARLpZ6U139
root 261 0.0 0.1 20176 3748 pts/1 Ss 01:46 0:00 bash
root 289 0.0 0.1 36068 3168 pts/1 R+ 01:47 0:00 ps aux
Note
- If redis-server, nodes, or the event server are not running, exit and run the container again.
To see the logs of the full node you can execute
docker exec -it tron tail -f /tron/FullNode/logs/tron.log
Usage
Options
Use -e flag to pass environmental variables to the docker. Example:
docker run -it \
-p 9090:9090 \
--rm \
--name tron \
-e "accounts=20" \
trontools/quickstart
List of options:
- accounts=12 sets the number of generated accounts
- useDefaultPrivateKey=true tells Quickstart to use the default account as accounts[0]
- mnemonic=wrong bit chicken kitchen rat uses a specified mnemonic
- defaultBalance=100000 sets the initial balance for the generated accounts (in the example to 100,000 TRX)
- seed=ushwe63hgeWUS sets the seed to be used to generate the mnemonic (if none is passed)
- hdPath=m/44'/60'/0'/0 sets a custom bit39 hdPath
- formatJson=true formats the output
- preapprove=... pre approved proposals (see below for more help)
Pre-approved proposals
To pre-approve, for example, getMultiSignFee and allowMultiSign, you can run the images as:
docker run -it \
-p 9090:9090 \
--rm \
--name tron \
-e "preapprove=multiSignFee:1,allowMultiSign:1" \
trontools/quickstart
For a complete list of option proposals check out
https://api.trongrid.io/wallet/getchainparameters
Available accounts
- base58
curl http://127.0.0.1:9090/admin/accounts
- hexstring:
curl http://127.0.0.1:9090/admin/accounts?format=hex
- Both formats
curl http://127.0.0.1:9090/admin/accounts?format=all
Available Accounts
==================
(0) TJdDmJVYa9TcMJvCc9WsdaEXEYgeJrGVPq (100000 TRX)
(1) TNmLX3rJZNdq7kxgxs1y39FP3hp8LWHLUX (100000 TRX)
(2) TASrJ76QANNPRgdDHHikWWApQzxh3HPku4 (100000 TRX)
(3) TNkzaPqNipxKbU5ecUZz7P7UdejiE82zc7 (100000 TRX)
(4) TWCcS3cAVeNWhX1J6LHMEsEkWGq43t4EXc (100000 TRX)
(5) TW1QH88er9UqUKhoHLdm8dQTG2NsYU6C2h (100000 TRX)
(6) TKJu6vpKAknBwzovm5NiBZ1j69nWmeXGyw (100000 TRX)
(7) TQUddX2gBhGV7d33a2kZchVsPuWLdZBeXY (100000 TRX)
(8) TXjdePoR6ZRfBeiaZ9QoUyGwdHGhTPdy6x (100000 TRX)
(9) TGJnVM3TcvsKaDL3zpNm92gw2YHrPx8s3Y (100000 TRX)
Private Keys
==================
(0) 86134c8a51446c21b501f3a05844e18fdb72d3a5420867737c8640ce0ec656ca
(1) 57e04ac5484dd2c3d97b44c5e232b6203c2759642f38c5ea6787b0e4044de165
(2) 138a22c03039e688daa2b7c785d1e8d6b9375d4413e6ea82471b1e7a61701a9d
(3) e83a4958e81654efb162cef269e323ac501aa81d850ba9aed5a7d4f3c26d5a0a
(4) 05cdb18a4638d21d3f1f18e6bdb601a60b4debc85ee9bf8b385a2613693da24f
(5) b66225af9b24c9eb92ef65e3ff540c5c260de9fc8bb01a51fc44490bafe7ab3e
(6) 0b75b702316f1dcb2c7ca5aee9e1cd9bbdcf747e27fc417c324971caaf59772c
(7) 15e2547daf170c6f0e0dd0d64c35c1259206bc481a0c9d571bac0b1197f51d11
(8) 858c97998d9bebddc9320157e538d248dfcc64cd4c5c8ea97dfcb5d8396b37a0
(9) 32d2d45c05758f7de37a542798aac91315bd269565c99eafb33ebfb3a54ac046
HD Wallet
==================
Mnemonic: treat nation math panel calm spy much obey moral hazard they sorry
Base HD Path: m/44'/60'/0'/0/{account_index}
More accounts?
curl http://127.0.0.1:9090/admin/temporary-accounts-generation?accounts=5
Same accounts
If you would like to use the same accounts each time, there are two ways to do that:
- By passing a mnemonic to the docker
- By using accounts-data/accounts.json,put your own private keys in the privateKeys array, and run the container.
{ hdPath: 'm/44\'/60\'/0\'/0/',
mnemonic:
'grid wire envelope task bright aerobic fragile mother asset wish harvest wild',
privateKeys:
[ '27c2a416b135d52337725955359a08cd70a73844b1d58b909ecd42cd749a4acb',
'e67a7dec7ce9fa6970a2a36d1f67a789ed1a684271e23c7df395354908d81853',
'5eac42eb3484be190c24e050842ac9e8fa01debc84e3f48771d8b03e9bc21a29',
'9b086cbf9bab77cfb7bab5155dc1c62b1eebd1c5c73822208832e9c4cfbe78b5',
'4fe8f6582e7eeb6bd4e13aa56ec6fa02b4ec77f5fe99860352439fd856db4929',
'f0c8c4812914ba6a3bc37c7e40f28bd4029f0f9e69da74b81ca6357a5a337e72',
'9f7e1842bf257dfeabbb6f20f5c6e2f3a211b504e7cdb8a60fae20cfb9816176',
'0ae57ff2059579af2639dca6b01ffdb47aab2c85e723f4c7ece3e272ee3e4eee',
'43d5f335747e938659a95d3e82482015e69b50b10b8e59b8d12408b52d32aac0',
'e08c645bc4907e9f83593c725f3fbb2e63fc69d603de46c3619c0bc8fb6c6bad' ],
more: [] }
if [[ ! -d "accounts-data" ]]; then mkdir accounts-data; fi
docker run -it -p 9090:9090 \
--name tron \
-v $PWD/accounts-data:/config \
trontools/quickstart
TronBox 2.1+ configuration
Configure your tronbox.js file as:
module.exports = {
networks: {
development: {
privateKey: 'da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0',
fullHost: "http://127.0.0.1:9090",
network_id: "9"
}
}
};
TronWeb configuration
Instantiate tronWeb as in the following example:
const TronWeb = require('tronweb')
const tronWeb = new TronWeb(
"http://127.0.0.1:9090",
"http://127.0.0.1:9090",
"http://127.0.0.1:9090",
'da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0',
)
The easiest way to interact with the private network is by using TronWeb from the container:
docker exec -it tron ./tronWeb
RPC
If you are running Tron Wallet-cli or any other tool which connects to the private network via RPC, you can just expose the ports . . . and voila!
docker run -it -p 50051:50051 -p 50052:50052 \
--name tron \
trontools/quickstart
Note
- Running TronBox can put a lot of stress on the local network. If the FullNode is busy, it returns the "SERVER_BUSY" error. If it does, just repeat your command.
Version
#You can see which version you currently running executing
docker ps
#If you want also to know which version of JavaTron is used by Tron Quickstart, run
curl localhost:9090/wallet/getnodeinfo | grep 'codeVersion' --color
Source code
https://github.com/TRON-US/docker-tron-quickstart/tree/b127a0846cfe4d8d20302b816c746749140bd3f1
Updated almost 5 years ago