Skip to content

Commit 1625f0b

Browse files
committed
Merge branch 'develop' of github.com:tronprotocol/java-tron into ww
2 parents 0d48db4 + 989115a commit 1625f0b

File tree

38 files changed

+262
-212
lines changed

38 files changed

+262
-212
lines changed

README.md

Lines changed: 81 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
Java implementation of the <a href="https://tron.network">Tron Protocol</a>
1111
</h4>
1212

13-
1413
<p align="center">
1514
<a href="https://gitter.im/tronprotocol/allcoredev">
1615
<img src="https://camo.githubusercontent.com/da2edb525cde1455a622c58c0effc3a90b9a181c/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667">
@@ -42,6 +41,7 @@
4241
</p>
4342

4443
## Table of Contents
44+
4545
- [What’s TRON?](#whats-tron)
4646
- [Building the Source Code](#building-the-source)
4747
- [Running java-tron](#running-java-tron)
@@ -55,94 +55,109 @@
5555

5656
TRON is a project dedicated to building the infrastructure for a truly decentralized Internet.
5757

58-
* Tron Protocol, one of the largest blockchain-based operating systems in the world, offers scalable, high-availability and high-throughput support that underlies all the decentralized applications in the TRON ecosystem.
58+
- Tron Protocol, one of the largest blockchain-based operating systems in the world, offers scalable, high-availability and high-throughput support that underlies all the decentralized applications in the TRON ecosystem.
5959

60-
* Tron Virtual Machine (TVM) allows anyone to develop decentralized applications (DAPPs) for themselves or their communities with smart contracts thereby making decentralized crowdfunding and token issuance easier than ever.
60+
- Tron Virtual Machine (TVM) allows anyone to develop decentralized applications (DAPPs) for themselves or their communities with smart contracts thereby making decentralized crowdfunding and token issuance easier than ever.
6161

6262
TRON enables large-scale development and engagement. With over 2000 transactions per second (TPS), high concurrency, low latency, and massive data transmission. It is ideal for building decentralized entertainment applications. Free features and incentive systems allow developers to create premium app experiences for users.
6363

6464
# Building the source
65+
6566
Building java-tron requires `git` and 64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet. Make sure you operate on `Linux` and `MacOS` operating systems.
6667

6768
Clone the repo and switch to the `master` branch
6869

69-
```bash
70-
$ git clone https://github.com/tronprotocol/java-tron.git
71-
$ cd java-tron
72-
$ git checkout -t origin/master
73-
```
70+
```bash
71+
$ git clone https://github.com/tronprotocol/java-tron.git
72+
$ cd java-tron
73+
$ git checkout -t origin/master
74+
```
75+
7476
then run the following command to build java-tron, the `FullNode.jar` file can be found in `java-tron/build/libs/` after build successful.
77+
7578
```bash
7679
$ ./gradlew clean build -x test
7780
```
7881

79-
8082
# Running java-tron
83+
8184
Running java-tron requires 64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet. Make sure you operate on `Linux` and `MacOS` operating systems.
8285

83-
Get the mainnet configuration file: [main_net_config.conf](https://github.com/tronprotocol/tron-deployment/blob/master/main_net_config.conf), other network configuration files can be find [here](https://github.com/tronprotocol/tron-deployment).
86+
Get the mainnet configuration file: [main_net_config.conf](https://github.com/tronprotocol/tron-deployment/blob/master/main_net_config.conf), other network configuration files can be found [here](https://github.com/tronprotocol/tron-deployment).
87+
8488
## Hardware Requirements
89+
8590
Minimum:
86-
* CPU with 8 cores
87-
* 16GB RAM
88-
* 2TB free storage space to sync the Mainnet
91+
92+
- CPU with 8 cores
93+
- 16GB RAM
94+
- 2TB free storage space to sync the Mainnet
8995

9096
Recommended:
91-
* CPU with 16+ cores(32+ cores for a super representative)
92-
* 32GB+ RAM(64GB+ for a super representative)
93-
* High Performance SSD with at least 2.5TB free space
94-
* 100+ MB/s download Internet service
9597

98+
- CPU with 16+ cores(32+ cores for a super representative)
99+
- 32GB+ RAM(64GB+ for a super representative)
100+
- High Performance SSD with at least 2.5TB free space
101+
- 100+ MB/s download Internet service
96102

97103
## Running a full node for mainnet
98-
Full node has full historical data, it is the entry point into the TRON network , it can be used by other processes as a gateway into the TRON network via HTTP and GRPC endpoints. You can interact with the TRON network through full node:transfer assets, deploy contracts, interact with contracts and so on. `-c ` parameter specifies a configuration file to run a full node:
99-
```bash
100-
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
101-
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
102-
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
103-
-XX:+PrintGCDateStamps -Xloggc:gc.log \
104-
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
105-
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
106-
-XX:+HeapDumpOnOutOfMemoryError \
107-
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
108-
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
109-
```
104+
105+
Full node has full historical data, it is the entry point into the TRON network , it can be used by other processes as a gateway into the TRON network via HTTP and GRPC endpoints. You can interact with the TRON network through full node:transfer assets, deploy contracts, interact with contracts and so on. `-c` parameter specifies a configuration file to run a full node:
106+
107+
```bash
108+
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
109+
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
110+
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
111+
-XX:+PrintGCDateStamps -Xloggc:gc.log \
112+
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
113+
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
114+
-XX:+HeapDumpOnOutOfMemoryError \
115+
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
116+
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
117+
```
118+
110119
## Running a super representative node for mainnet
111-
Adding the `--witness` parameter to the startup command, full node will run as a super representative node. The super representative node supports all the functions of the full node and also supports block production. Before running, make sure you have a super representative account and get votes from others,once the number of obtained votes ranks in the top 27, your super representative node will participate in block production.
112120

113-
Fill in the private key of super representative address into the `localwitness` list in the `main_net_config.conf`, here is an example:
114-
```
115-
localwitness = [
116-
650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812
117-
]
118-
```
121+
Adding the `--witness` parameter to the startup command, full node will run as a super representative node. The super representative node supports all the functions of the full node and also supports block production. Before running, make sure you have a super representative account and get votes from others. Once the number of obtained votes ranks in the top 27, your super representative node will participate in block production.
122+
123+
Fill in the private key of super representative address into the `localwitness` list in the `main_net_config.conf`. Here is an example:
124+
125+
```
126+
localwitness = [
127+
<your_private_key>
128+
]
129+
```
119130

120131
then run the following command to start the node:
121-
```bash
122-
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
123-
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
124-
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
125-
-XX:+PrintGCDateStamps -Xloggc:gc.log \
126-
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
127-
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
128-
-XX:+HeapDumpOnOutOfMemoryError \
129-
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
130-
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
131-
```
132+
133+
```bash
134+
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
135+
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
136+
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
137+
-XX:+PrintGCDateStamps -Xloggc:gc.log \
138+
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
139+
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
140+
-XX:+HeapDumpOnOutOfMemoryError \
141+
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
142+
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
143+
```
132144

133145
## Quick Start Tool
134-
An easier way to build and run java-tron is to use `start.sh`, `start.sh` is a quick start script written in shell language, you can use it to build and run java-tron quickly and easily.
146+
147+
An easier way to build and run java-tron is to use `start.sh`. `start.sh` is a quick start script written in the Shell language. You can use it to build and run java-tron quickly and easily.
135148

136149
Here are some common use cases of the scripting tool
137-
* Use `start.sh` to start a full node with the downloaded `FullNode.jar`
138-
* Use `start.sh` to download the latest `FullNode.jar` and start a full node.
139-
* Use `start.sh` to download the latest source code and compile a `FullNode.jar` and then start a full node.
150+
151+
- Use `start.sh` to start a full node with the downloaded `FullNode.jar`
152+
- Use `start.sh` to download the latest `FullNode.jar` and start a full node.
153+
- Use `start.sh` to download the latest source code and compile a `FullNode.jar` and then start a full node.
140154

141155
For more details, please refer to the tool [guide](./shell.md).
142156

143157
## Run inside Docker container
144158

145159
One of the quickest ways to get `java-tron` up and running on your machine is by using Docker:
160+
146161
```shell
147162
$ docker run -d --name="java-tron" \
148163
-v /your_path/output-directory:/java-tron/output-directory \
@@ -155,29 +170,35 @@ $ docker run -d --name="java-tron" \
155170
This will mount the `output-directory` and `logs` directories on the host, the docker.sh tool can also be used to simplify the use of docker, see more [here](docker/docker.md).
156171

157172
# Community
173+
158174
[Tron Developers & SRs](https://discord.gg/hqKvyAM) is Tron's official Discord channel. Feel free to join this channel if you have any questions.
159175

160176
[Core Devs Community](https://t.me/troncoredevscommunity) is the Telegram channel for java-tron community developers. If you want to contribute to java-tron, please join this channel.
161177

162178
[tronprotocol/allcoredev](https://gitter.im/tronprotocol/allcoredev) is the official Gitter channel for developers.
163179

164180
# Contribution
165-
Thank you for considering to help out with the source code! If you'd like to contribute to java-tron, please see the [Contribution Guide](./CONTRIBUTING.md) for more details.
166181

182+
Thank you for considering to help out with the source code! If you'd like to contribute to java-tron, please see the [Contribution Guide](./CONTRIBUTING.md) for more details.
167183

168184
# Resources
169-
* [Medium](https://medium.com/@coredevs) java-tron's official technical articles are published there.
170-
* [Documentation](https://tronprotocol.github.io/documentation-en/introduction/) java-tron's official technical documentation website.
171-
* [Test network](http://nileex.io/) A stable test network of TRON contributed by TRON community.
172-
* [Tronscan](https://tronscan.org/#/) TRON network blockchain browser.
173-
* [Wallet-cli](https://github.com/tronprotocol/wallet-cli) TRON network wallet using command line.
174-
* [TIP](https://github.com/tronprotocol/tips) TRON Improvement Proposal (TIP) describes standards for the TRON network.
175-
* [TP](https://github.com/tronprotocol/tips/tree/master/tp) TRON Protocol (TP) describes standards already implemented in TRON network but not published as a TIP.
185+
186+
- [Medium](https://medium.com/@coredevs) java-tron's official technical articles are published there.
187+
- [Documentation](https://tronprotocol.github.io/documentation-en/introduction/) java-tron's official technical documentation website.
188+
- [Test network](http://nileex.io/) A stable test network of TRON contributed by TRON community.
189+
- [Tronscan](https://tronscan.org/#/) TRON network blockchain browser.
190+
- [Wallet-cli](https://github.com/tronprotocol/wallet-cli) TRON network wallet using command line.
191+
- [TIP](https://github.com/tronprotocol/tips) TRON Improvement Proposal (TIP) describes standards for the TRON network.
192+
- [TP](https://github.com/tronprotocol/tips/tree/master/tp) TRON Protocol (TP) describes standards already implemented in TRON network but not published as a TIP.
193+
176194
# Integrity Check
177-
* After January 3, 2023, releases are signed the gpg key:
195+
196+
- After January 3, 2023, the release files will be signed using a GPG key pair, and the correctness of the signature will be verified using the following public key:
178197
```
179198
pub: 1254 F859 D2B1 BD9F 66E7 107D F859 BCB4 4A28 290B
180199
181200
```
201+
182202
# License
203+
183204
java-tron is released under the [LGPLv3 license](https://github.com/tronprotocol/java-tron/blob/master/LICENSE).

Tron protobuf protocol document.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,11 @@ Transaction and transaction-related messages.
546546

547547
message `raw`
548548

549-
`ref_block_bytes`: Deprecated.
549+
`ref_block_bytes`: intercepted part of the now block bytes in transaction head.
550550

551-
`ref_block_num`: now block number in transaction head.
551+
`ref_block_num`: Deprecated.
552552

553-
`ref_block_hash`: now block hash in transaction head.
553+
`ref_block_hash`:intercepted part of the now block hash in transaction head..
554554

555555
`expiration`: the expiration time in transaction head.
556556

@@ -565,15 +565,15 @@ Transaction and transaction-related messages.
565565
```java
566566
message raw {
567567
bytes ref_block_bytes = 1;
568-
int64 ref_block_num = 3;
568+
int64 ref_block_num = 3;
569569
bytes ref_block_hash = 4;
570-
int64 expiration = 8;
570+
int64 expiration = 8;
571571
repeated authority auths = 9;
572-
bytes data = 10;
572+
bytes data = 10;
573573
repeated Contract contract = 11;
574-
bytes scripts = 12;
574+
bytes scripts = 12;
575575
int64 timestamp = 14;
576-
int64 fee_limit = 18;
576+
int64 fee_limit = 18;
577577
}
578578
```
579579

actuator/build.gradle

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
11
description = "actuator – a series of transactions for blockchain."
22

3-
// Dependency versions
4-
// ---------------------------------------
5-
6-
def junitVersion = "4.13.2"
7-
def mockitoVersion = "2.1.0"
8-
def testNgVersion = "6.11"
9-
def slf4jVersion = "1.7.25"
10-
// --------------------------------------
11-
123
dependencies {
134
compile project(":chainbase")
145
compile project(":protocol")
156
compile project(":crypto")
16-
testImplementation "junit:junit:$junitVersion"
17-
testImplementation "org.mockito:mockito-core:$mockitoVersion"
18-
19-
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
20-
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69'
21-
compile group: 'commons-codec', name: 'commons-codec', version: '1.11'
22-
compile 'org.reflections:reflections:0.9.11'
237
}
248

259
test {

build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ subprojects {
3838
dependencies {
3939
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
4040
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
41-
compile "org.slf4j:jcl-over-slf4j:1.7.25"
4241
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.9'
43-
compileOnly 'org.projectlombok:lombok:1.18.12'
44-
annotationProcessor 'org.projectlombok:lombok:1.18.12'
45-
testCompileOnly 'org.projectlombok:lombok:1.18.12'
46-
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
4742
compile group: 'com.google.guava', name: 'guava', version: '30.1-jre'
4843
compile "com.google.code.findbugs:jsr305:3.0.0"
4944
compile group: 'org.springframework', name: 'spring-context', version: '5.3.18'
@@ -52,7 +47,15 @@ subprojects {
5247
compile group: 'org.apache.commons', name: 'commons-math', version: '2.2'
5348
compile "org.apache.commons:commons-collections4:4.1"
5449
compile group: 'joda-time', name: 'joda-time', version: '2.3'
50+
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69'
51+
52+
compileOnly 'org.projectlombok:lombok:1.18.12'
53+
annotationProcessor 'org.projectlombok:lombok:1.18.12'
54+
testCompileOnly 'org.projectlombok:lombok:1.18.12'
55+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
5556

57+
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
58+
testImplementation "org.mockito:mockito-core:2.1.0"
5659
}
5760

5861
task sourcesJar(type: Jar, dependsOn: classes) {

chainbase/build.gradle

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,16 @@ description = "chainbase – a decentralized database for blockchain."
22

33
// Dependency versions
44
// ---------------------------------------
5-
6-
def junitVersion = "4.13.2"
7-
def mockitoVersion = "2.1.0"
8-
def testNgVersion = "6.11"
95
def jacocoVersion = "0.8.0"
10-
def leveldbVersion = "1.8"
116
def jansiVersion = "1.16"
127
// --------------------------------------
138

14-
static def isWindows() {
15-
return org.gradle.internal.os.OperatingSystem.current().isWindows()
16-
}
17-
18-
if (isWindows()) {
19-
ext {
20-
leveldbGroup = "org.ethereum"
21-
leveldbName = "leveldbjni-all"
22-
leveldbVersion = "1.18.3"
23-
}
24-
} else {
25-
ext {
26-
leveldbGroup = "org.fusesource.leveldbjni"
27-
leveldbName = "leveldbjni-all"
28-
leveldbVersion = "1.8"
29-
}
30-
}
31-
329
dependencies {
33-
testImplementation "junit:junit:$junitVersion"
34-
testImplementation "org.mockito:mockito-core:$mockitoVersion"
35-
36-
compile group: leveldbGroup, name: leveldbName, version: leveldbVersion
37-
compile "org.fusesource.jansi:jansi:$jansiVersion"
38-
compile group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10'
39-
compile group: 'com.typesafe', name: 'config', version: '1.3.2'
40-
compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
41-
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.5'
4210
compile project(":protocol")
4311
compile project(":common")
4412
compile project(":crypto")
13+
compile "org.fusesource.jansi:jansi:$jansiVersion"
14+
compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
4515
compile 'org.reflections:reflections:0.9.11'
4616
}
4717

chainbase/src/main/java/org/tron/core/capsule/BlockCapsule.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public class BlockCapsule implements ProtoCapsule<Block> {
5656

5757
private Block block;
5858
private List<TransactionCapsule> transactions = new ArrayList<>();
59-
private StringBuilder toStringBuff = new StringBuilder();
6059
private boolean isSwitch;
6160
@Getter
6261
@Setter
@@ -314,7 +313,7 @@ public boolean hasWitnessSignature() {
314313

315314
@Override
316315
public String toString() {
317-
toStringBuff.setLength(0);
316+
StringBuilder toStringBuff = new StringBuilder();
318317

319318
toStringBuff.append("BlockCapsule \n[ ");
320319
toStringBuff.append("hash=").append(getBlockId()).append("\n");

common/build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ sourceCompatibility = 1.8
88

99
// Dependency versions
1010
// ---------------------------------------
11-
1211
def leveldbVersion = "1.8"
1312
// --------------------------------------
1413

@@ -30,13 +29,7 @@ if (isWindows()) {
3029
}
3130
}
3231

33-
repositories {
34-
mavenCentral()
35-
}
36-
3732
dependencies {
38-
testCompile group: 'junit', name: 'junit', version: '4.13.2'
39-
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69'
4033
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.1'
4134
compile "com.cedarsoftware:java-util:1.8.0"
4235
compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.1'

0 commit comments

Comments
 (0)