Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
aa682c9
feat(net):P2P message rate limit
jwrct May 6, 2025
e50e11f
feat(net):test for P2P message rate limit
jwrct May 15, 2025
cb4acdc
add eth_getBlockReceipts
0xbigapple May 15, 2025
3e95e9e
improve getBlockReceipts
0xbigapple May 16, 2025
41ce13a
fix checkStyle
0xbigapple May 26, 2025
618b352
feat(net):fix for ambiguous reason code in disconnect messages
jwrct May 26, 2025
897ffed
feat(api): improve getBlockReceipts performance
0xbigapple Jun 18, 2025
436ab69
optimize the log for configuration without Blackhole account
zeusoo001 Jun 20, 2025
70c5cdf
feat(api): add TransactionReceiptFactory.java and optimize code
0xbigapple Jun 20, 2025
b357630
feat(api): remove Deprecated TransactionReceipt constructor function
0xbigapple Jun 20, 2025
b8702a5
solve sonar problem
zeusoo001 Jun 24, 2025
5304d55
feat(net): add volatile modifier to peer attribute variables
zeusoo001 Jun 24, 2025
8998701
feat(api): del TransactionReceiptFactory.java and add new Transaction…
0xbigapple Jun 26, 2025
23543e6
update readme for telegram groups and doc link
vivian1912 Jun 27, 2025
af61a0d
feat(api): rename api params, add some comments for energyFee
0xbigapple Jun 30, 2025
5910b51
feat(doc): update expired information for readme
halibobo1205 Jun 4, 2025
15e8c0e
Merge pull request #6340 from halibobo1205/doc/read_me
kuny0707 Jun 30, 2025
488284e
feat(api): add comment
0xbigapple Jul 2, 2025
b0cf0d4
feat(net): optimize the log of synchronization failure
zeusoo001 Jul 3, 2025
017207e
feat(net): adjust the order of field assignment to solve concurrency …
zeusoo001 Jul 3, 2025
e64fc1f
feat(style): assign default values at field declaration in Transactio…
0xbigapple Jul 3, 2025
c2adb7d
fix(net):fix P2P message rate limit issue
jwrct Jul 8, 2025
3b3ddac
fix(net):delete unused import
jwrct Jul 8, 2025
5c8f032
fix(CheckStyle): only fix CheckStyle
bladehan1 Jul 8, 2025
2454a92
feat(net):optimize rate limit logic
jwrct Jul 8, 2025
07dec0d
Merge pull request #6392 from bladehan1/fix/only_checkstyle
kuny0707 Jul 8, 2025
9eef349
fix(CheckStyle): Remove an empty statement
bladehan1 Jul 8, 2025
5286e78
Merge remote-tracking branch 'origin/release_v4.8.1' into feature/add…
0xbigapple Jul 10, 2025
d7715c7
resolve code conflicts
zeusoo001 Jul 10, 2025
bae51b0
Merge branch 'release_v4.8.1' of github.com:tronprotocol/java-tron in…
zeusoo001 Jul 11, 2025
f85de4a
Merge branch 'release_v4.8.1' of github.com:tronprotocol/java-tron in…
zeusoo001 Jul 11, 2025
81c6528
feat(net):Optimize rate limiting logic and add tests
jwrct Jul 11, 2025
44dcce3
feat(dependencies): update dependencies
halibobo1205 Jul 3, 2025
e9403b0
feat(approving): convert the approving window configuration to chain …
lxcmyf Jul 7, 2025
399d159
Merge remote-tracking branch 'upstream/release_v4.8.1' into feature/v…
lxcmyf Jul 14, 2025
3f280c9
Merge pull request #6364 from vivian1912/doc-update-readme
kuny0707 Jul 16, 2025
26d5fe4
feat(net): add configuration for p2p message rate limit
jwrct Jul 22, 2025
12e2faf
feat(config): sync config with tron-deployment
halibobo1205 May 22, 2025
46b1c09
fix(log): fix log issue
jwrct Aug 5, 2025
e3f9b52
feat(conf): make compatible with old configurations
lxcmyf Aug 1, 2025
f8bd7cf
refactor(crypto,api): improve code quality
halibobo1205 Aug 6, 2025
ff2a507
Merge remote-tracking branch 'upstream/release_v4.8.1' into feature/v…
lxcmyf Aug 7, 2025
7e26460
Merge pull request #6400 from halibobo1205/481/update_dependencies
kuny0707 Aug 7, 2025
23a3f42
Merge pull request #6332 from halibobo1205/feat/update_config
kuny0707 Aug 7, 2025
5a487dc
Merge pull request #6381 from zeusoo001/sync-problem
kuny0707 Aug 7, 2025
5b2bb67
Merge pull request #6360 from zeusoo001/volatile-modifier
kuny0707 Aug 7, 2025
b730030
Merge pull request #6356 from zeusoo001/blackhole-log-opt
kuny0707 Aug 7, 2025
2c06f4f
Merge pull request #6417 from halibobo1205/fix/code-scanning
kuny0707 Aug 11, 2025
ae6222c
Merge pull request #6399 from lxcmyf/feature/voting_window_period
kuny0707 Aug 12, 2025
21f98b4
feat(db): merge related tools into FullNode/Toolkit
halibobo1205 Jun 30, 2025
6c29cb2
Merge pull request #6394 from jwrct/fix_reason_code
kuny0707 Aug 13, 2025
c1f3956
Merge pull request #6393 from fyyhtx/rate_limit
kuny0707 Aug 13, 2025
9247853
Merge pull request #6397 from halibobo1205/feat/command_opt
kuny0707 Aug 13, 2025
50d6f69
feat(architecture): support arm64 based on JDK17 (#6327)
halibobo1205 Aug 14, 2025
d2d49bb
feat(crypto): optimize zksnark config (#6371)
Federico2014 Aug 14, 2025
6a75d50
feat(section-bloom): write section-bloom and block.bloom (#6372)
bladehan1 Aug 14, 2025
e7394ec
Merge remote-tracking branch 'origin/release_v4.8.1' into feature/add…
0xbigapple Aug 15, 2025
c7f133d
feat(jsonrpc): jsonrpc set error resolver (#6369)
0xbigapple Aug 15, 2025
2dcdb45
feat(jsonrpc): optimize event log query (#6370)
0xbigapple Aug 15, 2025
456b4eb
fix(net): optimize disconnect reason for light node (#6375)
317787106 Aug 18, 2025
cf3e3b9
Merge remote-tracking branch 'origin/release_v4.8.1' into feature/add…
0xbigapple Aug 18, 2025
8a08f37
Resolve merge conflict
0xbigapple Aug 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 68 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@

<p align="center">
<a href="https://gitter.im/tronprotocol/allcoredev">
<img src="https://camo.githubusercontent.com/da2edb525cde1455a622c58c0effc3a90b9a181c/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667">
</a>

<a href="https://travis-ci.org/tronprotocol/java-tron">
<img src="https://travis-ci.org/tronprotocol/java-tron.svg?branch=develop">
<img src="https://img.shields.io/gitter/room/tronprotocol/java-tron.svg">
</a>

<a href="https://codecov.io/gh/tronprotocol/java-tron">
Expand Down Expand Up @@ -63,8 +59,20 @@ TRON enables large-scale development and engagement. With over 2000 transactions

# Building the Source Code

Building java-tron requires `git` package 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.
Building java-tron requires `git` package

## Operating systems
Make sure you operate on `Linux` or `MacOS` operating systems, other operating systems are not supported yet.

## Architecture

### x86_64
64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet.

### ARM64
64-bit version of `JDK 17` to be installed, other JDK versions are not supported yet.

### build
Clone the repo and switch to the `master` branch

```bash
Expand All @@ -81,8 +89,19 @@ $ ./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.
## Operating systems
Make sure you operate on `Linux` or `MacOS` operating systems, other operating systems are not supported yet.

## Architecture

### X86_64
Requires 64-bit version of `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet.

### ARM64
Requires 64-bit version of `JDK 17` to be installed, other JDK versions are not supported yet.


## Configuration flile
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
Expand All @@ -104,6 +123,7 @@ Recommended:

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:

### x86_64 JDK 1.8
```bash
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
Expand All @@ -115,6 +135,19 @@ $ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
```
### ARM64 JDK 17
```bash
$ nohup java -Xms9G -Xmx9G -XX:+UseZGC \
-Xlog:gc*:file=gc.log:time,uptime,level,tags:filecount=50,filesize=100M \
-XX:ReservedCodeCacheSize=256m \
-XX:+UseCodeCacheFlushing \
-XX:MetaspaceSize=256m \
-XX:MaxMetaspaceSize=512m \
-XX:MaxDirectMemorySize=1g \
-XX:+HeapDumpOnOutOfMemoryError \
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
```


## Running a super representative node for mainnet

Expand All @@ -130,6 +163,7 @@ Fill in the private key of a super representative address into the `localwitness

then run the following command to start the node:

### x86_64 JDK 1.8
```bash
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
Expand All @@ -141,9 +175,22 @@ $ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
```
### ARM64 JDK 17
```bash
$ nohup java -Xms9G -Xmx9G -XX:+UseZGC \
-Xlog:gc*:file=gc.log:time,uptime,level,tags:filecount=50,filesize=100M \
-XX:ReservedCodeCacheSize=256m \
-XX:+UseCodeCacheFlushing \
-XX:MetaspaceSize=256m \
-XX:MaxMetaspaceSize=512m \
-XX:MaxDirectMemorySize=1g \
-XX:+HeapDumpOnOutOfMemoryError \
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
```

## Quick Start Tool

### x86_64 JDK 1.8
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
Expand All @@ -154,6 +201,18 @@ Here are some common use cases of the scripting tool

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

### ARM64 JDK 17
You can refer to the [start.sh.simple](start.sh.simple).

```bash
# cp start.sh.simple start.sh
# Usage:
# sh start.sh # Start the java-tron FullNode
# sh start.sh -s # Stop the java-tron FullNode
# sh start.sh [options] # Start with additional java-tron options,such as: -c config.conf -d /path_to_data, etc.
#
```

## Run inside Docker container

One of the quickest ways to get `java-tron` up and running on your machine is by using Docker:
Expand All @@ -173,7 +232,7 @@ This will mount the `output-directory` and `logs` directories on the host, the d

[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.
The [Core Devs Community](https://t.me/troncoredevscommunity) and [Tron Official Developer Group](https://t.me/TronOfficialDevelopersGroupEn) are Telegram channels specifically designed for java-tron community developers to engage in technical discussions.

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

Expand All @@ -184,7 +243,7 @@ Thank you for considering to help out with the source code! If you'd like to con
# 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.
- [Documentation](https://tronprotocol.github.io/documentation-en/) and [TRON Developer Hub](https://developers.tron.network/) serve as java-tron’s primary documentation websites.
- [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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Map;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.tron.common.parameter.CommonParameter;
import org.tron.common.utils.DecodeUtil;
import org.tron.common.utils.StringUtil;
import org.tron.core.capsule.ProposalCapsule;
Expand Down Expand Up @@ -53,7 +52,7 @@ public boolean execute(Object result) throws ContractExeException {

long currentMaintenanceTime =
chainBaseManager.getDynamicPropertiesStore().getNextMaintenanceTime();
long now3 = now + CommonParameter.getInstance().getProposalExpireTime();
long now3 = now + chainBaseManager.getDynamicPropertiesStore().getProposalExpireTime();
long round = (now3 - currentMaintenanceTime) / maintenanceTimeInterval;
long expirationTime =
currentMaintenanceTime + (round + 1) * maintenanceTimeInterval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,28 +170,27 @@ private void executeShielded(List<SpendDescription> spends, List<ReceiveDescript
}
nullifierStore.put(new BytesCapsule(spend.getNullifier().toByteArray()));
}
if (CommonParameter.getInstance().isFullNodeAllowShieldedTransactionArgs()) {
IncrementalMerkleTreeContainer currentMerkle = merkleContainer.getCurrentMerkle();

IncrementalMerkleTreeContainer currentMerkle = merkleContainer.getCurrentMerkle();
try {
currentMerkle.wfcheck();
} catch (ZksnarkException e) {
ret.setStatus(fee, code.FAILED);
ret.setShieldedTransactionFee(fee);
throw new ContractExeException(e.getMessage());
}
//handle receives
for (ReceiveDescription receive : receives) {
try {
currentMerkle.wfcheck();
merkleContainer
.saveCmIntoMerkleTree(currentMerkle, receive.getNoteCommitment().toByteArray());
} catch (ZksnarkException e) {
ret.setStatus(fee, code.FAILED);
ret.setStatus(0, code.FAILED);
ret.setShieldedTransactionFee(fee);
throw new ContractExeException(e.getMessage());
}
//handle receives
for (ReceiveDescription receive : receives) {
try {
merkleContainer
.saveCmIntoMerkleTree(currentMerkle, receive.getNoteCommitment().toByteArray());
} catch (ZksnarkException e) {
ret.setStatus(0, code.FAILED);
ret.setShieldedTransactionFee(fee);
throw new ContractExeException(e.getMessage());
}
}
merkleContainer.setCurrentMerkle(currentMerkle);
}
merkleContainer.setCurrentMerkle(currentMerkle);
}

@Override
Expand Down Expand Up @@ -236,8 +235,7 @@ public boolean validate() throws ContractValidateException {
throw new ContractValidateException("duplicate sapling nullifiers in this transaction");
}
nfSet.add(spendDescription.getNullifier());
if (CommonParameter.getInstance().isFullNodeAllowShieldedTransactionArgs()
&& !merkleContainer.merkleRootExist(spendDescription.getAnchor().toByteArray())) {
if (!merkleContainer.merkleRootExist(spendDescription.getAnchor().toByteArray())) {
throw new ContractValidateException("Rt is invalid.");
}
if (nullifierStore.has(spendDescription.getNullifier().toByteArray())) {
Expand Down
19 changes: 18 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 @@ -4,6 +4,8 @@
import static org.tron.core.Constant.CREATE_ACCOUNT_TRANSACTION_MIN_BYTE_SIZE;
import static org.tron.core.Constant.DYNAMIC_ENERGY_INCREASE_FACTOR_RANGE;
import static org.tron.core.Constant.DYNAMIC_ENERGY_MAX_FACTOR_RANGE;
import static org.tron.core.Constant.MAX_PROPOSAL_EXPIRE_TIME;
import static org.tron.core.Constant.MIN_PROPOSAL_EXPIRE_TIME;
import static org.tron.core.config.Parameter.ChainConstant.ONE_YEAR_BLOCK_NUMBERS;

import org.tron.common.utils.ForkController;
Expand Down Expand Up @@ -839,6 +841,20 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore,
}
break;
}
case PROPOSAL_EXPIRE_TIME: {
if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_8_1)) {
throw new ContractValidateException(
"Bad chain parameter id [PROPOSAL_EXPIRE_TIME]");
}
if (value <= MIN_PROPOSAL_EXPIRE_TIME
|| value >= MAX_PROPOSAL_EXPIRE_TIME) {
throw new ContractValidateException(
"This value[PROPOSAL_EXPIRE_TIME] is only allowed to be greater than "
+ MIN_PROPOSAL_EXPIRE_TIME + " and less than "
+ MAX_PROPOSAL_EXPIRE_TIME + "!");
}
break;
}
default:
break;
}
Expand Down Expand Up @@ -921,7 +937,8 @@ public enum ProposalType { // current value, value range
ALLOW_TVM_CANCUN(83), // 0, 1
ALLOW_STRICT_MATH(87), // 0, 1
CONSENSUS_LOGIC_OPTIMIZATION(88), // 0, 1
ALLOW_TVM_BLOB(89); // 0, 1
ALLOW_TVM_BLOB(89), // 0, 1
PROPOSAL_EXPIRE_TIME(92); // (0, 31536003000)

private long code;

Expand Down
14 changes: 3 additions & 11 deletions actuator/src/main/java/org/tron/core/vm/PrecompiledContracts.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.commons.lang3.tuple.Triple;
import org.tron.common.crypto.Blake2bfMessageDigest;
import org.tron.common.crypto.Hash;
import org.tron.common.crypto.Rsv;
import org.tron.common.crypto.SignUtils;
import org.tron.common.crypto.SignatureInterface;
import org.tron.common.crypto.zksnark.BN128;
Expand Down Expand Up @@ -352,22 +353,13 @@ private static byte[] encodeMultiRes(byte[]... words) {
}

private static byte[] recoverAddrBySign(byte[] sign, byte[] hash) {
byte v;
byte[] r;
byte[] s;
byte[] out = null;
if (ArrayUtils.isEmpty(sign) || sign.length < 65) {
return new byte[0];
}
try {
r = Arrays.copyOfRange(sign, 0, 32);
s = Arrays.copyOfRange(sign, 32, 64);
v = sign[64];
if (v < 27) {
v += 27;
}

SignatureInterface signature = SignUtils.fromComponents(r, s, v,
Rsv rsv = Rsv.fromSignature(sign);
SignatureInterface signature = SignUtils.fromComponents(rsv.getR(), rsv.getS(), rsv.getV(),
CommonParameter.getInstance().isECKeyCryptoEngine());
if (signature.validateComponents()) {
out = SignUtils.signatureToAddress(hash, signature,
Expand Down
5 changes: 4 additions & 1 deletion actuator/src/main/java/org/tron/core/vm/VM.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ public static void play(Program program, JumpTable jumpTable) {
} catch (JVMStackOverFlowException | OutOfTimeException e) {
throw e;
} catch (RuntimeException e) {
if (StringUtils.isEmpty(e.getMessage())) {
// https://openjdk.org/jeps/358
// https://bugs.openjdk.org/browse/JDK-8220715
// since jdk 14, the NullPointerExceptions message is not empty
if (e instanceof NullPointerException || StringUtils.isEmpty(e.getMessage())) {
logger.warn("Unknown Exception occurred, tx id: {}",
Hex.toHexString(program.getRootTransactionId()), e);
program.setRuntimeFailure(new RuntimeException("Unknown Exception"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return new Integer(Boolean.valueOf(byTestingSuite).hashCode()
return Boolean.valueOf(byTestingSuite).hashCode()
+ Boolean.valueOf(byTransaction).hashCode()
+ address.hashCode()
+ balance.hashCode()
Expand All @@ -326,8 +326,7 @@ public int hashCode() {
+ origin.hashCode()
+ prevHash.hashCode()
+ deposit.hashCode()
+ timestamp.hashCode()
).hashCode();
+ timestamp.hashCode();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public boolean equals(Object obj) {

@Override
public int hashCode() {
return new Integer(type).hashCode();
return type;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public boolean equals(Object obj) {

@Override
public int hashCode() {
return new Integer(type.hashCode() + Objects.hashCode(value)).hashCode();
return type.hashCode() + Objects.hashCode(value);
}
}
Loading