The goal of the hub is to give validators a simple way to directly generate revenue off of their bittensor bandwidth. This is designed as a template for validators to take and create their own branded hubs with, however pull requests are always encouraged.
Example: http://1.2.3.4:80
Fill in NEXT_PUBLIC_HUB_API_ENDPOINT to your hub-proxy ip address or url (if
DNS is setup)
Example: http://1.2.3.4:80
Setup your targon backend and point DATABASE_URL to your database.
If you dont want to use google OAuth, you will need to rip out some parts of the codebase to accommodate. In a future update we plan on making this simpler to pick and choose auth methods
Follow
this guide
for getting the GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET. Make sure you set
GOOGLE_REDIRECT_URI to https://[your domain]/sign-in/google/callback, along
with http://localhost:3000 if you wish to use google OAuth in dev mode, and
enter these in to your google console.
Example: https://api.targon.com/sign-in/google/callback
Go to Stripe and create your account, add your banking information and any other details stripe needs.
Go to your products page on Stripe and
hit Add Product. We suggest naming the product something like
Targon Credits x [Tokens per dollar]. The name is ultimately up to you, and as
a validator you are free to choose an appropriate token per dollar amount. Make
sure to pick a number that is not so low that you over-sell your bandwidth
allowance. Make sure you set the price to $1.00
Now that you have created your token product, go to its page in your dashboard
and find its price API ID. This should start with price_. Copy this to your
env file as STRIPE_CREDIT_PRICE_ID
Go to the webhooks page in stripe and create a new webhook. Set the endpoint URL
to https://[your domain]/api/stripe/webhook, and save the webhook secret to
your .env file. Lastly, get the remaining API keys which should be in your
stripe developer dashboard.
Go to src/constants.ts and set each constant to your specifications.
Also navigate to scripts/bootstrap.ts and modify the cpt fields for each
model. This changes how many credits each token costs for each model (Credits
Per Token). You can also leave this as the default of 1.
Install bun, then run
bun db:push
bun bootstrapThis initializes the database schema and starting entries.
Create a vercel account and hookup your github to it. Add a new project and import your forked github repo and paste in your .env file
Your hub should now be operational. Make sure you test everything yourself before advertising it.