# SteemJ Dev Diary #1 (01.01.2018) - CryptoCore and code cleanups.

SteemJ Dev Diary #1 (01.01.2018) - CryptoCore and code cleanups.


SteemJV2Logo


Latest SteemJ 0.4.x releases: 0.4.3 v0.4.2 v0.4.2pr1 v0.4.1 v0.4.0

SteemJ Dev Diary #1 (01.01.2018) - CryptoCore and code cleanups.


Hello Steemians and a happy new year to all of you!

As you may have noticed, HF 0.20 will come soon and SteemJ needs to be prepared for that. Due to that I've decided to start a Dev-Diary for the next 7 days, meaning that I will post the work of the day every afternoon. This allows you to be well informed about the current development and upcoming changes and it allows me to get your feedback =).

HF 0.20 is near!

Nearly two weeks ago the Steem team announced that we can expect a first release candidate of HF 0.20 in the near future. While I am already more than exited about the upcoming changes, those kind of announcements also mean a lot of work for me, as the API may change and SteemJ has to be adjusted.

Beside that the situation also changed a little bit, as real projects like @steemitworldmap , @newsrx or @gamedevers are using SteemJ to realize their ideas. Because of that the target is to provide a SteemJ version compatible with HF 0.20 pretty soon after the official release.

What will change with HF 0.20?

Most of those changes are way to technical to be announced in an official update post, so the only way to get those information is to clone and analyze the official Steem development branch.

For sure I can't know exactly which changes will be included in HF 0.20 and which are already for HF 0.21, but even adding parts of HF 0.21 to SteemJ it will not hurt I guess :P

Focusing on the APIs and Operations I've noticed the following changes on the Steem development branch:

  • A code cleanup and package restructuring
  • API calls now have an "args" and a "return" object
  • Some APIs/Methods have been removed
  • Some Operations are no longer available

Beside that SMT (Smart Media Tokens) are already included in the code, but they will be part of HF 0.21 for sure, so we will not care about them for now.

While I totally love to see the code cleanup and restructuring which SteemJ will adopt for sure, I am a little bit worried about the "args" and a "return" objects. If you are wondering how an API call will look like when those objects are used, here is an example:

verify_signatures_return verify_signatures( const verify_signatures_args& args )const;

struct verify_signatures_args
{
   fc::sha256                       hash;
   vector< signature_type >         signatures;
   vector< account_name_type >      accounts;
   authority::classification        auth_level; //owner, active, posting
};

struct verify_signatures_return
{
   bool valid;
};

(Taken from Steem #1674

So the API call 'verify_signatures' now expects an 'verify_signatures_args' object and will return an 'verify_signatures_return' object. For SteemJ this change means that for every API call two new wrapper objects have to be written, documented and tested.

My personal target here is to avoid that you, as a SteemJ user, will need to change to much of your code, so I will only use the "args" and a "return" objects internally and there won't be a lot changes in the method signatures of the 'SteemJ' class

The Roadmap Target

Those of you who follow the SteemJ project a little bit longer may know that there are some pretty old issues about the following problems:

  • Unsiged numbers
  • JavaDoc for model objects
  • Some missing api calls

I want to use the whole restructuring to also tackle those issues and to clean up all old design flaws. Due to that I can't give you a real roadmap right now as I have to change a lot of stuff in parallel. At least I can share my final vision for version 0.5.0 of SteemJ with you.

  • The version should finally implement all available API methods while respecting the new package structure.
  • All API methods should be available and wrapped by the SteemJ class.
  • The code coverage should be increased to 70%.
  • No longer supported methods, operations and code should be removed.
  • No longer depend on bitcoinj and use Crypto-Core instead.


Attention
Source: beyondthehorizon.com.pk

Due to this dairy I commit the state of each day. This means that there might be times where tests will fail or even compile errors. I will for sure raise the code quality again before releasing the final version.

For those who are interested in a stable branch of SteemJ I've created a 0.4.x branch: https://github.com/marvin-we/steem-java-api-wrapper/tree/0.4.x

Beside that the master branch is currently running against the official Steem Dev environment (https://api.steemitdev.com) and will not work against Endpoints running HF 0.19.

Changes during day #1

  • IS#188 Create a "setIfNotNullWithDefaultValue" method
  • IS#192 Implement a "setIfNotNull" without a message
  • IS #187 Move the "setIfNotNull" to SteemJUtils
  • IS #189 Move "createPermlinkString" to CondenserUtils
  • PR #184 Remove dot in account name when building the permlink for comments (A big thanks to oroger for submitting this pull request)
  • IS #156 Change package structure to the one used with HF 21
  • IS #171 Clean up "SteemApiType" and remove those who are no longer available
  • IS #157 Remove support of *_callback methods
  • IS #176 Remove get_mining_queue method as it will no longer be supported
  • IS #170 Switch from bitcoinj to crypto-core

A list of all commits made after the last release can be found here: https://github.com/marvin-we/steem-java-api-wrapper/compare/v0.4.3...master

(A prove that the commits have been made by me can be found here)

General information

What is SteemJ?

SteemJ is a project that allows you to communicate with a Steem node using Java. So far, the project supports most of the API calls and is also able to broadcast most of the common operation types. Further information can be found on GitHub.

https://github.com/marvin-we/steem-java-api-wrapper

Quick Start Guide

Add SteemJ to your project

SteemJ binaries are pushed into the maven central repository and can be integrated with a bunch of build management tools like Maven. The Wiki provides a lot of examples for the most common build tools. If you do not use a build management tool you can download the binaries as described here.

To add this release to your project paste the following snippet into your 'pom.xml'

<dependency>
    <groupId>eu.bittrade.libs</groupId>
    <artifactId>steemj-core</artifactId>
    <version>0.4.3</version>
</dependency>

Start posting

SteemJConfig myConfig = SteemJConfig.getInstance();

myConfig.setDefaultAccount(new AccountName("YOUR-ACCOUNT"));

List<ImmutablePair<PrivateKeyType, String>> privateKeys = new ArrayList<>();
privateKeys.add(new ImmutablePair<>(PrivateKeyType.POSTING, "YOUR-PRIVATE-POSTING-KEY"));

myConfig.getPrivateKeyStorage().addAccount(myConfig.getDefaultAccount(), privateKeys);

steemJ.createComment(new AccountName("steemj"), new Permlink("testofsteemj040"), "Example comment without no link but with a @user .", new String[] { "test" });

Further information

The sample module of the SteemJ project provides showcases for the most common acitivies and operations users want to perform.

Beside that you can find a lot of snippets and examples in the different Wiki sections.

Contribute

The project became quite big and there is still a lot to do. If you want to support the project simply clone the git repository and submit a pull request. I would really appreciate it =).

git clone https://github.com/marvin-we/steem-java-api-wrapper.git

Get in touch!

Most of my projects are pretty time consuming and I always try to provide some useful stuff to the community. What keeps me going for that is your feedback and your support. For that reason I would love to get some Feedback from you <3. Just contact me here on Steemit or ping me on GitHub.

H2
H3
H4
3 columns
2 columns
1 column
10 Comments