BATM Public Repository - Open Extensions
This repository contains Bitcoin ATM related code used in BATMTwo, BATMThree, BATM Server (CAS) products.
More information about the products can be found here: https://www.generalbytes.com
All source code is released under GPL2.
Operators frequently request new features to be added to our BATM Server (CAS). Typically, the requests are for adding support for "crypto currency XYZ" or "digital asset exchange XY".
The purpose of this project is to give operators the desired power to add features themselves by extending CAS via this published Extensions mechanism.
Our software is written in Java and any Java developer may be recruited to create/implement these extensions. No unusual qualifications are required.
When the CAS services are started, they scan the
/batm/app/master/extensions/ folder for all files that have the ".jar" extension.
CAS then parses any "batm-extensions.xml" found in the JAR file to enumerate the extensions present within the JAR package.
Extension is a high level component - something like a plugin - that encapsulates and instantiates the rest of the features.
Extension can be asked to provide wallet X for currency Y etc. The best way to learn more about extensions is to read the sample code and examine how other people have implemented support for their wallet or cryptocurrency in the server_extensions_extra module. Additional examples can be found here.
Here is the list of some functionality that can be extended using Extensions API:
- Implement support for different cryptocurrency wallets - for more information, see the IWallet interface.
- Implement support for different cryptocurrency exchanges - for more information, see the IExchange interface.
- Implement support for different cryptocurrency rate tickers - for more information, see the IRateSource interface.
- Implement support for different cryptocurrency payment processors - ( payment processor is a company that processes payments for you. For more information, see the IPaymentProcessor interface.
- Implement support for payments by your cryptocurrency - for more information, see the IPaymentSupport interface.
- Implement support for different terrorist watch lists - for more information, see the IWatchList interface.
- Implement support for a different AML provider - for more information, see the IAMLProvider interface.
- Perform actions whenever a transaction on CAS is created or updated - This is useful; for example, in those locales where you may need to notify the tax office about the transaction in realtime and print a unique tax office onetime id on the ticket printed by the BATM. For more information, see the ITransactionListener interface.
- Implement a paper wallet generator for your crypto currency XYZ - Do you want your BATM to be able print a paper wallet or write the transaction's private key on an NFC card? You will need to implement this interface. For more information, see the IPaperWalletGenerator interface.
- Implement a fiat-to-fiat currency exchange rate provider - Do you want CAS to use the fiat currency exchange rates provided by your local bank (or exchange) instead of the international market? For more information, see the IFiatExchangeRateProvider interface.
- Send emails or SMSes from extension - To notify your customer via SMS or email with custom messages, call the methods exposed by the IExtensionContext interface.
- ExtensionContext is your main entrypoint for interacting with CAS. ExtensionContext may be called from any extension. A reference to ExtensionContext is passed to an Extension when the init method is called by CAS on any Extension. Please make sure you read all of the methods that are available on the IExtensionContext interface. There are, for example: cash related operations, sell functionality, and more!
- Implement RESTful services - facilitates integration of the Server with a 3rd party system. Extensions enable you to quickly and easily create a RESTful service that sends/receives data via JSON and HTTPS. Do you want your website to contact CAS to find the current exchange rate on your BATM (or even more complicated functions)? Use IRestService for that. A simple example that returns your current CAS version can be found here.
- Implement ChatBot commands - Do you need to execute some tasks on server by sending message to server via Telegram Messenger? Simply implement Telegram your command and you are ready to go. A simple example that returns your current CAS version can be found here.
- server_extensions_api - contains the extension API that all extensions use to extend CAS' functionality.
- server_extensions_extra - reference extension implementation that demonstrates BTC, LTC, CLOAK, DGB, DASH, POT, VIA, BTX, SYS, FLASH, DOGE, NLG, ICG, NBT, GRS, MAX, BSD, MEC, BTDX, SUM, BURST, ECA, LINDA, $PAC, DAI, MKR, BAT and REP coin support functionality.
- server_extensions_test - contains tester for testing the extensions (CAS not required).
Note for developers
- Linux is required in order to run compilers and tests.
When you implement support for a new crypto-coin, please add it to server_extensions_extra - so that it may get into the default CAS installation pack for customers. Please use the appropriate Fork and Pull Request in the GitHub workflow when adding new functions, and bear in mind that your code will be reviewed prior to any merge with the master.
When adding new cryptocurrency support, please remember to provide it's logo! This logo will later be downloaded by the BATM from CAS and displayed on the BATM screen. Both SVG and PNG logos are supported; however, only the SVG logo is used on newer BATM versions. A PNG logo is offered only for backward compatibility, and in the few cases where the SVG logo has an unusually large size. SVG logos must comply with following rules:
- SVG logos should not contain filters or bitmap images
- All SVG and PNG logos should be 120 x 120px. See other logos for examples.
- Preserve the unified BATM design: every SVG logo must contain the background from template.svg. An example background can be found here.
After you implement the the extension make sure you test it with "Tester" (which you will find in server_extensions_test). If you want to implement an extension that you don't want to share with the rest of the world, then create a separate module (e.g. server_extensions_mycompany) and use a different jar name (server_extensions_mycompany.jar).
./gradlew build cp server_extensions_extra/build/libs/batm_server_extensions_extra.jar /batm/app/master/extensions/
Note that on startup, CAS scans the:
/batm/app/master/extensions/ folder for all files that have the .jar extension.
How to run Tester
./gradlew :server_extensions_test:install ./server_extensions_test/build/install/server_extensions_test/bin/server_extensions_test