{"id":37110599,"url":"https://github.com/hydroprotocol/hydro-sdk-backend","last_synced_at":"2026-01-14T13:08:48.421Z","repository":{"id":48426749,"uuid":"179268650","full_name":"HydroProtocol/hydro-sdk-backend","owner":"HydroProtocol","description":"Standalone backend SDK for dApps","archived":false,"fork":false,"pushed_at":"2022-05-16T18:56:38.000Z","size":209,"stargazers_count":17,"open_issues_count":2,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-25T09:39:46.902Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HydroProtocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-03T10:40:19.000Z","updated_at":"2024-03-09T04:15:33.000Z","dependencies_parsed_at":"2022-08-26T14:24:13.108Z","dependency_job_id":null,"html_url":"https://github.com/HydroProtocol/hydro-sdk-backend","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"purl":"pkg:github/HydroProtocol/hydro-sdk-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroProtocol%2Fhydro-sdk-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroProtocol%2Fhydro-sdk-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroProtocol%2Fhydro-sdk-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroProtocol%2Fhydro-sdk-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HydroProtocol","download_url":"https://codeload.github.com/HydroProtocol/hydro-sdk-backend/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HydroProtocol%2Fhydro-sdk-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T13:08:47.798Z","updated_at":"2026-01-14T13:08:48.413Z","avatar_url":"https://github.com/HydroProtocol.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hydro SDK Backend\n\n[![CircleCI](https://circleci.com/gh/HydroProtocol/hydro-sdk-backend.svg?style=svg)](https://circleci.com/gh/HydroProtocol/hydro-sdk-backend)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hydroprotocol/hydro-sdk-backend)](https://goreportcard.com/report/github.com/hydroprotocol/hydro-sdk-backend)\n\nThe Hydro SDK is a collection of golang language packages.\nYou can use it to build a Dapp application backend based on the Hydro contract quickly. \nIt can help to communicate with Ethereum node, match orders, monitor Ethereum results and so on. \nSome general data structures are also provided.\n\nThis project cannot be used alone.\nYou need to add your own application logic. \nThe following projects are built on top of this SDK.\n\n- [hydro-scaffold-dex](https://github.com/hydroprotocol/hydro-scaffold-dex) \n- [hydro-augur-scaffold](https://github.com/hydroprotocol/hydro-augur-scaffold) (working in progress)\n\n## Break down to each package\n\n### sdk\n\nThe main function of this package is to define the interface to communicate with a blockchain.\nWe have implemented Ethereum communication codes based on this interface spec.\nSo as long as the interface is implemented for a blockchain, \nhydro SDK backend can be used on top it.This makes it possible to support multi-chain environments easily.\n\n### common\n\nWe put some common data structures and interface definitions into this package for sharing with other projects.\n\n### engine\n\nThe engine maintains a series of market orderbooks. \nIt is responsible for handling all placing orders and cancel requests. \nRequests in each market are processed serially, \nand multiple markets are concurrent.\n\nThe engine in this package only maintains the orderbook based on the received message \nand returns the result of the operation. \nIt is not responsible for persisting these changes, \nnor for pushing messages to users. \nPersistent data and push messages are business logic and should be done by the upper application.\n\n\n### watcher\n\nBlockchain Watcher is responsible for monitoring blockchain changes. \nWhenever a new block is generated, \nit gets all the transactions in that block. \nAnd pass each transaction to a specific method to deal with. \nThis method requires you to register with the `RegisterHandler` function. \nYou can process the transactions you are interested in as needed and skip unrelated transactions.\n\n### websocket\n\nThe Websocket package allows you to easily launch a websocket server. \nThe server is channel based.\nUsers can join multiple channels and can leave at any time.\n\nThe websocket server should have a message source. \nEvery message read from the source will be broadcast to that channel.\nAll users in the channel will receive this message.\n\nIf you want to make some special logic and not just broadcast the message.\nThis can be done by creating your own channel. \n\nAny structure that implements the IChannel interface can be registered to the websocket server.\n\nThere are already a customized channel called `MarketChannel` in this package. \nIt keep maintaining the newest order book in memory.  \nIf a new user joins this channel, \nit sends a snapshot of current market order book to the user.\nAfter receive a new event from source, \nit will update the order book in memory, \nthen push the change event to all subscribers.\n\n```golang\nimport (\n    github.com/hydroprotocol/hydor-sdk-backend/common\n    github.com/hydroprotocol/hydor-sdk-backend/websocket\n)\n\n// new a source queue\nqueue, _ := common.InitQueue(\u0026common.RedisQueueConfig{\n    Name:   common.HYDRO_WEBSOCKET_MESSAGES_QUEUE_KEY,\n    Ctx:    ctx,\n    Client: redisClient,\n})\n\n// new a websockert server\nwsServer := websocket.NewWSServer(\"localhost:3002\", queue)\n\nwebsocket.RegisterChannelCreator(\n    common.MarketChannelPrefix,\n    websocket.NewMarketChannelCreator(\u0026websocket.DefaultHttpSnapshotFetcher{\n        ApiUrl: os.Getenv(\"HSK_API_URL\"),\n    }),\n)\n\n// Start the server\n// It will block the current process to listen on the `addr` your provided. \nwsServer.Start()\n```\n\n## License\n\nThis project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhydroprotocol%2Fhydro-sdk-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhydroprotocol%2Fhydro-sdk-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhydroprotocol%2Fhydro-sdk-backend/lists"}