Skip to content

Commit

Permalink
Merge pull request #5765 from tronprotocol/release_v4.7.4
Browse files Browse the repository at this point in the history
merge release v4.7.4 to master
  • Loading branch information
halibobo1205 committed Mar 15, 2024
2 parents 7a6a6d8 + ca48980 commit e84a9e7
Show file tree
Hide file tree
Showing 157 changed files with 4,183 additions and 2,163 deletions.
141 changes: 81 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Java implementation of the <a href="https://tron.network">Tron Protocol</a>
</h4>


<p align="center">
<a href="https://gitter.im/tronprotocol/allcoredev">
<img src="https://camo.githubusercontent.com/da2edb525cde1455a622c58c0effc3a90b9a181c/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667">
Expand Down Expand Up @@ -42,6 +41,7 @@
</p>

## Table of Contents

- [What’s TRON?](#whats-tron)
- [Building the Source Code](#building-the-source)
- [Running java-tron](#running-java-tron)
Expand All @@ -55,94 +55,109 @@

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

* 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.
- 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.

* 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.
- 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.

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.

# Building the source

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.

Clone the repo and switch to the `master` branch

```bash
$ git clone https://github.com/tronprotocol/java-tron.git
$ cd java-tron
$ git checkout -t origin/master
```
```bash
$ git clone https://github.com/tronprotocol/java-tron.git
$ cd java-tron
$ git checkout -t origin/master
```

then run the following command to build java-tron, the `FullNode.jar` file can be found in `java-tron/build/libs/` after build successful.

```bash
$ ./gradlew clean build -x test
```


# Running java-tron

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.

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).
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).

## Hardware Requirements

Minimum:
* CPU with 8 cores
* 16GB RAM
* 2TB free storage space to sync the Mainnet

- CPU with 8 cores
- 16GB RAM
- 2TB free storage space to sync the Mainnet

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

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

## Running a full node for mainnet
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:
```bash
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
-XX:+PrintGCDateStamps -Xloggc:gc.log \
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
```

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:

```bash
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
-XX:+PrintGCDateStamps -Xloggc:gc.log \
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
```

## Running a super representative node for mainnet
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.

Fill in the private key of super representative address into the `localwitness` list in the `main_net_config.conf`, here is an example:
```
localwitness = [
650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812
]
```
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.

Fill in the private key of super representative address into the `localwitness` list in the `main_net_config.conf`. Here is an example:

```
localwitness = [
<your_private_key>
]
```

then run the following command to start the node:
```bash
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
-XX:+PrintGCDateStamps -Xloggc:gc.log \
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
```

```bash
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
-XX:+PrintGCDateStamps -Xloggc:gc.log \
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
```

## Quick Start Tool
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.

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.

Here are some common use cases of the scripting tool
* Use `start.sh` to start a full node with the downloaded `FullNode.jar`
* Use `start.sh` to download the latest `FullNode.jar` and start a full node.
* Use `start.sh` to download the latest source code and compile a `FullNode.jar` and then start a full node.

- Use `start.sh` to start a full node with the downloaded `FullNode.jar`
- Use `start.sh` to download the latest `FullNode.jar` and start a full node.
- Use `start.sh` to download the latest source code and compile a `FullNode.jar` and then start a full node.

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

## Run inside Docker container

One of the quickest ways to get `java-tron` up and running on your machine is by using Docker:

```shell
$ docker run -d --name="java-tron" \
-v /your_path/output-directory:/java-tron/output-directory \
Expand All @@ -155,29 +170,35 @@ $ docker run -d --name="java-tron" \
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).

# Community

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

[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.

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

# Contribution
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.

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.

# Resources
* [Medium](https://medium.com/@coredevs) java-tron's official technical articles are published there.
* [Documentation](https://tronprotocol.github.io/documentation-en/introduction/) java-tron's official technical documentation website.
* [Test network](http://nileex.io/) A stable test network of TRON contributed by TRON community.
* [Tronscan](https://tronscan.org/#/) TRON network blockchain browser.
* [Wallet-cli](https://github.com/tronprotocol/wallet-cli) TRON network wallet using command line.
* [TIP](https://github.com/tronprotocol/tips) TRON Improvement Proposal (TIP) describes standards for the TRON network.
* [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.

- [Medium](https://medium.com/@coredevs) java-tron's official technical articles are published there.
- [Documentation](https://tronprotocol.github.io/documentation-en/introduction/) java-tron's official technical documentation website.
- [Test network](http://nileex.io/) A stable test network of TRON contributed by TRON community.
- [Tronscan](https://tronscan.org/#/) TRON network blockchain browser.
- [Wallet-cli](https://github.com/tronprotocol/wallet-cli) TRON network wallet using command line.
- [TIP](https://github.com/tronprotocol/tips) TRON Improvement Proposal (TIP) describes standards for the TRON network.
- [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.

# Integrity Check
* After January 3, 2023, releases are signed the gpg key:

- 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:
```
pub: 1254 F859 D2B1 BD9F 66E7 107D F859 BCB4 4A28 290B
uid: build@tron.network
```

# License

java-tron is released under the [LGPLv3 license](https://github.com/tronprotocol/java-tron/blob/master/LICENSE).
16 changes: 8 additions & 8 deletions Tron protobuf protocol document.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,11 @@ Transaction and transaction-related messages.

message `raw`

`ref_block_bytes`: Deprecated.
`ref_block_bytes`: intercepted part of the now block bytes in transaction head.

`ref_block_num`: now block number in transaction head.
`ref_block_num`: Deprecated.

`ref_block_hash`: now block hash in transaction head.
`ref_block_hash`:intercepted part of the now block hash in transaction head..

`expiration`: the expiration time in transaction head.

Expand All @@ -565,15 +565,15 @@ Transaction and transaction-related messages.
```java
message raw {
bytes ref_block_bytes = 1;
int64 ref_block_num = 3;
int64 ref_block_num = 3;
bytes ref_block_hash = 4;
int64 expiration = 8;
int64 expiration = 8;
repeated authority auths = 9;
bytes data = 10;
bytes data = 10;
repeated Contract contract = 11;
bytes scripts = 12;
bytes scripts = 12;
int64 timestamp = 14;
int64 fee_limit = 18;
int64 fee_limit = 18;
}
```

Expand Down
16 changes: 0 additions & 16 deletions actuator/build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
description = "actuator – a series of transactions for blockchain."

// Dependency versions
// ---------------------------------------

def junitVersion = "4.13.2"
def mockitoVersion = "2.1.0"
def testNgVersion = "6.11"
def slf4jVersion = "1.7.25"
// --------------------------------------

dependencies {
compile project(":chainbase")
compile project(":protocol")
compile project(":crypto")
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"

compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69'
compile group: 'commons-codec', name: 'commons-codec', version: '1.11'
compile 'org.reflections:reflections:0.9.11'
}

test {
Expand Down
23 changes: 22 additions & 1 deletion actuator/src/main/java/org/tron/core/utils/ProposalUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,26 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore,
}
break;
}
case ALLOW_OLD_REWARD_OPT: {
if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_7_4)) {
throw new ContractValidateException(
"Bad chain parameter id [ALLOW_OLD_REWARD_OPT]");
}
if (dynamicPropertiesStore.allowOldRewardOpt()) {
throw new ContractValidateException(
"[ALLOW_OLD_REWARD_OPT] has been valid, no need to propose again");
}
if (value != 1) {
throw new ContractValidateException(
"This value[ALLOW_OLD_REWARD_OPT] is only allowed to be 1");
}
if (!dynamicPropertiesStore.useNewRewardAlgorithm()) {
throw new ContractValidateException(
"[ALLOW_NEW_REWARD] or [ALLOW_TVM_VOTE] proposal must be approved "
+ "before [ALLOW_OLD_REWARD_OPT] can be proposed");
}
break;
}
default:
break;
}
Expand Down Expand Up @@ -803,7 +823,8 @@ public enum ProposalType { // current value, value range
DYNAMIC_ENERGY_MAX_FACTOR(75), // 0, [0, 100_000]
ALLOW_TVM_SHANGHAI(76), // 0, 1
ALLOW_CANCEL_ALL_UNFREEZE_V2(77), // 0, 1
MAX_DELEGATE_LOCK_PERIOD(78); // (86400, 10512000]
MAX_DELEGATE_LOCK_PERIOD(78), // (86400, 10512000]
ALLOW_OLD_REWARD_OPT(79); // 0, 1

private long code;

Expand Down
13 changes: 8 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ subprojects {
dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
compile "org.slf4j:jcl-over-slf4j:1.7.25"
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.9'
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
compile group: 'com.google.guava', name: 'guava', version: '30.1-jre'
compile "com.google.code.findbugs:jsr305:3.0.0"
compile group: 'org.springframework', name: 'spring-context', version: '5.3.18'
Expand All @@ -52,7 +47,15 @@ subprojects {
compile group: 'org.apache.commons', name: 'commons-math', version: '2.2'
compile "org.apache.commons:commons-collections4:4.1"
compile group: 'joda-time', name: 'joda-time', version: '2.3'
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69'

compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'

testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation "org.mockito:mockito-core:2.13.0"
}

task sourcesJar(type: Jar, dependsOn: classes) {
Expand Down
34 changes: 2 additions & 32 deletions chainbase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,16 @@ description = "chainbase – a decentralized database for blockchain."

// Dependency versions
// ---------------------------------------

def junitVersion = "4.13.2"
def mockitoVersion = "2.1.0"
def testNgVersion = "6.11"
def jacocoVersion = "0.8.0"
def leveldbVersion = "1.8"
def jansiVersion = "1.16"
// --------------------------------------

static def isWindows() {
return org.gradle.internal.os.OperatingSystem.current().isWindows()
}

if (isWindows()) {
ext {
leveldbGroup = "org.ethereum"
leveldbName = "leveldbjni-all"
leveldbVersion = "1.18.3"
}
} else {
ext {
leveldbGroup = "org.fusesource.leveldbjni"
leveldbName = "leveldbjni-all"
leveldbVersion = "1.8"
}
}

dependencies {
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"

compile group: leveldbGroup, name: leveldbName, version: leveldbVersion
compile "org.fusesource.jansi:jansi:$jansiVersion"
compile group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10'
compile group: 'com.typesafe', name: 'config', version: '1.3.2'
compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.5'
compile project(":protocol")
compile project(":common")
compile project(":crypto")
compile "org.fusesource.jansi:jansi:$jansiVersion"
compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
compile 'org.reflections:reflections:0.9.11'
}

Expand Down

0 comments on commit e84a9e7

Please sign in to comment.