Connect to a Wit/RPC provider
Initialize and verify connection to a Wit/RPC provider using the Witnet SDK
Last updated
Was this helpful?
Initialize and verify connection to a Wit/RPC provider using the Witnet SDK
Last updated
Was this helpful?
The code examples below assume that the environment is properly set up as described in . You can easily adapt the examples to pass the URL of the Wit/RPC provider to use, and/or the wallet master key (and the password, if encrypted).
A connection is considered to be initialized once information about the actual Witnet network being served by the provider is retrieved. Namely, an initialized connection lets you know the network identifier, and whether you are connected to the Witnet Mainnet, or perhaps to some Testnet.
In order to serve up-to-date information, the provider needs to keep synchronized with the Witnet blockchain. The following code shows how to check the provider's node_state
, and the current_epoch
of the Witnet network as well as.