Tutorial: Get the value of your steemit earnings, Part #1

in #steemdev7 years ago

With this post I start a little series that will show you how to get the value of your steemit earnings. This tool can simply be used for your personal interests or of course to create a template for reporting your steemit earnings for a financial office (as we need it in Germany for the tax office).

Note:
The created report is of course not an official document. It is just an idea on how to report your earnings!

The Mission

The requirements for the first part of this series are:

  1. Get the steemit earnings (STEEM, SBD, VESTS) for an account
  2. Create a HTML and CSV report

System Requirements

Visual Studio Code

For developing the program I used the free Code Editor "Visual Studio Code".
You can download it here: https://code.visualstudio.com/

nodeJS

As the runtime system for the program I used "nodeJS" (LTS version).
You can download nodeJS here: https://nodejs.org

Implementation

git repository

You can download the complete sources of this tutorial from my GitHub repository:
https://github.com/SchererF/steemit-earnings

using steemJS API

To get the values of your steemit rewards I used the steem.api.getAccountHistory() function of the steemJS API.

Get Account History

steem.api.getAccountHistory(account, from, limit, function(err, result) {
  console.log(err, result);
});

Source: https://github.com/steemit/steem-js/tree/master/doc

This function expects three parameter as input

  • The account name e.g. 'schererf'
  • The from numeric value: use -1 to get the newest values with the highest identifier first
  • The limit numeric value: the requested amount of data

Note:

  • The from is not -1 the value of limit always has to be greater or equal than from
  • The maximum value for limit is 10000

Because of the maximum value for limit you have to do several calls of the getAccountHistory function to get a complete list of operations for an account.

Example

Get the account history entry of account schererf that has the identifier 15626.

steem.api.getAccountHistory('schererf', 15626, 0, function(err, result) {
  console.log(JSON.stringify(result));
});



Result JSON object:

[[15626,
{"trx_id":"2af66774318058213dab404eb9016697a01f4139",
"block":19828301,
"trx_in_block":63,
"op_in_trx":0,
"virtual_op":0,
"timestamp":"2018-02-13T08:05:39",
"op":["claim_reward_balance",
{"account":"schererf",
 "reward_steem":"0.000 STEEM",
 "reward_sbd":"21.246 SBD",
 "reward_vests":"14086.296566 VESTS"}]}]]

This entry shows my rewards of 21.246 SBD and 14086.296566 VESTS that I have claimed on 2018-02-13 08:05:39.

There are different values for the Operation type (op) but to get the earnings we only need the entries of type 'claim_reward_balance'. I also included the entries of type 'transfer' for further evaluations.

Let's do it

Download the sources

Just go to my GitHub repository and Download ZIP
https://github.com/SchererF/steemit-earnings

Extract the downloaded zip to your preferred folder.

Open Node.js command prompt

Open the the "Node.js command prompt" and change to the folder of the extracted program.

Install the required packages of the program

For implementation I used several node packages :

  • steem: The steem JS API
  • fs: To create the output files
  • bluebird: Fully featured promises library
  • node-fetch: Brings 'window.fetch' to Node.js

Just execute the following command to install all required packages for the program.

npm install

Run the program

To run the program you just have to enter

node get-claimed-rewards.js "accountname"

(e.g.)
node get-claimed-rewards.js schererf

The program request all account history data for the specified account and creates a HTML and a CSV file as output.

Take a look at the output HTML

The created HTML uses the bootstrap-framework and looks like this.

By clicking on the "claim_reward_balance..." button you can see the JSON data of the underlying history entry.

Tutorial Preview

In the next parts of this little series we will have a look at how to get the Steem Power (SP) value for the VESTS reward and how to report the STEEM and SBD earnings as EUR/USD based on the historical exchange rate of the reward claim date.

Please give me feedback if this tutorial was helpful for you.

Thanks for reading and watching,
@schererf

Sort:  

But if we hold for one year it is tax free, right ?

In Germany you have to pay taxes at the moment that you claim your rewards as SBD/STEEM evaluated with the daily exchange rate to EUR because it's an income for the work you have done on steemit.

If you make profit on exchanging cryptocurrencies you don't have to pay taxes if you hodl the new currency for one year. This is because you start exchanging with an amount of EUR that has already been taxed.

Wow thanks + follow ! I didn't knew that... 👍 I hope I can use this, looks a bit complex for me...

Just ask if you have problems...

Just out of curiosity (having to pay taxes in Germany as well), where do you enter your steem earnings in your taxes? Do you treat them as "Gewinn freiberuflicher Tätigkeit"?

Thanks for sharing.

You're welcome. I'm glad you like this post :)

you mean you get taxed there in Germany for your Steemit earnings?

Just like in almost every other country? Of course your Steemit earnings have to be taxed :)

you might want to pay tax when you convert it into real-world physical money, but as long as it stays online-only i don't see any reason to pay anything in taxes

Of course, I can only speak for Germany because I do not know the tax laws of the other countries. But in Germany you have to pay taxes for everything that you earn. In the case of steemit you earn crypto SBD/STEEM by writing or curating posts. The steemit earnings have to be evaluated using the daily exchange rate to FROM SBD/STEEM to EUR and this EUR value increases your yearly income...

Yes of course. The steemit rewards are earnings and you have to pay tax for it.
Not nice but law ;-)

Hey @schererf, sorry I did not communicate with you since long time! First thanks for this tool!!! Second I will start working again in the animation in the weeks to come. The beginning of this year was a bit crazy for me and since one month have a lot of work for TV (means "do it for yesterday" works). Hope everything is ok with you and your family. Btw, is steemit chat working again? As far as I know was down. I have not checked again, will do today when at home. It was our only way of communication, kind of.
Cheers and have a nice weekend!

Hi Juan, no problem as long as you not decide to completely stop working on it ;-)
Most of the steemians have changed from steemit chat to discord. I can send you an invitation if you like...
I wish you a nice weekend too!

I can send you an invitation if you like...

Yes, do please. I am also on Discord too but in the Cervantes community.

you not decide to completely stop working on it

No!!!Finally my real computer is arriving (I hope so) today so I can finish everything faster :D That was also a extra problem, I do not have my desktop comp since 2 months now. Working with a laptop, it is good but it is not the same.

Cheers!

Great tutorial!
Very good job

Thanks a lot. I hope you will try it and send me some feedback!

Interesting thanks for sharing this tutorial very helpful and valuable content on steemit

Thanks. Maybe you need the tool to prepare your earnings for the tax office.

@schererf wow great article & good news thank you are post
##Upvote/Resteem##

This post received a upvote from @resteemme and it's trail. Thanks to @resteemme!

Some things went up over my head though ;)
But thanks buddy ,some people will sure get the real deal of the post !

Coin Marketplace

STEEM 0.19
TRX 0.16
JST 0.034
BTC 64333.84
ETH 2760.35
USDT 1.00
SBD 2.65