Apiwallet - Running as a Java Application

Set up Apiwallet as a java application

1 Download the installation file from Apiwallet Releases

curl  ... /apiwallet.0.5.0.zip

2 Unpack and install the package in you local file system, e.g.

unzip apiwallet.0.5.0.zip
mv apiwallet.0.5.0 ~/bin/
export PATH=~/bin/apiwallet.0.5.0/bin:$PATH

3 Register to use strawpay as issuer and get an auth value.

4 Prepare a directory where your wallet files are stored. This is where your .wallet file will be stored. This file includes your bitcoin keys and if it is lost it means your funds are lost to. In this example:

mkdir /Users/me/wallets

5 Configure the wallet by updating the apiwallet.conf in conf directory:


include classpath("application.conf")

apiwallet {
  stroem.issuer.auth = <auth-value>
  wallet.dir = "/Users/me/wallets"
  console.enable = true

The wallet will listen for http requests at 9000 which is defined in the included application.conf java resource. The console is enabled to receive commands from the command line.

This example shows how to change the port to 8001, and change the issuer configuration and the bitcoin network to so the testnet blockchain is used,

include classpath("application.conf")

apiwallet {
  http.port = 8001

  stroem.issuer {
   auth = <auth-value>

   // development issuer runs on testnet
   name = dev.strawpay.com  
   address = stroem.dev.strawpay.com

  // use bitcoin testnet
  wallet.network = test

  wallet.dir = "/Users/me/wallets"
  console.enable = true

This file format is typesafe config's HOCON. It is also possible to use system properties or environment variables to configure the Apiwallet. See Configuration section for more detailed information and application.conf for descriptions of each config setting.

6 Logging. If you want to use the console interface as enabled above with console.enable=true you probably want to configure the logback.xml file to switch off logging on the console by updating the logback.xml in conf directory (or define your own logback file elsewhere).

E.g. in the logback.xmlfile, comment out the "stdout" appender in the <root> element:

    <root level="warn">
        <appender-ref ref="file" />
        <!--<appender-ref ref="stdout" />-->

7 Running the wallet from command line.

starting InitializerHttpService

8 When there is no existing wallet a new wallet is first initialized. The wallet can generate its secret keys from an initial random value or you can supply a seed. Follow the instructions in the Quick Start section to complete initialization.

9 After initialization or when starting with an existing wallet file, the Apiwallet will connect to peers to catch up with new blocks and transactions. It will start the HTTP API and console interface according to the configuration. For details on supported operations see API or CLI documentation.

Command line overrides

The apiwallet command is a start script which forwards system properties to the java process so that individual configurations can also be overridden when starting from the command line:

apiwallet -Dlogback.configurationFile=other_logback.xml

apiwallet -Dapiwallet.wallet.dir=alt_wallet_dir

apiwallet -Dapiwallet.http.port=9010