Staking Rewards with Energi

energi staking rewards

Here are some gotchas since I started my journey with an Energi staking node.

If you want to earn stake rewards you need to be connected online all the time with your node, so a node on a server is much better for this purpose than having it at home.

There is a great article here on how to setup a staking node:
https://medium.com/energi/proof-of-stake-vps-setup-guide-6aa7fb55a78f

And here you can find a NRG Staking calculator:
https://explorer2.energi.network/#/

Some things to consider:
Energi staking rewards will be always the same amount, namely 2.28 NRG at the time of writing this article.

What varies is the reward time so the more you stake, the quicker you will get rewarded.

For example with 200.00 NRG staked, the reward interval is 260 hours, about 10.8 days.

So with 200.00 NRG staked, you will get rewarded 2.28 NRG after 10.8 days.

With 1000.00 NRG staked, the reward interval becomes 52.88 hours, or about 2.2 days.

These are important details, specially if you are thinking at compound interest rates, which is when you add the interest to the principal invested capital.

Compound interest is very powerful and can give you a lot of leverage, if this is a new concept for you, I suggest you google it and learn more.

If you send your NRG to multiple wallet addresses, they will be staked separately, each one with is own timed reward, so if you have 5 addresses with each 200.00 NRG in it, even though that is the same wallet, it will take 5 times longer to get your rewards.

Consider that the staking calculator gives just average projections, Energi support (on Discord) advice is to keep in mind staking rewards happening in double or triple the time suggested by the calculator to smooth out probabilities, for example if the calculator output is 2.28 NRG every 2 weeks, it’s much better thinking like getting 2.28+2.28+2.28 every 6 weeks.

Also, if you move around NRG in your staking addresses that will reset the staking time, so it’s best to do that at the end of a staking cycle.

Staking rewards will not automatically end up in your main staking address, so to compound your gains, you will have to “roll-up” the rewards, there is a process for that described in the Energi discord channel. I will ask if it’s ok to post the direct link to that here.

Energi support is very fast and I’ve been very pleased by talking with them.

Happy staking!

AWS Firehose Lambda template for vpc-flow logs to ELK cluster

When creating a Kinesis Firehose Stream, some Lambda blueprints are available to process and convert data.

https://eu-west-2.console.aws.amazon.com/lambda/home?region=eu-west-2#/create?tab=blueprints

Using the Python blueprint:

kinesis-firehose-cloudwatch-logs-processor-python

 

To add a timestamp in front of it, modify the transformLogEvent(log_event) function like this:

# return log_event['message'] + '\n'
ts = str(log_event['timestamp'])
return ts + ' ' + log_event['message'] + '\n'

Python aws boto3 print instances list per vpc


import boto3

session = boto3.Session(profile_name='awsdev')
ec2= session.client('ec2', region_name='eu-west-1')
ec2.describe_instances()

response=ec2.describe_instances()

# get vpc list
vpcs=[]
for i in range(len(response["Reservations"])):
    instance_vpc=response["Reservations"][i]["Instances"][0]["VpcId"]
    vpcs.append(instance_vpc)
vpcs=list(set(vpcs))

# dict with k=vpc v=[instances]
dict_vi={}
for v in vpcs:
    dict_vi[v]=[]
    for i in range(len(response["Reservations"])):
        instance_vpc=response["Reservations"][i]["Instances"][0]["VpcId"]
        instance_id=response["Reservations"][i]["Instances"][0]["InstanceId"]
        if instance_vpc == v:
            dict_vi[v].append(instance_id)

# print vpc and instance list
for i in dict_vi:
    print("---------------------- %s ---------------------" % i)
    print(', '.join(dict_vi[i]))
    print('\n')


Python3 argparse

https://docs.python.org/3/howto/argparse.html

Supports -h and --help automatically :D

So you automagically get this:

~$ ./myprog -h
usage: myprog [-h] [--cron] [--ms MS]

optional arguments:
-h, --help show this help message and exit
--cron use when you want to lock i.e. when run by cron
--ms MS overwrite milliseconds treshold in local_config.py

See example snippet to use booleans switches or pass values:

import argparse

# parse cli args
parser = argparse.ArgumentParser()
parser.add_argument("--cron", action="store_true", help="use when you want to lock i.e. when run by cron")
parser.add_argument("--ms", type=int, help="overwrite milliseconds treshold in local_config.py")
args = parser.parse_args()

if args.ms:
    ms_treshold = args.ms