Giter Site home page Giter Site logo

cardano-foundation / cf-adahandle-resolver Goto Github PK

View Code? Open in Web Editor NEW
11.0 10.0 1.0 824 KB

This project aims to provide a scoped indexer for retrieving ADA Handle information from the Cardano blockchain and exposing it via REST using Yaci Store

License: MIT License

Java 94.13% Dockerfile 0.97% Smarty 4.91%
adahandle cardano indexer rest-api yaci-store

cf-adahandle-resolver's Introduction

ADA Handle Resolver

Tests Coverage Release Publish conventionalcommits Discord

This project aims to provide a scoped indexer for retrieving ADA Handle information from the Cardano blockchain and exposing it via REST using Yaci Store.

Why ADA Handle resolver?

One may ask why Ada Handle resolve if there is already: https://github.com/koralabs/handles-public-api

Ada Handler resolver by CF differentiates itself with a number of following traits:

  • it demostrates usage of Yaci-Store modular indexer
  • is written in Java, thus easier extendable and to easier to reason about by Java Developers
  • doesn't have any dependencies to other components, e.g. Ogmios, blockfrost, etc
  • handles db has very small on disk footprint
  • supports embedded DBs such as H2 for easier deployment

๐Ÿš€ Getting Started

๐Ÿณ Docker

docker run -p 9095:9095 cardanofoundation/adahandle-resolver:latest

๐Ÿชถ Maven

Prerequisites

Java 17

Build & Run

git clone https://github.com/cardano-foundation/cf-adahandle-resolver.git
cd cf-adahandle-resolver
./mvnw clean package
java -jar target/cf-adahandle-resolver-0.0.1-SNAPSHOT.jar

๐Ÿงช Test Reports

To ensure the stability and reliability of this project, unit tests have been implemented. By clicking on the link below, you can access the detailed test report.

๐Ÿ“Š Coverage Report

๐Ÿค– API Endpoints

Endpoint Description
http://localhost:9095/swagger-ui.html Swagger UI for the API endpoints
http://localhost:9095/api/v1/ada-handles/by-stake-address [GET]s the ADA Handle held by a given stake address
http://localhost:9095/api/v1/ada-handles/by-payment-address [GET]s the ADA Handle held by a given payment address
http://localhost:9095/api/v1/addresses/by-ada-handle/{adaHandle} [GET]s the stake and payment addresses behind a provided ADA Handle
http://localhost:9095/api/v1/ada-handles/by-payment-address [GET]s the payment address behind a provided ADA Handle

๐Ÿ‘ป Disable Indexer

If you intend to scale this service, running multiple instances of the API is advisable. However, you may not want a crawl job on every instance. To disable the indexer (yaci-store), utilize the disable-indexer profile as an environment variable.

SPRING_ACTIVE_PROFILES=disable-indexer java -jar target/cf-adahandle-resolver-0.0.1-SNAPSHOT.jar

๐ŸŒฑ Environment Variables

Possible profiles: mainnet, preprod, preview, local-node, h2, disable-indexer

Name Description Default Value
SPRING_ACTIVE_PROFILES The active profile of the application mainnet,h2
PORT The port on which the server will listen for incoming requests 9095
DB_URL The URL of the database jdbc:h2:mem:mydb
DB_USERNAME The username of the database user sa
DB_PASSWORD The password of the database user password
REMOTE_NODE_URL The URL of the remote node relays-new.cardano-mainnet.iohk.io
REMOTE_NODE_PORT The port of the remote node 3001
LOCAL_NODE_SOCKET_PATH The path of the local node socket <No default value>
LOCAL_NODE_HOST The host of the local node <No default value>
LOCAL_NODE_PORT The port of the local node <No default value>

cf-adahandle-resolver's People

Contributors

fabianbormann avatar github-actions[bot] avatar matiwinnetou avatar nemo83 avatar satran004 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

satran004

cf-adahandle-resolver's Issues

[FEATURE] Improve scalability and allow instance to run api only w/o the "crawler"

Is your feature request related to a problem? Please describe.
When launching the resolver, both api and yaci-store cralwer run at the same time. It's not possible to run api only AND two crawlers can't run against the same db w/o risking corrupting it or creating contention.

Describe the solution you'd like
Introducing profile to either:

  • disable crawler if desired default behaviour is to have it running
  • enable crawler if desired default behaviour is to have it NOT running

Describe alternatives you've considered
N/A

Additional context
N/A

[BUG] Allow or Ignore the '$' Sign in the Handle Name

It is very common to use the $ sign in front of the handle. So both endpoints:

  • /api/v1/addresses/by-ada-handle/the.glenlivet
  • /api/v1/addresses/by-ada-handle/$the.glenlivet

should return the same address. But currently only the fist one is working while the other results in a 404.

[FEATURE] Support for Spring Boot Starter

It is possible to run this as microservice but it would be nice if a more monolithic approach would be supported where as one could include ada handle related repositories and controllers via including simply a Spring Boot Starter dependency.

I am not sure if it is possible to support both systems, but it could be since then the actual microservice would just use only adahandle spring boot starter as a library...

[FEATURE] Enhance response and include info about sync status

Is your feature request related to a problem? Please describe.
Currently, there is no way for ada-handle resolver to know how old is the data we're returning as response.
This is dangerous as adahandle resolution to stale data could lead to funds sent to wrong addresses.

Describe the solution you'd like
We should add extra information to the response that give a sense of how fresh the response is.
A possible solution is to add the current observed tip/slot within the resolver.

Describe alternatives you've considered

  • error out is stale data (a bit extreme if you ask)
  • instead of showing last slot, maybe just a status=synced|stale|drifted|whatever

Additional context

[FEATURE] Add payment address of handle to the address endpoint

Currently the api only offers a way to get the stake address by providing an ADA handle "/api/v1/addresses/by-ada-handle/{adaHandle}" but we also need a way to resolve the payment address, as the payment address is needed in context of sending assets from one handle user to the other.

"/api/v1/addresses/by-ada-handle/{adaHandle}" should therefore return:

{
    "stake_address": "stake1...",
    "payment_address": "addr1..."
}

The current behavior is that the stake address will be returned in plain text and if the user did not register its stake address, the payment address will be returned, which is confusing anyways.

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.