Giter Club home page Giter Club logo

hydro-sdk's Introduction

Hydro SDK

This repository will guide you through setting up your own Hydro Relayer on the Ethereum blockchain. With a simple docker-compose command, you can have a fully functional Hydro Relayer running on your local server.

Hydro SDK consists of two parts. This repository describes how to use them together, but does not contain any code. If you want to dig into the code, please move to the corresponding repositories for more details:

What is a Hydro Relayer?

Hydro Protocol is an open sourced framework for building decentralized cryptocurrency exchanges. Hydro Relayers are decentralized exchanges that utilize the Hydro system for processing trades.

Who is this for?

This SDK is for anyone interested in starting their own Hydro Relayer.

Why use Hydro?

Hydro Protocol is an extremely powerful yet simple decentralized exchange protocol. Hydro Relayers offer the most advanced, efficient, and powerful form of decentralized trading.

This SDK makes setup extremely easy for new relayers to get started. Without the need to write, audit, and refine your own smart contracts or write your own backend, you can simply style the frontend and add whatever additional feature you may like.

The native token for Hydro Protocol is completely opt-in - you are not required to hold, collect fees, or force users to use the Hydro Protocol Token to run a Hydro Relayer.

web-screen-shot

How do I start a local relayer?

  1. As a prerequisite, you must have docker and docker-compose installed.

    If not, you can follow this link to install them.

  2. Clone this repo

    git clone https://github.com/hydroprotocol/hydro-sdk.git
    
  3. Change working dir

    cd hydro-sdk
    
  4. Start

    docker-compose pull && docker-compose up -d
    

    This step may takes a few minutes to prepare all envs. When complete, this will start all necessary services in docker.

    It will use ports 3000, 3001, 3002, 6379, 8545 on your computer. Please make sure these ports are available. *Note - For Windows 10 Home edition, you will need to do some port forwarding for all of the above in your VirtualBox Manager (Settings -> Network -> Port Forwarding -> add the above to host and guest ports)

  5. View Relayer

    Open http://localhost:3000/ on your browser. Proceed to the next step to use your Relayer.

  6. Setup wallet and address

    1. Install metamask wallet

      Currently, we only support metamask as your wallet. If you have metamask installed, please move to the next section.

      • For Chrome Download.
      • For Firefox Download
      • For Brave, metamask is built-in. You can enable it at about:preferences#extensions.
    2. Setup network

      The default network of metamask is mainnet. We will use localhost to test for now.

      Open the metamask extension and switch the network to localhost:8545

    3. Import an account

      We have already prepared an pre-filled address for you. The private key is 0xb7a0c9d2786fc4dd080ea5d619d36771aeb0c8c26c290afd3451b92ba2b7bc2c, address is 0x31ebd457b999bf99759602f5ece5aa5033cb56b3.

      Import the private key into your metamask then switch to this account.

    4. All set

      Now you are free to play around with hydro-sdk-web on http://localhost:3000/.

  7. Launch a simple maker bot

    Run the following command in another terminal. It will start a simple order maker to fill the orderbook of HOT-DAI market. You will see a live exchange in your browser now.

    docker run --rm --net host hydroprotocolio/hydro-sdk-backend:latest maker
    
  8. Get status

    docker-compose ps
    

    This will show each service running status.

  9. View logs

    # view logs of the service that defined in docker-compose.yml services
    # e.g. view watcher log
    docker-compose logs --tail=20 -f watcher
    # e.g. view api log
    docker-compose logs --tail=20 -f api
    

    This will show logs of the service which you point.

  10. Stop

    docker-compose stop
    

    This will stop all services.

How do I update to the latest?

  1. Update This repo

    git pull origin master
    
  2. Clean old state (data wil be deleted)

    docker-compose down -v
    
  3. Run

    docker-compose pull && docker-compose up -d
    

    Always pull latest images before docker-compose up (If image doesn't have new version, will not pull).

What comes with the SDK?

  • Frontend:
    • A Basic Exchange Web UI
  • Backend:
    • Http Server to serve API data
    • Websocket Server to handle keepalive connections and serve realtime data
    • Matching Engine to send matching orders to the hydro smart contract
    • Blockchain Monitor to watch for transaction changes on the blockchain
  • Sqlite3 as database
  • ganache-cli to run a local ethereum node

What is this SDK not?

  • A production ready product, this code is meant for demo purposes.
  • A standard around which you must design your relayer. This simply shows one possible design for a relayer that matches and submits orders to the Hydro smart contracts.

What's next?

Roadmap

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details

hydro-sdk's People

Contributors

davidqhr avatar swinges avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.