A mobile Bitcoin payment solution with NFC support.
sudo apt-get install openjdk-8-jdk
OS X and Windows: Oracle Java
git checkout git@github.com:coinblesk/coinblesk-shared-resources.git
cd coinblesk-shared-resources
./gradlew install
Run
./gradlew run
The service is available at http://localhost:8080/
You can inspect the database during development at
http://localhost:8080/h2-console (make sure you use the following database connection settings: jdbc:h2:mem:testdb
)and the REST endpoints at
http://localhost:8080/swagger-ui.html
To use the tesnet and postgres database locally, run:
BITCOIN_NET=testnet spring_datasource_url=jdbc:postgresql://localhost/coinblesk-dev?user=postgres gradle run
./gradlew assemble
Ready-to-run jar file is at build/libs/coinblesk-server-2.1.SNAPSHOT.jar
Run directly (jar is executable)
./coinblesk-server-2.1.SNAPSHOT.jar
or as jar with java
java -jar coinblesk-server-2.1.SNAPSHOT.jar
In production you probably want to use the production profile and set some additional sensitive configuration via environment variables:
SPRING_PROFILES_ACTIVE=prod \
BITCOIN_POTPRIVKEY=97324063353421115888582782536755703931560774174498831848725083330146537953701 \
SECURITY_JWT_SECRET=supersecret \
EMAIL_PASSWORD=hunter2 \
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost/coinblesk?user=fred&password=secret&ssl=true
java -jar coinblesk-server-2.1.SNAPSHOT.jar
The default configuration can be found with additional information in application.properties.
Some default settings for production environment is configured at application-prod.properties.
To enable prod settings start the application with the environment variable SPRING_PROFILES_ACTIVE=prod
All configuration can be overruled by setting the equivalent environment variables at runtime. For example bitcoin.net
can be set via a BITCOIN_NET
variable.
The following settings can be configured:
Variable | Description | Example |
---|---|---|
SERVER_PORT | Port on which application should run | 8888 |
SPRING_DATASOURCE_URL | Database JDBC path. For in memory database use "jdbc:h2:mem:testdb". h2 and postgres drivers are on the classpath. | jdbc:h2:mem:testdb |
LOGGING_LEVEL_ROOT | Sets the root logging level (WARN, ERROR, DEBUG, OFF...) | INFO |
COINBLESK_URL | The endpoint at which coinblesk api is available | https://coinblesk.ch/ |
COINBLESK_CONFIG_DIR | The folder at which to store SPV chain and wallet files | /var/coinblesk |
COINBLESK_DEFAULTAPIVERSION | The default API version to assume should the client not specify the version in the header. | /var/coinblesk |
COINBLESK_MINIMUMLOCKTIMESECONDS | Minimum lock time in seconds for newly created addressees | |
COINBLESK_MAXIMUMLOCKTIMEDAYS | Maximum lock time in days for newly created addresses | |
COINBLESK_CLOSESCHEDULERINTERVAL | Time in seconds between checks for closing soon unlocked channels. | 60 |
COINBLESK_MAXIMUMCHANNELAMOUNTUSD | Maximum amount in USD in a channel | 100 |
SECURITY_JWT_SECRET | The secret to use to sign JWTs. Should be long and complicated and always set via environment variable | kI34jxqkrPxv8qYxaQpx98... |
SECURITY_JWT_VALIDITYINSECONDS | Validity of JWT in seconds until expiration | 604800 |
SECURITY_JWT_ADMINVALIDITYINSECONDS | ... same for admin users | 3600 |
BITCOIN_NET | Which bitcoinnet to use: "mainnet", "testnet", "unittest" | testnet |
BITCOIN_FIRSTSEEDNODE | Which server to try to connect first. In testnet mode: This is the only server we connect to. | bitcoin4-fullnode.csg.uzh.ch |
BITCOIN_MINCONF | Number blocks for confirmations needed for a transaction | 1 |
BITCOIN_POTPRIVKEY | Privatekey in number format for the pot of the server. Keep this secret and only set by environment variable. A new one can be generated with new ECKey().getPrivKey() |
97324063353421115803931... |
BITCOIN_MICROPAYMENTPOTPRIVKEY | Privatekey in number format for the micro payment pot of the server. Keep this secret and only set by environment variable. | 19283019283019238012983... |
BITCOIN_POTCREATIONTIME | Creation time of the wallet pot in epoch seconds. Used for checkpointing optimization at initial chain download. | 1486638252 |
EMAIL_ENABLED | True / False. If the server should send out email. | True |
EMAIL_HOST | mail.smtp.host SMTP host see JavaMail API |
mail.office365.com |
EMAIL_PROTOCOL | mail.transport.protocol see JavaMail API |
smtp |
EMAIL_PORT | mail.smtp.port see JavaMail API |
587 |
EMAIL_AUTH | mail.smtp.auth Username/Password needed. see JavaMail API |
true |
EMAIL_STARTTLS | mail.smtp.starttls.enable Use STARTTLS see JavaMail API |
true |
EMAIL_DEBUG | mail.debug More email debug output. see JavaMail API |
false |
EMAIL_TRUST | mail.smtp.ssl.trust Trust self signed mail servers. mail.smtp.ssl.trust see JavaMail API |
false |
EMAIL_USERNAME | Username for smtp server if auth enabled | bob |
EMAIL_PASSWORD | Password for smtp server if auth enabled | supersecurepassword! |
EMAIL_ADMIN | Admin email address for warning related emails | admin@coinblesk.ch |
EMAIL_SENDFROM | Sender email for outgoing emails (account activation, password reset) | info@coinblesk.ch |