Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b710476
Merge pull request #4 from tron-network/master
lucien-tronlab Dec 20, 2017
9084a18
feature: add consensus and test
Dec 21, 2017
ba22b9f
Merge pull request #5 from tron-network/feature/consensus
lucien-tronlab Dec 21, 2017
eccec12
Merge pull request #6 from tron-network/develop
lucien-tronlab Dec 21, 2017
f1ac84c
Merge pull request #7 from tron-network/feature/consensus
lucien-tronlab Dec 21, 2017
52723d2
add kafka config
572201193 Dec 24, 2017
342913d
Merge pull request #9 from 572201193/develop
lucien-tronlab Dec 24, 2017
63c8fb4
wallet
Dec 25, 2017
f05defe
Merge branch 'develop' into feature/wallet
Dec 25, 2017
c470cb6
db test
Dec 25, 2017
db8d376
modify kafka default host
sasaxie Dec 25, 2017
b9e5761
merage and fix consensus
conglinduye Dec 25, 2017
bb3c3f4
Merge remote-tracking branch 'upstream/master' into feature/contract
Dec 25, 2017
8266688
db test
Dec 25, 2017
643cc28
Merge remote-tracking branch 'origin/feature/consensus' into feature/…
Dec 25, 2017
bc8dc16
db test
Dec 25, 2017
b3a9d43
Merge pull request #15 from tron-network/feature/contract
mu1one Dec 25, 2017
c0a58bf
save utxo
Dec 26, 2017
c3c3298
remove consensus log directory
sasaxie Dec 26, 2017
157c479
Merge pull request #18 from tron-network/feature/contract
mu1one Dec 26, 2017
a08480c
modify kafka configuration
sasaxie Dec 26, 2017
a9bfe0e
add commit tips in README.md
lucien-tronlab Dec 26, 2017
4e76918
modify commit tips
lucien-tronlab Dec 26, 2017
4b4a387
add license logo
lucien-tronlab Dec 26, 2017
b6fb432
Update README.md
tronfoundation Dec 26, 2017
e0be2f6
Update README.md
tronfoundation Dec 26, 2017
5696283
Update README.md
tronfoundation Dec 26, 2017
f8eac7b
Update README.md
tronfoundation Dec 26, 2017
6e48e62
Update README.md
mu1one Dec 27, 2017
3035ab5
Update README.md
tronfoundation Dec 27, 2017
3d1c582
add issues tips
tronfoundation Dec 27, 2017
cfd8b93
modify license tips
tronfoundation Dec 27, 2017
4b73f12
add contributors tips
tronfoundation Dec 27, 2017
062b52d
docs(README.md): update style
tronfoundation Dec 27, 2017
30f272a
docs(README.md): update tron logo
tronfoundation Dec 27, 2017
64d9e24
style(README.md): update
tronfoundation Dec 27, 2017
eb624b4
fix(BlockchainIterator): judge error
sasaxie Dec 27, 2017
3c84e8b
docs(README.md): add commands
tronfoundation Dec 27, 2017
a099d7e
style(README.md): update
tronfoundation Dec 27, 2017
ece52fd
style(README.md): update
tronfoundation Dec 27, 2017
128c9c4
refactor: modify code
sasaxie Dec 27, 2017
9678dd7
docs(CONTRIBUTING.md): update link
sasaxie Dec 27, 2017
af167ac
refactor: add license
572201193 Dec 27, 2017
7a4f504
docs(README.md): update how to run project
tronfoundation Dec 28, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ gradlew.bat

# log
logs
consensus-logs

# lombok
out
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ for us. We will appreciate it.
### Create issues

Any significant improvement should be documented as [a GitHub
issue](https://github.com/tron-network/java-tron/issues) before anybody
issue](https://github.com/tronprotocol/java-tron/issues) before anybody
starts working on it.

Also when filing an issue, make sure to answer these three questions:
Expand Down
98 changes: 84 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# What’s TRON? [![Build Status](https://www.travis-ci.org/tron-network/java-tron.svg?branch=develop)](https://www.travis-ci.org/tron-network/java-tron)
<p align="center"><img width=27% src="https://github.com/tronprotocol/wiki/blob/master/images/tron.png"></p>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[![Build Status](https://travis-ci.org/tronprotocol/java-tron.svg?branch=feature%2Fconsensus)](https://travis-ci.org/tronprotocol/java-tron)
[![GitHub last commit](https://img.shields.io/github/last-commit/tronprotocol/java-tron.svg)](https://github.com/tronprotocol/java-tron/commits/develop)
[![GitHub issues](https://img.shields.io/github/issues/tronprotocol/java-tron.svg)](https://github.com/tronprotocol/java-tron/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/tronprotocol/java-tron.svg)](https://github.com/tronprotocol/java-tron/pulls)
[![GitHub contributors](https://img.shields.io/github/contributors/tronprotocol/java-tron.svg)](https://github.com/tronprotocol/java-tron/graphs/contributors)
[![license](https://img.shields.io/github/license/tronprotocol/java-tron.svg)](LICENSE)

# What's TRON?
TRON is a block chain-based decentralized smart protocol and an application development platform. It allows each user to freely publish, store and own contents and data, and in the decentralized autonomous form, decides an incentive mechanism and enables application developers and content creators through digital asset distribution, circulation and transaction, thus forming a decentralized content entertainment ecosystem.

TRON is a product of Web 4.0 and the decentralized internet of next generation.
Expand All @@ -9,29 +18,90 @@ TRON is a product of Web 4.0 and the decentralized internet of next generation.
**Download and build**

```shell
> git clone https://github.com/tron-network/java-tron.git
> git clone https://github.com/tronprotocol/java-tron.git
> cd java-tron
> gradle build
```

**Import project to IDEA**

1. [File] -> [New] -> [Project from Existing Sources...]
2. Select java-tron/build.gradle
3. Dialog [Import Project from Gradle], confirm [Use auto-import] and [Use gradle wrapper task configuration] have been
- [File] -> [New] -> [Project from Existing Sources...]
- Select java-tron/build.gradle
- Dialog [Import Project from Gradle], confirm [Use auto-import] and [Use gradle wrapper task configuration] have been
selected,then select Gradle JVM(JDK 1.8)and click [OK]

# Testing

- Install Kafka, create two topics (block and transaction)
- Adjust constant **DEFAULT_BOOTSTRAP_SERVERS** in ConsumerProperty.java file and ProducerProperty.java file to your Kafka's host(like:192.168.1.199:9092)
- IDEA: [Edit Configurations...] -> [Program arguments]: **--type server**
- Run Tron (server)
- IDEA: [Edit Configurations...] -> [Program arguments]: **--type normal**
- Run Tron (client)
- Execute `help` command on the client
**Install Kafka and create two topics (block and transaction)**

**Update the configuration**

File path: `<your workspace>/java-tron/src/main/resources/tron.conf`

```yml
kafka {
host = "127.0.0.1" # your Kafka's host
port = ":9092" # your Kafka's port
}
```

**Starting program**

IDEA:
- [Edit Configurations...] -> [Program arguments]: `--type server`
- Run

![run](https://github.com/tronprotocol/wiki/blob/master/images/show-how/run.gif)

# Commands
**help**

| Description | Example |
| --- | --- |
| Help tips | `help` |

![help](https://github.com/tronprotocol/wiki/blob/master/images/commands/help.gif)

**account**

| Description | Example |
| --- | --- |
| Get address | `account` |

![help](https://github.com/tronprotocol/wiki/blob/master/images/commands/account.gif)

**getbalance**

| Description | Example |
| --- | --- |
| Get balance | `getbalance` |

![help](https://github.com/tronprotocol/wiki/blob/master/images/commands/getbalance.gif)

**send [to] [balance]**

| Description | Example |
| --- | --- |
| Send balance to address | `send 2cddf5707aefefb199cb16430fb0f6220d460dfe 2` |

![help](https://github.com/tronprotocol/wiki/blob/master/images/commands/send.gif)

**printblockchain**

| Description | Example |
| --- | --- |
| Print blockchain | `printblockchain` |

![help](https://github.com/tronprotocol/wiki/blob/master/images/commands/printblockchain.gif)

**exit**

| Description | Example |
| --- | --- |
| Exit | `exit` |

# License
![help](https://github.com/tronprotocol/wiki/blob/master/images/commands/exit.gif)

java-tron is released under the [LGPL-V3 license](LICENSE).
# Contribution
Contributions are welcomed and greatly appreciated. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on submitting patches and the contribution workflow.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dependencies {
compile group: 'io.atomix.copycat', name: 'copycat-server', version: '1.1.4'
compile group: 'io.atomix.copycat', name: 'copycat-client', version: '1.1.4'
compile group: 'io.atomix.catalyst', name: 'catalyst-netty', version: '1.1.1'
compile group: 'net.jcip', name: 'jcip-annotations', version: '1.0'
}

tasks.matching { it instanceof Test }.all {
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/tron/command/AccountCommand.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.peer.Peer;
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/tron/command/Cli.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.peer.Peer;
Expand Down Expand Up @@ -42,6 +56,16 @@ public void run(Peer peer) {
case "printblockchain":
new PrintBlockchainCommand().execute(peer, cmdParameters);
break;

case "consensus":
new ConsensusCommand().server();
break;
case "getmessage":
new ConsensusCommand().getClient(cmdParameters);
break;
case "putmessage":
new ConsensusCommand().putClient(cmdParameters);
break;
case "help":
default:
new HelpCommand().execute(peer, cmdParameters);
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/tron/command/Command.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.peer.Peer;
Expand Down
58 changes: 58 additions & 0 deletions src/main/java/org/tron/command/ConsensusCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.consensus.client.Client;
import org.tron.consensus.server.Server;

public class ConsensusCommand {

public ConsensusCommand() {

}

public void server() {
Server.serverRun();
}

public void putClient(String[] args) {
Client.putMessage(args);
}

public void getClient(String[] args) {
Client.getMessage(args[0]);
}

public void usage() {
System.out.println("");
System.out.println("consensus server");
System.out.println("Command: consensus");
System.out.println("Description: Create a server.");
System.out.println("");

System.out.println("");
System.out.println("get Message");
System.out.println("Command: getmessage [key]");
System.out.println("Description: Get consensus Message");
System.out.println("");

System.out.println("");
System.out.println("put Message");
System.out.println("Command: putmessage [key] [value]");
System.out.println("Description: Put a consensus Message");
System.out.println("");
}

}
14 changes: 14 additions & 0 deletions src/main/java/org/tron/command/ExitCommand.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.peer.Peer;
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/tron/command/GetBalanceCommand.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.peer.Peer;
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/tron/command/HelpCommand.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.peer.Peer;
Expand All @@ -13,6 +27,7 @@ public void execute(Peer peer, String[] parameters) {
new GetBalanceCommand().usage();
new AccountCommand().usage();
new PrintBlockchainCommand().usage();
new ConsensusCommand().usage();
}

@Override
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/tron/command/PrintBlockchainCommand.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* java-tron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* java-tron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.tron.command;

import org.tron.core.BlockUtils;
Expand Down
Loading