Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
82 changes: 82 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,72 @@ MODULE_ton-main_NODES[]=http://login:password@127.0.0.2:1234/
MODULE_ton-main_REQUESTER_TIMEOUT=60
MODULE_ton-main_REQUESTER_THREADS=12

#######################
## Main TRON Module
#######################

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?

MODULE_tron-main_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-main_REQUESTER_TIMEOUT=60
MODULE_tron-main_REQUESTER_THREADS=2

#######################
## Internal TRON Module
#######################

MODULES[]=tron-internal
MODULE_tron-internal_CLASS=TronInternalModule
MODULE_tron-internal_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-internal_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-internal_REQUESTER_TIMEOUT=60
MODULE_tron-internal_REQUESTER_THREADS=2

#######################
## TRC-10 TRON Module
#######################

MODULES[]=tron-trc-10
MODULE_tron-trc-10_CLASS=TronTRC10Module
MODULE_tron-trc-10_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-10_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-10_REQUESTER_TIMEOUT=60
MODULE_tron-trc-10_REQUESTER_THREADS=2

#######################
## TRC-20 TRON Module
#######################

MODULES[]=tron-trc-20
MODULE_tron-trc-20_CLASS=TronTRC20Module
MODULE_tron-trc-20_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-20_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-20_REQUESTER_TIMEOUT=60
MODULE_tron-trc-20_REQUESTER_THREADS=2

#######################
## TRC-721 TRON Module
#######################

MODULES[]=tron-trc-721
MODULE_tron-trc-721_CLASS=TronTRC721Module
MODULE_tron-trc-721_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-721_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-721_REQUESTER_TIMEOUT=60
MODULE_tron-trc-721_REQUESTER_THREADS=2

#######################
## TRC-1155 TRON Module
#######################

MODULES[]=tron-trc-1155
MODULE_tron-trc-1155_CLASS=TronTRC1155Module
MODULE_tron-trc-1155_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-1155_NODES[]=http://login:password@127.0.0.1:1234/
MODULE_tron-trc-1155_REQUESTER_TIMEOUT=60
MODULE_tron-trc-1155REQUESTER_THREADS=2

####################
## Zcash Main Module
####################
Expand Down Expand Up @@ -699,6 +765,7 @@ FRONT_polygon-zkevm_ECOSYSTEM_TITLE=Polygon zkEVM Ecosystem
FRONT_optimism_ECOSYSTEM_TITLE=Optimism Ecosystem
FRONT_gnosis-chain_ECOSYSTEM_TITLE=Gnosis Chain Ecosystem
FRONT_base_ECOSYSTEM_TITLE=Base Ecosystem
FRONT_tron_ECOSYSTEM_TITLE=Tron Ecosystem

FRONT_bitcoin_ECOSYSTEM_DESCRIPTION=Includes Bitcoin only
FRONT_litecoin_ECOSYSTEM_DESCRIPTION=Includes Litecoin only
Expand All @@ -717,6 +784,7 @@ FRONT_polygon-zkevm_ECOSYSTEM_DESCRIPTION=Includes Polygon zkEVM only
FRONT_optimism_ECOSYSTEM_DESCRIPTION=Includes Optimism only
FRONT_gnosis-chain_ECOSYSTEM_DESCRIPTION=Includes Gnosis Chain only
FRONT_base_ECOSYSTEM_DESCRIPTION=Includes Base only
FRONT_tron_ECOSYSTEM_DESCRIPTION=Includes Tron only

FRONT_bitcoin_BLOCKCHAIN_TITLE=Bitcoin
FRONT_litecoin_BLOCKCHAIN_TITLE=Litecoin
Expand All @@ -735,6 +803,7 @@ FRONT_polygon-zkevm_BLOCKCHAIN_TITLE=Polygon zkEVM
FRONT_optimism_BLOCKCHAIN_TITLE=Optimism
FRONT_gnosis-chain_BLOCKCHAIN_TITLE=Gnosis Chain
FRONT_base_BLOCKCHAIN_TITLE=Base
FRONT_tron_BLOCKCHAIN_TITLE=Tron

FRONT_bitcoin_BLOCKCHAIN_DESCRIPTION=The one and only blockchain
FRONT_litecoin_BLOCKCHAIN_DESCRIPTION=The digital silver blockchain
Expand All @@ -753,6 +822,7 @@ FRONT_polygon-zkevm_BLOCKCHAIN_DESCRIPTION=Polygon zkEVM
FRONT_optimism_BLOCKCHAIN_DESCRIPTION=Optimism
FRONT_gnosis-chain_BLOCKCHAIN_DESCRIPTION=Gnosis Chain
FRONT_base_BLOCKCHAIN_DESCRIPTION=Base
FRONT_tron_BLOCKCHAIN_DESCRIPTION=Tron

FRONT_bitcoin-main_MODULE_TITLE=Main
FRONT_bitcoin-omni_MODULE_TITLE=Omni Layer
Expand Down Expand Up @@ -808,6 +878,12 @@ FRONT_base-trace_MODULE_TITLE=Internal
FRONT_base-erc-20_MODULE_TITLE=ERC-20
FRONT_base-erc-721_MODULE_TITLE=ERC-721
FRONT_base-erc-1155_MODULE_TITLE=ERC-1155
FRONT_tron-main_MODULE_TITLE=Main
FRONT_tron-internal_MODULE_TITLE=Internal
FRONT_tron-trc-10_MODULE_TITLE=TRC-10
FRONT_tron-trc-20_MODULE_TITLE=TRC-20
FRONT_tron-trc-721_MODULE_TITLE=TRC-721
FRONT_tron-trc-1155_MODULE_TITLE=TRC-1155

FRONT_bitcoin-main_MODULE_DESCRIPTION=Main Bitcoin transfers
FRONT_bitcoin-omni_MODULE_DESCRIPTION=Omni Layer transfers
Expand Down Expand Up @@ -863,6 +939,12 @@ FRONT_base-trace_MODULE_DESCRIPTION=Internal Base transfers (trace)
FRONT_base-erc-20_MODULE_DESCRIPTION=ERC-20 token transfers
FRONT_base-erc-721_MODULE_DESCRIPTION=ERC-721 token transfers
FRONT_base-erc-1155_MODULE_DESCRIPTION=ERC-1155 token transfers
FRONT_tron-main_MODULE_DESCRIPTION=Main Tron transfers
FRONT_tron-internal_MODULE_DESCRIPTION=Internal Tron transfers
FRONT_tron-trc-10_MODULE_DESCRIPTION=TRC-10 token transfers
FRONT_tron-trc-20_MODULE_DESCRIPTION=TRC-20 token transfers
FRONT_tron-trc-721_MODULE_DESCRIPTION=TRC-721 token transfers
FRONT_tron-trc-1155_MODULE_DESCRIPTION=TRC-1155 token transfers

############
# DigiByte #
Expand Down
103 changes: 102 additions & 1 deletion 3xpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
echo N . cli_format_bold('Please select an action: ') . N;
echo 'Get latest block number ' . cli_format_reverse('<L>') .
', Process block ' . cli_format_reverse('<B>') .
', Process back ' . cli_format_reverse('<PB>') .
', Process range ' . cli_format_reverse('<PR>') .
', Monitor blockchain ' . cli_format_reverse('<M>') .
', Check handle ' . cli_format_reverse('<H>') .
', Run tests ' . cli_format_reverse('<T>') .
Expand All @@ -113,7 +115,7 @@

$input_argv[] = $chosen_option;

if (!in_array($chosen_option, ['L', 'B', 'M', 'H', 'T']))
if (!in_array($chosen_option, ['L', 'B', 'PB', 'PR', 'M', 'H', 'T']))
die(cli_format_error('Wrong choice for 2nd param') . N);

echo N;
Expand Down Expand Up @@ -224,6 +226,7 @@
// address <tab> currency <tab> sign <tab> effect <tab> valid <tab> extra <?tab> ?extra_indexed

$tsv_fields = ['block', 'transaction', 'sort_key', 'time', 'address', 'currency', 'sign', 'effect', 'valid', 'extra'];

$tsv = '';

foreach ($events as $event)
Expand Down Expand Up @@ -308,6 +311,104 @@
ddd($output_events);
}
}
elseif ($chosen_option === 'PB')
{
echo cli_format_bold('Start block number please...') . N;

if (isset($argv[3]))
{
$chosen_block_id = (int)$argv[3];
echo ":> {$chosen_block_id}\n";
}
else
{
$chosen_block_id = (int)readline(':> ');
}

$start_block_id = $chosen_block_id > 0 ? $chosen_block_id : $module->inquire_latest_block();

if ($start_block_id != $chosen_block_id)
echo cli_format_bold('Processing blocks from latest down to genesis...');
else
echo cli_format_bold("Processing blocks from {$start_block_id} up to genesis...");
for ($i = $start_block_id; $i != 0; $i--)
{
echo "\nProcessing block #{$i} ";

$t0 = microtime(true);

try
{
$module->process_block($i);
}
catch (RequesterException)
{
echo cli_format_error('Requested exception');
usleep(250000);
}

$event_count = count($module->get_return_events() ?? []);
$currency_count = count($module->get_return_currencies() ?? []);

$time = number_format(microtime(true) - $t0, 4);

echo "with {$event_count} events and {$currency_count} currencies in {$time} seconds";
}
}
elseif ($chosen_option === 'PR')
{
echo cli_format_bold('Start block number please...') . N;

if (isset($argv[3]))
{
$start_block_id = (int)$argv[3];
echo ":> {$start_block_id}\n";
}
else
{
$start_block_id = (int)readline(':> ');
}
echo cli_format_bold('End block number please...') . N;

if (isset($argv[4]))
{
$end_block_id = (int)$argv[4];
echo ":> {$end_block_id}\n";
}
else
{
$end_block_id = (int)readline(':> ');
}
echo N;

echo cli_format_bold('Processing range of blocks...');
$increment = $start_block_id > $end_block_id ? -1 : 1;
for ($i = $start_block_id; $i != $end_block_id; $i=$i+$increment)
{
echo "\nProcessing block #{$i} ";

$t0 = microtime(true);

try
{
$module->process_block($i);
}
catch (RequesterException)
{
echo cli_format_error('Requested exception');
usleep(250000);
}

$event_count = count($module->get_return_events() ?? []);
$currency_count = count($module->get_return_currencies() ?? []);

$time = number_format(microtime(true) - $t0, 4);

echo "with {$event_count} events and {$currency_count} currencies in {$time} seconds";
}

}

elseif ($chosen_option === 'M')
{
$best_known_block = $module->inquire_latest_block();
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
- Core, UTXO modules, EVM modules
* [Yulian Volianskyi](https://github.com/jzethar)
- Beacon Chain modules
* [alexqrid](https://github.com/alexqrid)
- TVM modules
* [Oleg Makaussov](https://github.com/Lorgansar)
- Cardano Tokens modules
- Cardano Tokens modules
Loading