Nebulus 2.0.0 is Live & Ready For Nodes!

14 comments

jrswab
66
2 months agoBusy5 min read

Nebulus-update-010.png

Nodes are ready to go, and your content can stay online forever! It has been a long while since the last update to Nebulus, and there have been a lot of stuff going on behind the scenes. All Steemians can now send a request to have their content from @dtube, @dsound, or any other dapp using IPFS "backed up." The cost is currently one STEEM and will never go above one USD worth of STEEM.

The need for this kind of transaction is to pay the nodes on the network. These nodes will both make sure your content is always found but the more nodes we have, the faster your media will load no matter what time of day it is. If you want to run a node and earn STEEM, please join our Discord group so you can have access to specific node chats where we will talk about how to make this service better for the nodes as well as the users.

Repository

https://github.com/jrswab/nebulus

Bug Fixes

The pin.py script started acting inconsistently after further edits.

Set environment to python3 and removed a majority of modules. Not pictured is the removal of all BEEM modules except Account form beem.account.
Screenshot 2018-09-11 at 08.43.12.png

The priceCheck function now uses a float instead of an integer to add more flexibility since the data that comes in is already a float in string form.
Screenshot 2018-09-11 at 08.49.57.png

The pin script would wait a set number of seconds before checking if the pin finished this caused an unnecessary wait time for quick pins.

Now the function checks itself every second and returns the data if found. No longer does a small pin have to take as long as a large pin.

def checkSubProc(pin, count):
    # if still running Popen.poll() returns None
    # else it ouputs the returncode of the command ran.
    if pin.poll() == None:
        print(count)
        # TODO: change amout for prod.
        time.sleep(1)
        # for looping on itself
        count += 1
        if count <= 119:
            checkSubProc(pin, count)
        else:
            status = pin.poll()
            return status
pin = subprocess.Popen('/usr/local/bin/ipfs pin add ' +
    format(quote(currHash)), shell=True)
    # give ipfs time to pin hash (in seconds)
     status = checkSubProc(pin, 0)
         # ipfs returns '0' when successful
         if status == 0:
             # if pinned write hash to file
             with open('hashList', 'a') as list:
                  list.write(currHash)
         else:
             # kill pin process if still running
             kill(findPID())

pin.poll() looks to see if the subprocess.Popen() assigned to "pin" is currently running. If the subprocess is running poll() returns None since if found no exit status. This loop continues until the command finishes or 120 seconds pass.

New Features

Ability to pin hashes on the home page without an account

There is no need to have an account to pin your content around the Nebulus network. User accounts on the site are currently deprecated and will not be under any new development at this time.

Screenshot 2018-09-11 at 09.15.38.png

Node directory to hold node scripts and for future Docker file.

All scripts to be used for running a node are found in the node directory. Soon there will be a docker file that anyone can download and run to set up a node and earn STEEM by keeping the creator's media live.

Ability to send node active status with custom JSON for future needs.

This was added before the pin script was refactored to help determine how often to pin content. This is kept so that the payout script knows what accounts are said to be live.

#!/usr/bin/env python3

from beem import Steem
from beem.account import Account

# needed to form user data dictionary
userFormat = ['user', 'wifLocation']

# grab steem user data
with open('config/userData', 'r') as userData:
    steemInfo = dict(zip(userFormat,userData.read().splitlines()))

# get private posting key from location
with open(steemInfo['wifLocation'], 'r') as wifRaw:
    wif = wifRaw.read().replace('\n', '')

# set up steem keys and account name
steem = Steem(keys=[wif])
account = Account(steemInfo['user'], steem_instance=steem)

# Send custom json init message
steem.custom_json('nebulus_node', '{"node": "initialized"}',
        required_posting_auths=[account["name"]])

A config file to hold user info such as steem account and wif location.

Simplification of data and organizational structure to keep everything understandable.

Script to request payment from Nebulus

After a node pins a number of hashes, the node then sends data to the blockchain seeking payment for the pinned hashes. This payment comes from the amount of steem sent in the pin request.

#!/usr/bin/env python3

from beem import Steem
from beem.account import Account

# needed to form dictionary from userData
userFormat = ['user', 'wifLocation']

# get steem user data
with open('config/userData', 'r') as userData:
    steemInfo = dict(zip(userFormat,userData.read().splitlines()))

# grab wif
with open(steemInfo['wifLocation'], 'r') as wifRaw:
    wif = wifRaw.read().replace('\n', '')

# set up steem key and account
steem = Steem(
        nobroadcast=False, # set to true for testing
        keys=[wif]
)

# set acc to the steem account in config/steemAcc
acc = Account(steemInfo['user'], steem_instance=steem)

# get pinned hashes
with open('hashList', 'r') as hashList:
    hashes = hashList.read().split('\n')

# send custom json with hashes
steem.custom_json('nebulus_req', '{"hashes": ' 
    + ', '.join(hashes) + '"}', 

Nodes only need to store their private posting key and should never use any other key when running Nebulus.

Changelog

GitHub Account

https://github.com/jrswab

All images came from royalty and attribution free sources unless specified.

Looking to take your Steem based creations to the next level?
Join us over at the Creators' Guild Discord group! We are here to encourage, support and increase the creation of quality content.


Don't Forget to Vote!

vote-jrswab-for-steem-Witnesses—Steemit.gif
Click here to vote with SteemConnect!

Or go to https://steemit.com/~witnesses
and type jrswab in the box at the bottom.

Want to know more about my witness? Feel free to message jrswab#3134 on Discord, jrswab on steem.chat, or head over to jrswab.cloud for maximum transparency.

SteepShot | Mastodon | Keybase | Twitter | Gab

Comments

Sort byBest