Skip to content

GetDala/relayer-kit

 
 

Repository files navigation

Dharma Relayer Kit

The Dharma Relayer Kit is the definitive starting point for building a business on top of Dharma Protocol.

The Relayer Kit lets anyone become a crypto entrepreneur in just a few steps. No bank account required.

Getting started is simple:

  • 👩‍💻 Fork the repo
  • 🎨 Define your own style with our unopinionated React components
  • 🚀 Deploy to Heroku
  • 💸 Collect real cryptocurrency through relayer fees

The Dharma Relayer Kit allows you — the entrepreneur — to focus on your business, and not the blockchain.

Table of Contents

Getting Started

We made getting started fast, simple and fun.

Clone

Clone the repo to your workstation:

git clone https://github.com/dharmaprotocol/relayer-starter-kit.git

Dependencies

To run the project, you'll first need to install the dependencies:

yarn

Blockchain

And launch a local blockchain via:

yarn blockchain

Note: To connect your app to MetaMask, simply skip this step.

Backend

And launch the server via:

yarn server

Frontend

And launch the React frontend via:

yarn start

Running on the Kovan Testnet

Kovan is a test blockchain (referred to as a "testnet") for Ethereum contracts. The Dharma team has deployed our contracts to the Kovan testnet, so that we, and developers building on top of Dharma, can test our tools and products in a way that is similar to mainnet, but without using real tokens.

To get access to Kovan tokens for testing your relayer, please visit https://wallet.dharma.io, and set your Metamask to Kovan mode. This will allow you to get Kovan test tokens for Dharma contracts.

There is no need for running a local blockchain when developing against a testnet, so we skip the step of running a blockchain here.

Backend

First, build a "production" version of your app using:

yarn build

We use an environment variable to allow the server to specify a different database for your Kovan Loan Requests - since Loan Requests for one blockchain will not be valid for another. The environment variable we modify is NETWORK=kovan (and likewise NETWORK=mainnet for mainnet.) An example of running this on your command line would be:

NEWORK=kovan yarn server

This will run a server on port 8000, including your production app. Visit your app on this server by visiting http://localhost:8000.

Note: Changes you make to your app won't be reflected immediate when developing in this state. You need to rebuild your app and then restart your server to see changes.

Frontend

We won't run a separate frontend when testing against a testnet.

Deployment

Everything you need to deploy to Heroku is baked into this repo.

In your command line, make sure you're logged into heroku, and then enter the following commands:

Create a new Heroku app

If you are logged into Heroku on your command line, you can simply run:

heroku create

Otherwise, follow the instructions Heroku provides for creating a new Heroku app.

Overwrite the app's files with your relayer kit

git push -f heroku master

Open your new relayer on Heroku

heroku open

Troubleshooting

You can use this section to debug any problems you might run into while setting up your relayer.

I'm getting an error that blockchain failed to start

In order to run a local blockchain (via yarn blockchain), we use a tool called Ganache-CLI, and we boot it up with all of the Dharma Protocol contracts pre-installed.

This requires that we install Ganache-CLI first, which sometimes requires extra permissions (depending on your computer's setup).

Note: There is no strict requirement to use our blockchain setup - if you like, you can do all of your development against Kovan, where our contracts are deployed. The preconfigured local blockchain is just for quicker development.

If you're having trouble with running the local blockchain, I would consult the Ganache-CLI setup page (https://github.com/trufflesuite/ganache-cli) and try to get that running first, and then try running yarn blockchain in your relayer project again.

If you're comfortable doing so, then to get around the permissions problem you might end up using your computer's "root" permissions to install Ganache-CLI, by running:

sudo npm install -g [email protected].

FAQ

What is Dharma?

Dharma is a suite of developer tools and infrastructure that make it easy to build blockchain-based lending applications. Read more here.

What is a Dharma Relayer?

A Relayer is a source of liquidity on the Dharma network. It connects borrowers with lenders.

You can think of it as a bulletin board where individuals connected on the Internet can post requests to borrow money.

Why start a Dharma Relayer?

We imagine a world in which the majority of financial transactions occur on globally accessible blockchains.

In this new world, being a Relayer is akin to an early internet entrepreneur, providing a valuable service on the frontiers of the new economy.

How does a Dharma Relayer make money?

Relayers earn a fee every time a loan is filled on their site. The fee is some percentage of the principal amount as determined by the Relayer. Once the transaction has been recorded on the blockchain, the Dharma protocol automatically transfers the fee to the Relayer's address.

Are there existing Dharma Relayers?

While starting a Relayer is an intrepid task, you won't be alone. Bloqboard launched earlier this year and has since gone on to raise a round of financing from esteemed investors in the crypto space.

Are all Dharma Relayers the same?

We envision the Dharma ecosystem supporting many relayers — with individual relayers developing brands associated with their particular area of focus or domain expertise.

For example, a Relayer could specialize in micro-finance, venture debt, or margin trading.

While these markets might be modest today — over time, more and more financial transactions will take place on the blockchain, offering more and more opportunity for Relayers to grow their businesses.

What is the approval process for becoming a Dharma Relayer?

There is no approval process for launching a Dharma Relayer. You can launch whenever you want. Dharma is live on the Ethereum mainnet today.

What technical skills are required to operate a Dharma Relayer?

To build a Relayer, the only programming language necessary is JavaScript.

Do I need to conform to any specific branding when launching a Dharma relayer?

In designing the Relayer Kit, we intentionally left out any opinionated branding so that you, the entrepreneur, can conceive of and implement your own brand.

We imagine there being many relayers, each differentiated by the market they serve and the brand they build.

About

Start your own crypto business with the Dharma Relayer Kit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.6%
  • HTML 1.4%
  • CSS 1.0%