Skip to content

opentron/opentron

Repository files navigation

OpenTron logo Chat on Telegram

OpenTron is an implementation of the Tron blockchain written in Rust. This project is under active development and is not ready for general use.

Rationale

  1. Decentralised

    The Tron network currently has one and only implementation. This has lead to some criticism of Tron being too centralized. We want to change that by providing an alternative implementation and independent development team.

  2. High performance

    API calls to java-tron nodes often results in CPU timeouts and other "out of resource" related errors. This is partly due to java-tron being written in Java, a garbage collected language that runs on a virtual machine. OpenTron is written in Rust, a modern compiled language that is increasingly adopted for blockchain and systems development due to its high performance, safety and modern design.

  3. Modern codebase

    Java-tron was forked a few years ago from a Java Ethereum implementation. It has accumulated a lot of technical debt over the years and has a lot of inconsistent or missing documentation. We believe that a greenfield implementation will enable us to produce a cleaner code base that is easier to understand, improve and extend. In addition, since Rust has first class support for WebAssembly, it will be possible to re-use its code for creating web based clients, wallets, explorers, etc.

Roadmap

  • Block data sync, only blocks (raw transactions), without transaction info and any other state data. Handle chain fork and block Merkle tree verification.
  • Simple transaction broadcast, without much verification, just broadcast transactions to the network as quickly as possible(an airdrop tool can be made from it)
  • Handle transaction verification. all state data will be available. (difficult, EVM engine, resource consumption mode, witness/vote/proposal, chain parameter are all handled at this stage, to make the state data identical as java-tron )
  • Build a query API layer upon state data. json-rpc.
  • Build a event API layer upon state data.
  • block mining logic (difficult, DPoS mining, need resource to become an SR)

TODOs

  • Full Tron Protocol implementation
    • proto2: refactor the protobuf
    • primitives
      • use primitive-types
      • keys: Address, PublicKey, PrivateKey, Signature
    • config file
      • genesis block parsing
      • toml config file parsing
      • reorganize chain parameters
    • chain-db
      • Block / Transaction
    • state-db
    • discover protocol
    • channel protocol
      • demo works
      • sync
      • TODO: minor bug fix, timeout error
      • integrate with state-db
    • mempool - block producing
    • governance
      • witness schedule
      • voting
      • proposal
      • block reward - still has minor bug
    • executor/actuator
      • account
      • trx/trc10 assets
      • witness and voting
      • proposal
      • resource freeze/unfreeze
      • exchange
      • smart contract
      • market (4.1)
    • EVM / TVM
      • 3.7 TVM https://github.com/opentron/evm and tvm crate
      • 4.0 TVM with zksnark: ztron crate
        • shielded trc20 transaction - ztron
        • integration
      • 4.1 TVM
        • CREATE2
      • massive tests against resource usage, exit_reason
    • RPC API replacement
      • will not support gRPC
      • might have json-rpc support
      • GraphQL API for chain query and state query
      • GraphQL API to broadcast transaction

Quickstart

See INSTALL.md for more detailed information.

> # Install rust-nightly
> curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly
> rustup component add rustfmt

> # Install protoc
> brew install protobuf  # macOS
> sudo pacman -S protobuf  # ArchLinux
> sudo apt install protobuf-compiler libprotobuf-dev # Ubuntu / Debian

> # Get code
> git clone https://github.com/opentron/opentron.git

> # Compile opentron
> cd ./opentron/
> cargo build

> cargo run -- --config etc/conf.nile.toml

Local Testnet

./target/release/opentron --config ./etc/conf.local-test.toml

Then open http://localhost:3000 and play with the GraphQL APIs.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

OpenTron is the first fully independent implementation of the Tron protocol, written in Rust.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages