Skip to content
Tezos as a Service - WebSocket API
C# TypeScript HTML Dockerfile CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode VS Code configs Sep 15, 2019
AgileVentures.TezPusher.ConsoleApp ConsoleApp - updated configuration Nov 12, 2019
AgileVentures.TezPusher.Function - Added delegations and originations Nov 10, 2019
AgileVentures.TezPusher.Model
AgileVentures.TezPusher.SampleClient.Web
AgileVentures.TezPusher.SampleClient
AgileVentures.TezPusher.Service Added Pusher.Web with SignalR hub and integrated pusher Sep 15, 2019
AgileVentures.TezPusher.Web
docs-api-endpoints GitBook: [master] 3 pages modified Nov 13, 2019
docs-clients
docs-getting-started GitBook: [master] 9 pages modified Nov 13, 2019
docs-sample-clients
.dockerignore
.gitignore VS Code configs Sep 15, 2019
AgileVentures.TezPusher.sln
LICENSE Initial commit Jul 4, 2019
README.md
SUMMARY.md GitBook: [master] 9 pages modified Nov 13, 2019
docs-welcome.md GitBook: [master] 8 pages modified Nov 12, 2019

README.md

TaaS (Tezos as a Service)

About TaaS

TaaS provides real-time updates to various applications based on the events happening on Tezos by leveraging SignalR (WebSocket).

Documentation

https://docs.tezoslive.io/docs-welcome

Table of contents

How to use

Option #1 - Running Pusher.Web in Docker

Ready-to-use docker image is available from Docker Hub here: https://hub.docker.com/r/tezoslive/agileventurestezpusherweb.

You can start the container by using the following command

docker run --rm -it -p 80:80 \
--env Tezos:NodeUrl="http://172.17.0.1:8732" \
tezoslive/agileventurestezpusherweb

This will expose port 80 to the host and set your Tezos Node RPC to http://172.17.0.1:8732.

{% hint style="warning" %} Do not forget to replace the NodeUrl per your environment! {% endhint %}

Please make sure to check the documentation for additional information.

Configuration needed

Provide a configuration for Pusher.Web project in

  • the ENV variable Tezos:NodeUrl has to be set. Configured Tezos RPC endpoint ****must support following calls
    • monitor/heads/main
    • /chains/main/blocks/{hash}

For client side instructions please see Subscribing to events from the client - Option 1 or 2.

Option #2 - Running Pusher.Web as a standalone ASP.NET Core app

Provide a configuration for Pusher.Web project in

  • appsettings.json file. You will need to fill in this value "NodeUrl": "" . Configured Tezos RPC endpoint must support following calls
    • monitor/heads/main
    • /chains/main/blocks/{hash}

For client side instructions please see Subscribing to events from the client - Option 1 or 2.

Option #3 - Using Azure Functions and TezPusher.ConsoleApp

ConsoleApp Configuration

Provide a configuration for ConsoleApp project in the appsettings.json file if you are running from compiled sources or ENV variables if you are running from Docker.

{% hint style="warning" %} Be sure to configure the following keys correctly per your environment

  • Tezos:NodeUrl - Tezos RPC endpoint URL
  • Azure:AzureFunctionUrl - URL of your deployed function app
  • Azure:AzureFunctionKey - Access key for your message function of your deployed function app {% endhint %}

Function App Configuration

Provide a configuration for Function project in the local.settings.json file if you are running it locally or Azure Applications Settings if you are running in Azure. There is a pre-filled endpoint which is hosted on Azure Free plan, so it might be already above daily threshold. You can create a SignalR Service on Azure for free on Azure and provide your own SignalR connection string.

  • "AzureSignalRConnectionString": ""

For client side instructions please see Subscribing to events from the client - Option 3 or 4.

Option #4 - Using the endpoint from TezosLive.io (most convenient)

Sign in using your GitHub account on TezosLive.io and request your endpoint.

{% hint style="info" %} You don't need to host anything on server side. {% endhint %}

API is currently limited to

  • 20 000 messages per account per day (1 message is counted for each 64kB in case message has more than 64kB)
  • 20 concurrent connection per account

Please make sure to check the documentation for additional information.

For client side instructions please see Subscribing to events from the client - Option 3 or 4.

If you need more messages or concurrent connections please contact us hello AT tezoslive.io.

Subscribing to events from the client

I am using option #1 or #2

You can connect to the hub for example like this (see signalr.service.ts)

private  connect():  Observable<any> {
    this.hubConnection  = new signalR.HubConnectionBuilder()
        .withUrl(`${this._baseUrl}/tezosHub`)
        .configureLogging(signalR.LogLevel.Information)
        .build();
    return  from(this.hubConnection.start());
}

You can then subscribe to transactions like this.

this.hubConnection.send("subscribe", { 
   transactionAddresses: ['all'],
   delegationAddresses: ['all'],
   originationAddresses: ['all']
});

Note: transactionAddresses, delegationAddresses and originationAdresses are string[].

{% hint style="info" %} Specifying 'all' will subscribe the client to all transactions/delegations/originations respectively. {% endhint %}

For reference please take a look at AgileVentures.TezPusher.SampleClient.Web specifically signalr.service.ts.

I am using option #3 or #4

You will need to provide a UUID in a custom HTTP header named x-tezos-live-userid to identify a client during the initial call to negotiate endpoint. In the sample client application we are using the npm uuid package to generate random UUIDs.

You can see how the subscription to all transactions is being made by looking at the signalr.service.ts here by making a POST request to subscribe endpoint with the following parameters

  • userId is string - this is the UUID you have used for the negotiate call
  • transactionAddresses, delegationAddresses and originationAddressesare string[] - this is the array of the addresses that you want to subscribe to. You can subscribe to all addresses by sending ['all']

You can also subscribe only to a subset of addresses, that you are interested in by providing them as a parameter to subscribe call. You need to provide the generated UUID that you used in the negotiate call along with the array of the addresses.

For reference please take a look at AgileVentures.TezPusher.SampleClient.

Or you can check out deployed version of this app available here https://client-staging.tezoslive.io/.

Solution Description

Solution consists of several projects described bellow

Sample Client Applications

You can’t perform that action at this time.