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.

Do not forget to replace the NodeUrl per your environment!

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.

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

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.

You don't need to host anything on server side.

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[].

Specifying 'all' will subscribe the client to all transactions/delegations/originations respectively.

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