Connect to the Network
How to connect with to VeChainThor blockchain using @vechain/sdk-network
Last updated
Was this helpful?
How to connect with to VeChainThor blockchain using @vechain/sdk-network
Last updated
Was this helpful?
Interacting with VeChainThor requires only an instance of ThorClient
that is configured for the relevant network. Once the connection is established, this instance can be utilized to interact in an asynchronous manner. Below is a snippet that demonstrates importing the library and initializing a client:
The snippet connects to the MainNet, where all production related activity is found.
Additionally there is a TestNet available for testing and development purposes. This allows developers to experiment without risking real assets.
To connect to the TestNet use https://testnet.vechain.org
as URL. If you have deployed a , it is normally available on http://localhost:8669
.
To test the connectivity we'll get request the first and last block from the chain and output their number & id:
You can test the above snippet here:
The ThorClient
provides a multitude of properties with access to all relevant functionality on VeChain. You can find examples and details about all of them in the .