Skip to main content

Bidirectional Connection

The CyberConnect Protocol allows users to establish bidirectional connections that are recorded and verified on blockchain networks. This bidirectional connection can be used to express “friends” relationship in some social contexts, but we are not limiting the use cases for it.

There are four states for a bidirectional connection between two addresses: EMPTYPENDINGCONNECTD and BLACKLIST.

  • EMPTY: Initial state between two wallet addresses.
  • PENDING: Includes sent and received bidirectional connection requests.
  • CONNECTED: Two wallet addresses have established a bidirectional connection after the request has been accepted.
  • BLACKLIST: Either of two wallet addresses blocks another or two wallet addresses block each other.

The protocol defines different types of bidirectional connections for different situations:

  • Init: Sends request to another wallet address.
  • Accept: Accepts the request from another wallet address and establishes a bidirectional connection with it.
  • Reject: Rejects the request from another wallet address.
  • Terminate: Terminates the established bidirectional connection with another wallet address。
  • Block: Blocks the request from another wallet address, also will terminate the bidirectional connection if there is already one between you and the address.
  • Unblock: Remove the wallet address from the blacklist, and is able to receive the request from it.

Our protocol defines a state machine to demonstrate relationships between those states and a variety of bidirectional connections:

Bidirectional Connection Workflow

note

The bidirectional connection model has nothing to do with the “friends” in the current CyberConnect product. The CyberConnect product currently defines “friends” using mutual “follow” between two individuals, which are two unilateral connections under the hook.

Developers can incorporate various connection modules to diversify the user experience by using the CyberConnect JS SDK and CyberConnect GraphQL API.

How does it work?

Let’s take “init” as an example. A user clicking the “add“ button in an application invokes the “bidirectionalConnect” function in the CyberConnect JavaScript library. If this is their first bidirectional connection in the current session, they need to manually sign the message. The CyberConnect library then generates and stores a derived key to authorize writing directional connection data onto IPFS and Arweave storage.

Designed by