Migrating to Snapchain from Hubble
Snapchain is designed to be a drop-in replacement for Hubble. To migrate, follow these steps:
- Set up a Snapchain node (instructions).
- Update your app to use
hub-nodejs
with a version>=0.13.0
- Update the connection url to talk the new snapchain host and port.
Notable differences
- Ports have changed. The HTTP port is
3381
and gRPC is3383
. submitMessage
has a slightly different API and semantics, detailed below.HubEvent
ids no longer contain timestamps and callingextractEventTimestamp
may return invalid data.- When calling
subscribe
or using shuttle, note that there are only 2 shards on snapchain and they are 1 indexed (shard 0 is chain metadata and does not have user data) hub-web
is not fully supported and may not work in some cases.
submitMessage
Messages once submitted must be included in blocks, similar to blockchain transactions. The submitMessage
has two main differences from Hubble:
submitMessage
requests must all containdataBytes
for Snapchain. Thehub-nodejs
builders handle this in all versions>=0.13.0
, but if you're not using those you will need to manually update this like so:if (message.dataBytes === undefined) { message.dataBytes = protobufs.MessageData.encode(message.data).finish(); message.data = undefined; }
submitMessage
is best-effort. It's possible, but rare, thatsubmitMessage
succeeds but the submitted message fails to get included in a block.