Skip to content

Tron support#43

Merged
Har01d merged 17 commits intomainfrom
tron
Oct 27, 2023
Merged

Tron support#43
Har01d merged 17 commits intomainfrom
tron

Conversation

@alexqrid
Copy link
Collaborator

This PR adds full Tron support:

  • Tron main transactions, as well as dex transfers
  • Tron internal transactions
  • Tron TRC-10 transactions, as well as dex transfers
  • Tron TRC-20 transactions
  • Tron TRC-721 transactions
  • Tron TRC-1155 transactions

Pay attention that main module works correctly only with the following PR, as it fall backs to geth-like JSON-RPC for transaction types with undefined (in module code) processing rules, and as official node returns various currencies in value field of JSON-RPC, that PR must be applied to the node, that is used for the module.

I've also added some debug features: processing range of blocks, processing from the latest block down to genesis.

@alexqrid alexqrid self-assigned this Sep 14, 2023
@alexqrid alexqrid requested a review from Har01d as a code owner September 14, 2023 23:56

MODULES[]=tron-main
MODULE_tron-main_CLASS=TronMainModule
MODULE_tron-main_NODES[]=http://login:password@127.0.0.1:1234/
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Har01d please make sure that your nodes are behind proxy with the following rules:

  • / is proxied to node's /jsonrpc path
  • /wallet/ is proxied to node's /wallet/ path

Copy link
Collaborator

@jzethar jzethar Sep 15, 2023

Choose a reason for hiding this comment

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

If it is necessary to use different paths to API, perhaps, it is better to use different environmental variables:
MODULE_tron-main_JSONRPC[] = http://login:password@127.0.0.1:1234/jsonrpc/
MODULE_tron-main_WALLET[] = http://login:password@127.0.0.1:1234/wallet/
And use in code:

$tron_jsonrpc = envm($this->module, 'JSONRPC');
$info = requester_single($tron_jsonrpc,  params: ['jsonrpc' => '2.0', 'method' => 'eth_blockNumber', 'id' => 0], result_in: 'result', timeout: $this->timeout);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds reasonable, but @Har01d what do you think if I create additional class atribute in order to not duplicate $tron_jsonrpc = envm($this->module, 'JSONRPC'); in every invocation of jsonrpc endpoint?

Copy link
Collaborator

@Har01d Har01d left a comment

Choose a reason for hiding this comment

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

TRON has been running in production for a while (https://3xpl.com/tron) and the database has been fully synced.

@Har01d Har01d merged commit 21de323 into main Oct 27, 2023
@alexqrid
Copy link
Collaborator Author

@Har01d Forgot to add last fix for querying TRC10 info on early blocks see #57

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.

3 participants