Liking cljdoc? Tell your friends :D

Social Wallet API

software by Dyne.org

Intro | Building | Prerequisites | Running | Acknowledgements | Licence | change log

Intro

This software is made to facilitate the integration of blockchain functions into existing front-end applications, providing an easy backend of documented REST API endpoints that are validated and, in case of error, report meaningful messages.

Build Status Clojars Project Freecoin project stats

This REST API interface is so far meant for low-level access of wallets built using the Freecoin toolkit.

Freecoin.dyne.org

The Social Wallet API allows to make calls to mongo and to running blockchain nodes that are compatibile with Bitcoin Core and support the generic Bitcoin RPC.

Building the Social Wallet API on your own computer

The Social Wallet API is written in Clojure and is fully cross-platform: one can run it locally on a GNU/Linux machine, as well on Apple/OSX and MS/Windows.

Prerequisites:

Please install

  1. A JDK. The software is tested on openJDK versions 7 and 8 as well as with oracleJDK 8 and 10. Make sure that the env var JAVA_HOME is set to the JDK install dir like mentioned here.
  2. MongoDB community edition. The software has been tested on Mongo v3.6.4. Earlier versions might not work due to loss of precision (Decimal128 was not introduced).
  3. leiningen which is used for dependency management like:
mkdir ~/bin
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein -O ~/bin/lein
chmod +x ~/bin/lein

For instance on Devuan systems one can install all necessary dependencies using apt and the following packages: apt-get openjdk-7-jdk libversioneer-clojure haveged.

Running the Social Wallet API

First of all check the configuration in resources/social-wallet-api.yaml and adjust its contents to your setup. Here an example complete with comments:

# verbosity level of messages
log-level: debug

# open freecoin specific section
freecoin:
# indentation matters: mind the initial spaces of following sections
  # If an apikey is added to the config, for that particular installation an apikey will be created, stored and required with every request. Device-id should be replaced with the device/client-app name/id.
  apikey: device-id
# configuration for the database holding local transactions
  mongo:
    host: localhost
    port: 27017
    db:   freecoin
    currency: Commoncoin # You can set this to the name of the local currency to be used on the DB

# configuration of the 'faircoin' blockchain
  faircoin:
# visualised name of the currency
    currency: fair
# number of confirmations to consider a transaction as valid
    number-confirmations: 6
# frequency of confirmations checks in milliseconds
    frequency-confirmations-millis: 20000
# path to the rpc configuration holding username and password
    rpc-config-path: /home/user/.faircoin2/faircoin.conf
# deposit to an address watch expiration time in milliseconds
    deposit-expiration-millis: 3600000
# frequency of deposit checks in milliseconds
    frequency-deposit-millis: 60000

# configuration of the 'bitcoin' blockchain
  bitcoin:
# visualised name of the currency
    currency: btc
# number of confirmations to consider a transaction as valid
    number-confirmations: 6
# frequency of confirmations checks in milliseconds
    frequency-confirmations-millis: 20000
# path to the rpc configuration holding username and password
    rpc-config-path: /home/user/.bitcoin/bitcoin.conf

Once correctly configured, from inside the social-wallet-api source directory one can use various commands to run it live (refreshing live changes to the code) using:

  • lein ring server (which will start and spawn a browser on it)
  • lein ring server-headless (will start without browser)

One can also use lein uberjar to build a standalone jar application, or lein uberwar to build a standalone war application ready to be served from enterprise infrastructure using JBoss or Tomcat.

TODO

  • Multicurrency on the DB

Acknowledgements

The Social Wallet API is Free and Open Source research and development activity funded by the European Commission in the context of the Collective Awareness Platforms for Sustainability and Social Innovation (CAPSSI) program. Social Wallet API uses the underlying Freecoin-lib blockchain implementation library and adopted as a component of the social wallet toolkit being developed for the Commonfare project (grant nr. 687922) .

License

Social Wallet API is Copyright (C) 2017 by the Dyne.org Foundation

This software and its documentation are designed, written and maintained by Denis Roio jaromil@dyne.org and Aspasia Beneti aspra@dyne.org

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close