This is a hub for Snapshot network that stores the database and forwards new messages to peers. The hub hold a private keys to sign valid messages.
- Install Node.js, clone the repository, then say:
npm install
- Copy
.env.example
, rename it to.env
and set a value for these config vars:
DATABASE_URL
: The database connection string. You will need to run your own MySQL database or use a Cloud service like JawsDB.RELAYER_PK
: This is the private key of the hub. The hub counter-sign every accepted message with this key.PINNING_SERVICE
: This value must be "fleek" or "pinata". The hub support Pinata or Fleek IPFS pinning services.FLEEK_API_KEY
andFLEEK_API_SECRET
orPINATA_API_KEY
andPINATA_SECRET_API_KEY
: You need to setup API keys for the pinning service you've defined.
- Create the database schema
Run this query on the MySQL database to create the initial schema with the required tables: https://github.com/snapshot-labs/snapshot-hub/blob/master/src/helpers/database/schema.sql
- Use this command to run the hub:
node run start
- Go on this page: http://localhost:3000/api if everything is fine it should return details of the hub example:
{
"name": "snapshot-hub",
"network": "livenet",
"version": "0.1.3",
"tag": "alpha",
"relayer": "0x8BBE4Ac64246d600BC2889ef5d83809D138F03DF"
}
Once your hub is running online, the main hub can relay the messages received to your own hub. Please provide the URL of your Snapshot hub to an admin to make sure it's connected to the network.
To load a space settings in the database you can go on this endpoint http://localhost:3000/api/spaces/yam.eth/poke (change yam.eth with the space you want to activate).