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

Use trident for tron private chain #113

Closed
TOBEACODER7 opened this issue Nov 21, 2023 · 5 comments
Closed

Use trident for tron private chain #113

TOBEACODER7 opened this issue Nov 21, 2023 · 5 comments

Comments

@TOBEACODER7
Copy link

Is there any way to use trident for private chain.

//main net, using TronGrid
ApiWrapper wrapper = ApiWrapper.ofMainnet("hex private key", "API key");
//Shasta test net, using TronGrid
ApiWrapper wrapper = ApiWrapper.ofShasta("hex private key");
//Nile test net, using a node from Nile official website
ApiWrapper wrapper = ApiWrapper.ofNile("hex private key");

No match function for tron private chain.

@TOBEACODER7
Copy link
Author

I know the goal of trident is to protect your private key. I can just use trident to sign and use HTTP requests to achieve other goals.
But I need to init ApiWrapper, but I don`t know how to achieve this.

@angrynurd
Copy link
Contributor

Is there any way to use trident for private chain.

//main net, using TronGrid
ApiWrapper wrapper = ApiWrapper.ofMainnet("hex private key", "API key");
//Shasta test net, using TronGrid
ApiWrapper wrapper = ApiWrapper.ofShasta("hex private key");
//Nile test net, using a node from Nile official website
ApiWrapper wrapper = ApiWrapper.ofNile("hex private key");

No match function for tron private chain.

hi, @TOBEACODER7
if you want to use trident-java in your private chain, just use the constructor function ApiWrapper(String grpcEndpoint, String grpcEndpointSolidity, String hexPrivateKey) in ApiWrapper.java.
in this function, the grpcEndpoint param is your private chain's grpcendpoint, which may look like ''xx.xx.xx.xx:50051", and the grpcEndpointSolidity is your private chain's grpcEndpointSolidity , which may look like ‘xx.xx.xx.xx:50061’, and the hexPrivateKey is the private key you pass to.
hope this may help.

@TOBEACODER7
Copy link
Author

Thanks for your answer! I`ll try it in my project.

@TOBEACODER7
Copy link
Author

In document

Initialize a ApiWrapper Instance

Before using functions in ApiWrapper, you should bind your private key to an ApiWrapper instance:

ApiWrapper wrapper = new ApiWrapper("grpc endpoint", "solidity grpc endpoint", "hex private key");

Any node can be used here. Alternatively, there are hardcoded initializers for the main net, Shasta and Nile test nets

The grpcEndpoint and solidity grpcEndpoint is the IP and port of any node of your private chain, like"xx.xx.xx.xx:50051/50052".
And the setting of port is in your configuration(private_net_config.conf)

rpc {
    port = 50051
    solidityPort= 50052
}

My trouble was successfully solved with this helpful information.
Thanks for the useful help.

@TOBEACODER7
Copy link
Author

In document

Initialize a ApiWrapper Instance

Before using functions in ApiWrapper, you should bind your private key to an ApiWrapper instance:

ApiWrapper wrapper = new ApiWrapper("grpc endpoint", "solidity grpc endpoint", "hex private key");

Any node can be used here. Alternatively, there are hardcoded initializers for the main net, Shasta and Nile test nets

The grpcEndpoint and solidity grpcEndpoint is the IP and port of any node of your private chain, like"xx.xx.xx.xx:50051/50052". The setting of port is in your configuration(private_net_config.conf)

rpc {
    port = 50051
    solidityPort= 50052
}

My trouble was successfully solved with this helpful information. Thanks for the useful help.

I want to use trident to sign and broadcast transactions from a normal fullnode instead of a srnode.
I try to change the setting of fullnode in :

rpc{
    port = 16669
    SolidityPort = 16670
}

And change the code as :

ApiWrapper wrapper = new ApiWrapper("IP of fullnode:16669", "IP of fullnode:16670", "hex private key");

It will lead to an error:

org.tron.trident.core.exceptions.IllegalException: createTransactionExtention error,CANCELLED: Thread interrupted

I noticed that the doc of trident: Any node can be used here. What should I do to use fullnode to init wrapper of trident?

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

No branches or pull requests

2 participants