Showrunners scaffold overview
The showrunners framework is a scaffold that developers can use to build out notifications for their use cases.
Showrunners framework provides the tools and helpers required for constructing the payload and sending the notification using the Push protocol infrastructure.
Out-of-the-box showrunners provide the developer with a scheduling engine and libraries and helpers for easy access to blockchain data as well as web2 data sources.
Setup showrunner
Pre-requisites
You should have the following installed on your system:
- Docker
- Node JS
- NPM
Clone showrunners scaffold repo
The initial step in setting up the showrunners is cloning the showrunners repo
git clone https://github.com/push-protocol/push-showrunners-framework
This repository will contain the showrunner framework that you require to instantly build your channels logic.
Now in order to run this showrunner, we will need .env file which will contain your credentials that are required for fetching data from blockchains (for example, Infura).
For creating this .env
file, simply copy the .env.sample
file present in the root of the folder and replace the fields with valid credentials for each field.
# MAKE A COPY OF THIS AND FILL WITH YOUR CREDENTIALS AND NAME IT .env (Remove .sample Part)
# SHOWRUNNERS ENVIRONMENT: prod or staging or dev
SHOWRUNNERS_ENV=staging
## NORMAL CONFIG
# DEBUG | CAN BE 'debug' or 'prod'
LOG_LEVEL=debug_or_prod # 'debug' or 'prod'
# WEB3 ENDPOINTS | NEED ATLEAST INFURA OR ETHERSCAN OR ALCHEMY, REST CAN BE NULL
INFURA_PROJECT_ID=your_infura_project_id
INFURA_PROJECT_SECRET=your_infura_project_secret
## ADVANCED CONFIG
# WEB3 ENDPOINTS | OPTIONAL IF YOU FILLED INFURA_PROJECT AND INFURA_PROJECT_SECRET, CAN SET IT TO NULL IF YOU WANT TO
ETHERSCAN_API=your_etherscan_api_key_or_null
ALCHEMY_API=your_alchemy_api_key_or_null
Param | Valid Values | Comment |
---|---|---|
SHOWRUNNERS_ENV | prod or staging | Describes the Push Network you are targeting. If you deployed your channel on staging then this will be staging else if you deployed on mainnet (even multi-chain channel) then this will be prod . |
LOG_LEVEL | debug or prod | Changes the amount of log generated, recommended to use debug until you are sure of the logic. |
INFURA_PROJECT | your_infura_project_id or null | Head to infura.io to generate one, required to query data of blockchain. |
INFURA_PROJECT_SECRET | your_infura_project_secret or null | Need at least one (Infura, Etherscan or Alchemy) to operate correctly. |
ETHERSCAN_API | your_etherscan_api_key or null | Head to etherscan.io to generate one, required to query data of blockchain. |
ALCHEMY_API | your_alchemy_api_key or null | Head to alchemy.com to generate one, required to query data of blockchain. |
At least INFURA_PROJECT, INFURA_PROJECT_SECRET or ETHERSCAN_API or ALCHEMY_API key is required to correctly operate showrunners. Recommended to put all as the data fetching becomes more decentralised.
Install dependancies
Now that you have set up the showrunners .env
file, you are all set to run the showrunners. Ensure that all dependencies are installed, open the terminal (or command prompt), and go to the root of the cloned repo, npm install
or yarn install
to install dependencies.
- npm
- yarn
npm install
yarn install
Run docker
Next, open another terminal and type docker-compose up
to start running docker image.
docker-compose up
Start showrunners
Finally, open another terminal and ensure you are still at the root of the cloned repo and type npm start
or yarn start
.
- npm
- yarn
npm start
yarn start
If everything is good, this is the output that you should see! Congrats, you just installed Showrunners framework 😊😊 running on the port: 5432
💪.
You might see that showrunners are throwing an error explaining that no channels can be found, a channel is what is needed to run logic controls through showrunners.
Let's dive in and see next how to create your hello world channel to run on top of the showrunners framework!
Setup trigger channel - Hello World
Let's create a simple trigger channel next to see how notifications can be triggered automatically from Showrunners framework. For this example, we will use a pre-existing template present inside Showrunners scaffold called Hello World.
Hello World channel exists to simply demonstrate how easy it is to send notifications in Web3. To setup the channel, you will need to do the following things.
Setup
-
Ensure that you have created your channel and make a note of the private key used for the same.
-
Head to
src/sample_showrunners
from the git clone ofpush-showrunners-framework
which you just setup. -
Copy the folder
helloWorld
and drop it insrc/showrunners
folder.You might notice that the showrunners has already moved to complain about
helloWorldKeys.json
not containing the correct private key.{
"PRIVATE_KEY_NEW_STANDARD_1":
{
"PK": "YOUR_CHANNEL_PRIVATE_KEY_HERE",
"CHAIN_ID": "CHAIN_ID_HERE"
},
}- Just copy and paste the private key of your channel instead of
YOUR_CHANNEL_PRIVATE_KEY_HERE
- For
CHAIN_ID_HERE
, You will need to paste the multi chain id format, some examples of supported formats are:
Network name Chain_ID Required ENV setting Remarks Ethereum Mainnet
1 SHOWRUNNERS_ENV=prod
Note: Use eip155:1
if you deployed your channel on Ethereum Mainnet.Polygon Mainnet
137 SHOWRUNNERS_ENV=prod
Note: Use eip155:137
if you deployed your channel on Polygon Mainnet.BNB Mainnet
56 SHOWRUNNERS_ENV=prod
Note: Use eip155:111551116
if you deployed your channel on BNB Mainnet.Arbitrum Mainnet
42151 SHOWRUNNERS_ENV=prod
Note: Use eip155:42151
if you deployed your channel on Arbitrum Mainnet.Ethereum Testnet
11155111 SHOWRUNNERS_ENV=staging
Note: Use eip155:11155111
if you deployed your channel on Ethereum Testnet.Polygon Mumbai
80001 SHOWRUNNERS_ENV=staging
Note: Use eip155:80001
if you deployed your channel on Polygon Mumbai.BNB Testnet
97 SHOWRUNNERS_ENV=staging
Note: Use eip155:97
if you deployed your channel on BNB Testnet.Arbitrum Goerli
421613 SHOWRUNNERS_ENV=staging
Note: Use eip155:421613
if you deployed your channel on Arbitrum Goerli. - Just copy and paste the private key of your channel instead of
Now run npm start
or yarn start
again and you should be able to see the following screen:
Congrats, your channel custom notification trigger is setup and good to go. Let's look at what components of your channel folders enable what functionality next!