Providers
Last updated
Was this helpful?
Last updated
Was this helpful?
The provider is how blockchain SDK talks to the blockchain. Providers take JSON-RPC requests and return the response. This is normally done by submitting the request to an HTTP or Websocket based server.
Most nodes have a variety of ways to connect to them. The most common ways to connect to your node are:
Websockets (works remotely, faster than HTTP)
HTTP (more nodes support it)
Currently, js-conflux-sdk has support for both HTTP
and Websockets
. Normally, websockets is recommended than HTTP, because it's faster and can use . If you want to use the PubSub API, websocket provider is the only choice. Conflux-rust's HTTP default port is 12537
, websocket default port is 12535
. They can be changed through .
When initialize a Conflux object, the underline provider can be configured through the url
option. If you want to use HTTP provider, then provide an HTTP URL:
If want use websockts provider then provide a WSS URL.
A connection to the Conflux network (a Provider)
Holds your private key and helps you sign things (a Signer)
js-conflux-sdk (v2) can work with Fluent to talk with Conflux blockchain, simply by set conflux
to the Conflux
instance's provider.
Note: Fluent wallet won't export window.confluxJS
anymore, Dapp developers need to install js-conflux-sdk
by themselves and set Conflux
instance's provider to Fluent provider.
If you can't determine the networkId
of the selected network of Fluent, you can get it asynchronously like below.
A Dapp can connect Conflux Blockchain through , which is a browser extension that provides: