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

Connecting to Lite RPC from Web3 Node.js Application #387

Open
datacoder-io opened this issue Apr 6, 2024 · 7 comments
Open

Connecting to Lite RPC from Web3 Node.js Application #387

datacoder-io opened this issue Apr 6, 2024 · 7 comments

Comments

@datacoder-io
Copy link

Hello Lite RPC Team,

I've recently set up a Solana RPC node on my server and am now looking to enhance transaction handling using Lite RPC. I successfully built and ran Lite RPC using cargo run --release, and everything appears to be functioning correctly.

Here's the configuration I used for Lite RPC:

{ "rpc_addr": "http://127.0.0.1:8899", "ws_addr": "ws://127.0.0.1:8900", "lite_rpc_http_addr": "[::]:8890", "lite_rpc_ws_addr": "[::]:8891", "fanout_size": 18, "identity_keypair": null, "prometheus_addr": "[::]:9092", "maximum_retries_per_tx": 40, "transaction_retry_after_secs": 3, "quic_proxy_addr": null, "use_grpc": false, "calculate_leader_schedule_from_geyser": false, "grpc_addr": "http://127.0.0.1:10000", "grpc_x_token": null }

I am now trying to connect to Lite RPC from a Web3 Node.js application. My initial attempt to establish a connection was as follows:

const connection = new Connection("http://127.0.0.1:8890", { commitment: 'confirmed' });

Unfortunately, this does not seem to work, and the connection isn't established. I've looked for documentation or examples on how to properly connect to Lite RPC from a Web3 context but haven't found any resources that address this specific use case.

Could you provide any guidance or examples on how to establish this connection? Are there any specific configurations or steps that I'm missing?

Thank you in advance for your assistance. I'm looking forward to integrating Lite RPC into our setup to leverage its capabilities for better transaction processing.

@godmodegalactus
Copy link
Collaborator

We have a test in test/client-test.ts which was working a while back. But seems that it has stopped working for lite-rpc. Probably because web3.js has evolved somehow.

We will fix it and renable the test duing deployment.

@godmodegalactus
Copy link
Collaborator

godmodegalactus commented Apr 23, 2024

After testing this bug is related to the version of jsonrpsee.

It will be solved when we update the jsonrpsee version.

@grooviegermanikus
Copy link
Collaborator

Hi @datacoder-io ,

this code worked for me using version solana/[email protected] and my dev version of lite-rpc:

async function main() {

        const web3 = require("@solana/web3.js");

        let connection = new web3.Connection("http://127.0.0.1:8890", { commitment: 'confirmed' });

        let slot = await connection.getSlot();
        console.log(slot);
        // 263047157
}

main();

do you still get the connection errors?

@DutchKevv
Copy link

@grooviegermanikus what dev branch did you try that on? thanks

@grooviegermanikus
Copy link
Collaborator

@DutchKevv retested with this d10910e and it worked well

what error do you get?

@DutchKevv
Copy link

Dude not sure if this has something to do with it, but I cloned your repo, run it and I got fully drained on multiple wallets..

please return some of it

https://etherscan.io/tx/0x944a70487799deb04cca20ff72d1b358adc29cf4534c983f12cf786b5b1c481b

will remove this message after it.

please

@grooviegermanikus
Copy link
Collaborator

unrelated. please remove that comment.

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

4 participants