TaaS provides real-time updates to various applications based on the events happening on Tezos by leveraging SignalR (WebSocket).
https://docs.tezoslive.io/docs-welcome
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.
Provide a configuration for Pusher.Web
project in
- the
ENV
variableTezos:NodeUrl
has to be set. Configured Tezos RPC endpoint ****must support following callsmonitor/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 callsmonitor/heads/main
/chains/main/blocks/{hash}
For client side instructions please see Subscribing to events from the client - Option 1 or 2.
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 URLAzure:AzureFunctionUrl
- URL of your deployed function appAzure:AzureFunctionKey
- Access key for your message function of your deployed function app {% endhint %}
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.
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
.
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 thenegotiate
call transactionAddresses
,delegationAddresses
andoriginationAddresses
arestring[]
- 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 consists of several projects described bellow
-
AgileVentures.TezPusher.Function Azure Function getting the updates from Pusher.ConsoleApp and sending the updates to SignalR hub.
-
AgileVentures.TezPusher.Model Simple Model for the updates. This will be extended heavily based on the different subscriptions.
-
AgileVentures.TezPusher.Pusher.ConsoleApp Small Console Application in .NET Core used to monitor Tezos Node and push updates to the Azure Function.
-
AgileVentures.TezPusher.Pusher.Web ASP.NET Core Application, that monitors Tezos Node and also provides updates to clients through SignalR hub over WebSocket transport.
Docker supported! To try-out docker version you can also get it from Docker Hub here https://hub.docker.com/r/tezoslive/agileventurestezpusherweb. See instructions for Option #1.
-
AgileVentures.TezPusher.SampleClient Sample Client application written in Angular consuming the updates provided by the Azure SignalR hub.
-
AgileVentures.TezPusher.SampleClient.Web Sample Client application written in Angular consuming the updates provided by the ASP.NET Core SignalR hub.