GENERALBYTESCOM / batm_public

BATM Public Repository
www.generalbytes.com
Other
99 stars 241 forks source link

Cardano ada - api integration #241

Closed ntfreem closed 5 years ago

ntfreem commented 5 years ago

IOHK would like to gain an understanding of what General Bytes needs to integrate ada wallet into their service.

Please let us know what api's you have tried to use and what was the result?

We are happy to find out more information and collaborate on integrating ada with your service.

rpanak-generalbytes commented 5 years ago

Hi, basically the best possible integration from our perspective is a Java library (like bitcoinj, dashj, etc.). If this is not available, there are lots of other possibilities. Basically, we expose a couple of interfaces for rate source (IRateSource), exchange (IExchange) and wallet (IWallet) implementations. If you want to enable bi-directional integration (i.e. sell on top of buy transactions), the interface to implement is IPaymentSupport. You just need to implement those interfaces. The more you implement, the more use cases can be handled with ADA. IWallet and IRateSource is the bare minimum (though easily extensible rate-source implementations are already present for CoinMarketCap, CoinGecko, CoinPaprika, and others) for buy support.

Some extensions act just as a proxy for the code where the real logic lies:

There are sample integrations available inside this repo that are used in production. As long as you are implementing the needed interfaces, you are free to use almost whatever you'd like as long as your code is reasonable with regards to security, resource consumption (memory, network, CPU), etc.

As ADA is not on the top of our priority list, we haven't tried any APIs. However, IOHK or anybody else is free to implement their own extension and commit it back to our public repository making the integration available to all our users after a new version gets released.

rpanak-generalbytes commented 5 years ago

Closing for no activity in 2 weeks. Feel free to reopen if needed.

ghost commented 4 years ago

Can we reopen this?

rpanak-generalbytes commented 4 years ago

As already stated ADA is not on the top of our priority list. However, anyone is welcome to implement support for ADA. Regarding the information on how to do this, see one of the previous responses. If the implementation is still not clear, please ask a more specific question.

xdzurman commented 4 years ago

@rpanak-generalbytes Hello,

other wallets (e.g. BitGo) communicate with a remote server over HTTPS/REST (i.e. a REST call directly, although it's not that big of a difference than the previous case with the wrapper library).

Concerning actions which use private keys / passphrases, etc., how does this approach handle security? Do the private keys get sent over REST APIs?

rpanak-generalbytes commented 4 years ago

Depends on the respective service. The text you quote is about web wallets (exchanges, etc.). Those might not even give the user the private key for his wallet. Usually the user is given a set of credentials (API key, API secret) to authenticate against the API, not the private key itself.

xdzurman commented 4 years ago

@rpanak-generalbytes There's no "Java library (like bitcoinj, dashj, etc.)" or "RPC client library", but there is a REST API. However, building/signing a transaction would require the private signing key of the account or wallet master passphrase.

As only this repo is open-source, we assume that you could run a cardano node and wallet processes on some server (we would guide you through it), and our job would be to implement the interfaces which would communicate with your server, correct?

If you ran this node and wallet, what is the internal functioning of the ATM? Do you have an admin wallet for each cryptocurrency, from which you send funds to your customers? Or do customers "log in" their wallets?

Also where do tokens such as _bitgo:host:port:token:wallet_address:walletpassphrase come from? Do you think we could find a more active form of communication through a chat or something similar so that I can explain more easily?

MichalPetro commented 4 years ago

@rpanak-generalbytes Hello, quick question - I see you have integration with some exchanges that have ADA trading possibilities. Would it be possible to use for example Kraken account as the "wallet" for Cardano and use API calls to send ADA from Kraken account to ATM customers?

ghost commented 4 years ago

You cannot currently withdraw directly from Kraken to a customer's hot wallet using the API. There are a few different buy strategies available in the Bitcoin ATM CAS system:

-1 - No buying at all. The feature will not be available on this Terminal. 0 - No Purchase on the Exchange. Send coins to a customer from the Hot Wallet. 1 - Purchase coins from an Exchange and send them directly to a customer from the Exchange. 2 - Send coins to a customer from the Hot Wallet. After that, purchase coins on the Exchange and if the purchase is successful, send these coins to the Hot Wallet. 3 - (Preferred) Use strategy 2, fallback to strategy 1 if the Hot Wallet has insufficient funds. 4 - Send coins to a customer from the Hot Wallet. After that, purchase coins on the Exchange and leave them there. 5 - Send coins to a customer from Exchange without purchase on Exchange.

Unfortunately, there is no chance to run strategy 1 with Kraken. Maybe this is possible with Bittrix?

We use number 4 with Kraken – “send coins to customer from the hot wallet, After purchasing on coins on the exchange and leave them there”. It’s not required to mirror purchases on the exchange so Number 0 would also work for us with Ada if we had a hot wallet that was supported.

https://generalbytes.atlassian.net/wiki/spaces/ESD/pages/968720388/Crypto+Settings?search_id=15abf071-b78f-4727-b17b-a66faa9fb649

ghost commented 4 years ago

Bittrex could be an option for strategy - 1 - Purchase coins from an Exchange and send them directly to a customer from the Exchange. The Bittrex API supports automatic withdraws to an address.

https://generalbytes.atlassian.net/wiki/spaces/ESD/pages/1002668075/Exchange+Bittrex