Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Tron network #278

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Support Tron network #278

wants to merge 16 commits into from

Conversation

joeky888
Copy link

Started out quite a while ago, I think it's time for contributing.

With this PR wagyu can generate or import standard/HD trx/trc20 wallets. However, tron transaction isn't implemented yet.

joeky888 added 15 commits May 4, 2021 17:03
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Signed-off-by: Joeky <joeky5888@gmail.com>
Copy link
Owner

@howardwu howardwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change requests:

  1. Can you utilize the Ethereum types for Tron where they overlap? For example, one can define the TronAmount as EthereumAmount as follows:
pub type TronAmount = EthereumAmount;
  1. Can you confirm the mnemonics are different in Tron than Ethereum?

Since Tron is a shameless clone of Ethereum, I believe you can share many of the resources, structs, and methods provided from the Ethereum implementation here.

Comment on lines 844 to 852
// "chinese_simplified" => output::<TronMainnet, ChineseSimplified>(options),
// "chinese_traditional" => output::<TronMainnet, ChineseTraditional>(options),
// "english" => output::<TronMainnet, English>(options),
// "french" => output::<TronMainnet, French>(options),
// "italian" => output::<TronMainnet, Italian>(options),
// "japanese" => output::<TronMainnet, Japanese>(options),
// "korean" => output::<TronMainnet, Korean>(options),
// "spanish" => output::<TronMainnet, Spanish>(options),
// _ => output::<TronMainnet, English>(options),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Remove commented out code

@@ -9,6 +9,7 @@ pub extern crate wagyu_ethereum as ethereum;
pub extern crate wagyu_model as model;
pub extern crate wagyu_monero as monero;
pub extern crate wagyu_zcash as zcash;
pub extern crate wagyu_tron as tron;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order alphabetically

wagyu/main.rs Outdated
@@ -6,6 +6,7 @@ use wagyu::cli::bitcoin::BitcoinCLI;
use wagyu::cli::ethereum::EthereumCLI;
use wagyu::cli::monero::MoneroCLI;
use wagyu::cli::zcash::ZcashCLI;
use wagyu::cli::tron::TronCLI;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order alphabetically

@@ -27,6 +28,7 @@ fn main() -> Result<(), CLIError> {
EthereumCLI::new(),
MoneroCLI::new(),
ZcashCLI::new(),
TronCLI::new(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order alphabetically

@@ -36,6 +38,7 @@ fn main() -> Result<(), CLIError> {
("ethereum", Some(arguments)) => EthereumCLI::print(EthereumCLI::parse(arguments)?),
("monero", Some(arguments)) => MoneroCLI::print(MoneroCLI::parse(arguments)?),
("zcash", Some(arguments)) => ZcashCLI::print(ZcashCLI::parse(arguments)?),
("tron", Some(arguments)) => TronCLI::print(TronCLI::parse(arguments)?),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order alphabetically


/// Returns a randomly-generated Tron private key.
fn new<R: Rng>(rng: &mut R) -> Result<Self, PrivateKeyError> {
// let random: [u8; 32] = rng.gen();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Remove commented out code

README.md Outdated
- [3.1.2 Ethereum](#312-ethereum)
- [3.1.3 Monero](#313-monero)
- [3.1.4 Zcash](#314-zcash)
- [3.1.5 Tron](#315-tron)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order alphabetically

Cargo.toml Outdated
@@ -24,7 +24,7 @@ name = "wagyu"
path = "wagyu/main.rs"

[workspace]
members = [ "bitcoin", "ethereum", "model", "monero", "zcash" ]
members = [ "bitcoin", "ethereum", "model", "monero", "zcash", "tron" ]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order alphabetically

@@ -39,6 +39,7 @@ wagyu-ethereum = { path = "./ethereum", version = "0.6.3" }
wagyu-model = { path = "./model", version = "0.6.3" }
wagyu-monero = { path = "./monero", version = "0.6.3" }
wagyu-zcash = { path = "./zcash", version = "0.6.3" }
wagyu-tron = { path = "./tron", version = "0.6.3" }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please order alphabetically

Cargo.toml Outdated
@@ -57,9 +58,10 @@ serde_json = { version = "1.0" }
tiny-keccak = { version = "1.4" }

[profile.release]
opt-level = 3
opt-level = "z"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand the purpose of changing opt-level and codegen-units here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes reverted.

Signed-off-by: Joeky <joeky5888@gmail.com>
@joeky888
Copy link
Author

joeky888 commented Feb 4, 2022

pub type TronAmount = EthereumAmount;

As much as I understand your stand on DRY (don't repeat yourself). Here are some thoughts, I would like to keep them independent.

  1. Good for customizability on private blockchains.
  2. I personally maintained a customized build of wagyu.
  3. I don't use Ethereum, so in my case I would like to remove it from my custom build of wagyu.
  4. If someone really wants to share resources between these two, I will keep an open-mind on the official wagyu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants