2

Beacon is an implementation of tzip-10 and Matrix is the transport layer, which as I understand is a pub/sub system. The communication details between the two however isn't clear. Can you provide the details how the handshake between the the dApp and a wallet occurs and how Beacon connects and authenticates to Matrix nodes?

1 Answer 1

3

The flow is as follows:

  1. Both the wallet and dApp create their own sets of key pairs (just a standard Ed25519 key pair, not related to Matrix at this point).
  2. Both the wallet and dApp log in to Matrix using derivatives of their public keys as the user ID and start listening for events.
  3. Upon request, the dApp generates a QR code which contains, amongst others, its public key (from step 1).
  4. The wallet scans the QR code, creates a new private room and invites the dApp using the key from the QR code. It waits then for the dApp to join the room.
  5. The dApp receives the invite and joins the room.
  6. The wallet uses the room to send a pairing response (basically the same info you get in the QR code but this time it’s generated by the wallet) to the dApp.
  7. At this point the wallet and dApp are paired and will continue communicating via the room, i.e. when the dApp initiates a request, it sends it to the room where it gets read and processed by the wallet, the wallet next creates a response and sends it back to the room where the dApp sees it. Before it ends up in the room, every message (JSON) is serialized with Base58Check and encrypted with a session key created from a combination of keys from step 1. The list of messages can be found in the proposal or the docs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.