Skip to content

Migrating to Snapchain from Hubble

Snapchain is designed to be a drop-in replacement for Hubble. To migrate, follow these steps:

  1. Set up a Snapchain node (instructions).
  2. Update your app to use hub-nodejs with a version >=0.13.0
  3. Update the connection url to talk the new snapchain host and port.

Notable differences

  1. Ports have changed. The HTTP port is 3381 and gRPC is 3383.
  2. submitMessage has a slightly different API and semantics, detailed below.
  3. HubEvent ids no longer contain timestamps and calling extractEventTimestamp may return invalid data.
  4. 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)
  5. 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:

  1. submitMessage requests must all contain dataBytes for Snapchain. The hub-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;
    }
  2. submitMessage is best-effort. It's possible, but rare, that submitMessage succeeds but the submitted message fails to get included in a block.