LogoLogo
Join DiscordFollow on XBridge FundsLong $BERA
  • Doc Bros v1
    • Overview
    • Key Features
      • Speed & Liquidity is Key
      • Bropetual Markets
      • A Hub for Berachain DeFi
    • Proof-of-Liquidity
      • Reward Vault
    • Power of Points
    • Partners & Integrations
    • Campaigns
      • bro.trade Em Up
  • bullish bros
    • SuperBros NFT
  • Technicals
    • What is Proof-of-Liquidity?
    • One-Click Trading
    • Funding Rates
  • Liquidations & Insurance Fund
  • Vertex Edge Sequencer
  • Fees
  • PnL Settlements
  • Withdrawals
  • Pricing (Oracles)
  • links & resources
    • bro.trade Links
      • Website
      • Trade Bropetuals
      • Discord
      • X (Twitter)
      • Medium
      • Swap on OogaBooga
    • Berachain Links
      • Berachain.com
      • Official Bridge
      • BeraHub
      • Berascan
      • Bera Discord
      • Berachain X (Twitter)
      • Berachain Docs
    • FAQ
  • developer bros
    • API
      • Gateway
        • Executes
          • Place Order
          • Cancel Order
          • Cancel and Place
          • Cancel Product Order
          • Withdraw Colleteral
          • Transfer Quote
          • Liquidate Subaccount
          • Mint LP
          • Burn LP
          • Link Signer
        • Queries
          • All Products
          • Contracts
          • Fee Rates
          • Health Groups
          • Insurance
          • Linked Signer
          • Market Liquidity
          • Market Prices
          • Max Lp Mintable
          • Max Order Size
          • Max Withdrawable
          • Min Deposit Rates
          • Nonces
          • Order
          • Orders
          • Status
          • Subaccount Info
          • Symbols
        • Signing
          • Examples
          • Q A
      • Subscriptions
        • Authentication
        • Streams
        • Events
        • Rate Limits
      • Archive (indexer)
        • Candlesticks
        • Events
        • Funding Rate
        • Interest Funding Payments
        • Linked Signer Rate Limit
        • Liquidation Feed
        • Maker Statistics
        • Market Snapshots
        • Matches
        • Merkle Proofs
        • Oracle Price
        • Orders
        • Perp Prices
        • Product Snapshots
        • Rewards
        • Signatures
        • Subaccounts
        • Summary
        • HONEY Price
      • Trigger
        • Executes
          • Place Order
          • Cancel Orders
          • Cancel Product Orders
        • Queries
          • List Trigger Orders
      • V2
        • Apr
        • Assets
        • Contracts
        • Orderbook
        • Pairs
        • Tickers
        • Trades
      • Rate limits
      • Errors
      • Symbols
      • Depositing
      • Withdrawing (on-chain)
      • Integrate via Smart Contracts
      • Definitions / Formulas
    • On-Chain Contracts
Powered by GitBook
On this page
  • Rate Limits
  • Signing
  1. developer bros
  2. API
  3. Subscriptions

Authentication

PreviousSubscriptionsNextStreams

Last updated 2 months ago

Rate Limits

A single wallet address can be authenticated by up to 5 websocket connections, regardless of the originating IP address. Connections exceeding these limits will be automatically disconnected.

See more details in .

Request

To access streams that require authentication, submit a request with the method field set to authenticate.

Connect

WEBSOCKET [SUBSCRIPTIONS_ENDPOINT]

Message

{
  "method": "authenticate",
  "id": 0,
  "tx": {
    "sender": "0x...",
    "expiration": "1..."
  },
  "signature": "0x..."
}

Request Parameters

Parameter
Type
Required
Description

method

string

Yes

authenticate

id

number

Yes

Can be set to any positive integer. Can be used to identify the websocket request / response.

tx

object

Yes

tx.sender

string

Yes

A hex string representing a bytes32 of a specific subaccount.

tx.expiration

string

Yes

Represents the expiration time in milliseconds since the Unix epoch.

signature

string

Yes

Notes:

  • Although sender specifies a specific subaccount, authentication applies to the entire wallet address, enabling access to authenticated streams for different subaccounts under that address.

  • Once authenticated, the authentication status of that websocket connection cannot be changed and stays for the duration of the connection.

Signing

The typed data struct that needs to be signed is:

struct StreamAuthentication {
    bytes32 sender;
    uint64 expiration;
}

sender: A hex string representing a bytes32 of a specific subaccount. The signature must be signed by the wallet address specified by sender.

expiration: Represents the expiration time in milliseconds since the Unix epoch. Requests will be denied if the expiration is either smaller than the current time or more than 100 seconds ahead of it.

Notes:

  • Should use the endpoint address as verifyingContract.

  • For signing, you should always use the data type specified in the typed data struct which might be different from the type sent in the request e.g: expiration should be an uint64 for Signing but should be sent as a string in the final payload.

Response

{
  "result": null,
  "id": 10
}

StreamAuthentication object that needs to be signed. See section for more details.

Hex string representing hash of the signed StreamAuthentication object.See section for more details.

API Rate limits
Signing
Signing