Blocks
Last updated
Was this helpful?
Last updated
Was this helpful?
The connection is managed using WebSockets, which connect directly to a VeChain node.
A simple connection can be established with this snippet:
This will receive a new block as soon as it is added to the blockchain, in the form of JSON-encoded strings.
To resume listening from a specific block position, the options can include a blockID
to continue from where a previous listener may have disconnected.
For additional details on the options, refer to the documentation of .
The blocks are received as JSON-encoded strings. These strings must be parsed into usable objects, resulting in an object of type .
An example result is: