Skip to content

SteemJConfig

dez1337 edited this page Aug 6, 2017 · 22 revisions

SteemJ comes with a common default configuration if you instantiate it which may not always fit your needs. This page describes which parameters can be changed and how the SteemJConfig works.

TOC

SteemJ is shipped with a default configuration that has been tested and that should allow you to execute all activities out of the box. For the case that this default configuration does not fit your needs you can find all required information in the following chapters to change it.

Before you continue to read you need to know one additional thing: SteemJConfig is Singleton, which means that there is only one existing instance per application. While this feature does not allow to define different configurations for different threads, it makes it unnecessary to pass the configuration object to every single method.

The following command shows how to get the currently used SteemJConfig-Instance.

[...]
SteemJConfig myConfig = SteemJConfig.getInstance();
[...]

Back to TOC

Configuration Examples

The following chapters explain and show the available configurations.

Steem Node Endpoint

By default, SteemJ connects to the official Websocket Endpoint of the Steemit Node (wss://node.steem.ws). This configuration is adequate for most usecases as the most common plugins are enabled. However, the following example shows how to connect to another Steem Node.

try {
        myConfig.setWebsocketEndpointURI(new URI("wss://this.piston.rocks"));
} catch (URISyntaxException e) {
        throw new RuntimeException("The given URI is not valid.", e);
}

Back to TOC

Timeout

To avoid that unanswered requests block your application forever, SteemJ has a build in Timeout mechanism. By default the Steem Node has to answer in 1 second, otherwise a TimeoutException will be thrown. If you have a slow internet connection or working with a huge dataset you can increase the timeout like shown in the example below.

myConfig.setTimeout(100000L);

Or disale it completly.

myConfig.setTimeout(0L);

Back to TOC

Date Time Pattern

SteemJ needs to parse dates provided by the Steem Node. By default, the pattern "yyyy-MM-dd'T'HH:mm:ss" and the timezone "GMT" are used by SteemJ. If you connect to a node returning dates in another format or with another timezone, you need to change the datetime pattern by providing the new pattern and the new timezone as shown below.

myConfig.setDateTime("yyyy-mm-dd'T'HH:mm:ss", "UTC");

Back to TOC

Maximum Expiration Date

Back to TOC

Timezone

Back to TOC

Credentials

Back to TOC

Disable SSL Verification

Back to TOC

Private Keys

Back to TOC

Encoding Charset

Back to TOC

System Properties

SteemJ allows you to provide sensitive data as system properties.

Credentials

To provide credentials SteemJ should use to login into the node, you can use following parameters.

Parameter Description Example
steemj.api.accountName The username to login java -jar yourApp.jar -Dsteemj.api.accountName="dez1337"
steemj.api.password The password to login java -jar yourApp.jar -Dsteemj.api.password="secretPassword123"

Back to TOC

Private Keys

Beside your credentials you can also provide your keys through system properties.

Parameter Description Example
steemj.key.active The username to login java -jar yourApp.jar -Dsteemj.key.active="5JpbHHrEkoLsxNcddo5YaTgtmgDegTcjk8i7BDPiTbMefrPnjWK"
steemj.key.posting The password to login java -jar yourApp.jar -Dsteemj.key.posting="5J6a9B9H1rBC9XsxHUrv9Eu98cG4MaZPuaMk6LBfMSDGyk5SoiP"
steemj.key.owner The password to login java -jar yourApp.jar -Dsteemj.key.owner ="5JhxZZ6oGwFm2egPWyy21DWvroSoUur33sEHBamobDdSmhPN9U4"
steemj.key.memo The password to login java -jar yourApp.jar -Dsteemj.key.memo="5Hw3qRsC3f9yLtVazZpA8LyCUozBJq5aQv9tNNnz8fcg8BqoAWw"

Back to TOC

Clone this wiki locally