Skip to content

Support Tron network - #278

Open
joeky888 wants to merge 20 commits into
howardwu:masterfrom
joeky888:tron
Open

joeky888 wants to merge 20 commits into
howardwu:masterfrom
joeky888:tron

Conversation

@joeky888

Copy link
Copy Markdown

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>

@howardwu howardwu left a comment

Copy link
Copy Markdown
Owner

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 thread wagyu/cli/tron.rs Outdated
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
Copy Markdown
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

Comment thread wagyu/lib.rs
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
Copy Markdown
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

Comment thread wagyu/main.rs Outdated
use wagyu::cli::ethereum::EthereumCLI;
use wagyu::cli::monero::MoneroCLI;
use wagyu::cli::zcash::ZcashCLI;
use wagyu::cli::tron::TronCLI;

Copy link
Copy Markdown
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

Comment thread wagyu/main.rs
EthereumCLI::new(),
MoneroCLI::new(),
ZcashCLI::new(),
TronCLI::new(),

Copy link
Copy Markdown
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

Comment thread wagyu/main.rs
("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
Copy Markdown
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

Comment thread tron/src/private_key.rs Outdated

/// 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
Copy Markdown
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

Comment thread 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
Copy Markdown
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

Comment thread Cargo.toml Outdated

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

Copy link
Copy Markdown
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

Comment thread Cargo.toml
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
Copy Markdown
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

Comment thread Cargo.toml Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
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

joeky888 commented Feb 4, 2022

Copy link
Copy Markdown
Author

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.

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

2 participants