Pin Your Dtube Hashes & A Name Change! | Update #008

in #utopian-io6 years ago (edited)

nebulus-update-008-archivatory

Repository

https://github.com/jrswab/nebulus

Bug Fixes

No Rich Text Descriptions

Added the meta tags to the main.php file for the desired content. Now, when posting the link a small description and image show for the project in apps like Discord and Twitter.

Solution

The solution was straightforward, find the needed tags and add the desired information to the server:
nebulus-rich-text

New Features

Pin Existing Content!

This implementation took so much more time to plan and figure out than I anticipated. Between IPFS acting up during testing, PHP not running the python script, and SteemConnect redirect issues this little bit of code does not do justice on how much time I had to spend hacking my way through this feature.

However voilà! Now both content creators and application developers can use @nebulus to pin their content for 1 STEEM. The pining works with any IPFS hash, to be honest. Whether it is from @dtube, @dsound, or you uploaded something to your server, you can pin in on Nebulus.

The price is needed since we are not able to check the size of the file which the user wants to pin, and any pin downloads to the server taking up more space and leaving less space for account holders. As the price of STEEM increases, we plan to move away from the hard-coded 1 STEEM to $1 worth of STEEM (or some fair amount) to keep the price reasonable.

Pinning is the first step towards federating this service with many nodes. The pin.py script is set as a cron job and scans the blockchain for transfers to @nebulus with a hash. At the same time, the script looks for any transfer with the word init. When the script finds "init" a counter ticks up followed by some math to create a round-robin style pin function. This way everyone fills up at different rates and not at the same time.

Frontend

nebulus-pin-ipfs-hashes

Backend

nebulus-python-steem-blockchain-pin-ipfs
The pin function gets called at the very bottom of the python script to get the output of the roundRobin function. The round-robin function returns a number that is then used to determine if the node should pin the content found in the transaction list for the Nebulus steem account.

nebulus-pin-functions

blockNum is set as a global variable so all functions may call the information it holds. Setting this to a variable is better than hard-coding it in every function, so we only have to change it once, and even set it to something else via the STEEM blockchain if needed in the future.

We are using BEEM, by @holger80, to access the STEEM blockchain.

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.

If you have any questions about the future of Steem
or my witness please feel free to message jrswab#3134 on Discord.

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.
You can see all active witnesses on @drakos' steemian.info


Click here to join the mailing list and get exclusive SDB/STEEM giveaways!

Looking to support my content creation efforts outside of the Steem Blockchain?
Check out jrswab.com/support


Mastodon | Keybase | Twitter | Gab | Minds | Hacker Culture Podcast

Sort:  

Thank you for your contribution. You may look at the http_build_query which helps to build the query string, because some characters need to be urlencode (and htmlspecialchars may not help).
Also, try not to use global variable such as roundRobin as it makes your function tightly coupled and not easy to unit-tested. The pgreped in pidKill should be tested for validity e.g. if it is "" or None, your script may break.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thanks for the pointers @justyy! I'll read up on http_build_query and mess with those python issues.

Thank you for your review, @justyy!

So far this week you've reviewed 1 contributions. Keep up the good work!

Great work JR. You are a wizard :)

lol at least a monkey now

monkey-coder

I don't understand such things, but can we now uploaded a video for ever to dtube, I mean to being played even after a month. Why everybody is saying that ipfs is good while we can get files from there just a few days after uploading them. And after that it's impossible to download or watch something ? or is it made specially temporary to save the space ? Can you explain please ?

Why is everybody saying that IPFS is good when we can get files for only a few days after uploading them. After that, it's impossible to download or watch something?

Your question leads to an in-depth discussion of IPFS, but I'll do my best to give an easy answer. The reason why a video on IPFS loads for the first few days and then seems never to load again is not that the link is wrong but because the file the link is looking for is not cached on the gateway and or not on the network at all.

If you upload to IPFS (either from the command line, @nebulus, or @dtube) that video gets a unique hash for that content. As long as the video can is on the IPFS network, it plays. Sometimes the playback slow because the gateway you are watching it through has to download the file.

This problem is why @nebulus exists. The more places to pin your content the less likely your file disappears (or so it seems). Once we get federation pushed out a person running a Nebulus node can earn STEEM when they pin content uploaded to all the other nodes. The more IPFS nodes with your content saved to them the faster the file loads and the chance that the file disappears goes down drastically.

Is it temporary to save the space?

Yes, when it comes to the IPFS nodes caching content. Unless a node runs the command to pin the content, that node deletes the cached versions of files every so often. It's called garbage collection and is an IPFS feature to make sure the most popular content stays active. That said, as long as the at least one IPFS node pins your content it exists but it may take a long time for a gateway to load the content.

I see now, but people can't watch the video for ever and can't download files for ever. Why ipfs don't work better than youtube or google drive or any other website that can hold files forever ?
Is the reason behind that is because not a lot of people share the space with ipfs ?

With YouTube, access is dependent on a single centralized entity continuing to provide access. With IPFS future access only requires any entity, not necessarily its creator, to be hosting the content.

people can't watch the video for ever

This is why this project exists, so videos will stay live forever.

Is the reason behind that is because not a lot of people share the space with ipfs ?

I believe it's just a lack of nodes pinning files on IPFS

This project is being supported by @Fundition

Fundition is a next-generation, decentralized, peer-to-peer crowdfunding and collaboration platform, built on the Steem blockchain.

#upfundition and #fundition tags on Steem represent the projects that are started on https://fundition.io.

Are You Prepared to Make the World a Better Place too?

Read the full details of Fundition Fund program

Learn more about Fundition by reading our purplepaper

Join a community with heart based giving at its core
steemitf.pngtwitterf.pngyoutubef.pngfacebookf.pnginstaf.pngdiscordf.png

Thanks for the support!

Hey @jrswab
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Thanks again for the support!

wow awesome concept sir...thanks for share your inportant concept..

Very impressive to your work :) @jrswab Dear.

@jrswab..Brilliant work to share with..You are the champion!

All day!

champ

haha

Congratulations @jrswab! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of comments received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Can't upload videos on Dtube, don't know why? I've tried everything.
Need help

Upload to Nebulus and then add the hash to Dtube.

addHashToDtube.png

@jrswab Thank you for replying sir.
But, I'm sorry. I'm not familiar with 'Nebulus'. And when I googled it, it shows that it is a game. So, how can I upload videos to a game (Nebulus)? Confused!
If you can elaborate or point me to some posts giving me a good understanding related to the issue, that would be great.

We are not focused on Google SEO due to lack of help. Just head over to https://nebulus.app

Thanks :)