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-nodejswith 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
3381and gRPC is3383. submitMessagehas a slightly different API and semantics, detailed below.HubEventids no longer contain timestamps and callingextractEventTimestampmay return invalid data.- When calling
subscribeor 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-webis 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:
submitMessagerequests must all containdataBytesfor Snapchain. Thehub-nodejsbuilders 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; }submitMessageis best-effort. It's possible, but rare, thatsubmitMessagesucceeds but the submitted message fails to get included in a block.