Prima automazione sulla blockchain: Un tool per fare airdrop e curation

avatar
(Edited)

Since the first approach with Steemit I have harbored the desire to do something to automate some functions.
Due to the short time and, all things considered, the fact that I didn't actually have a real need, I never even tried to get my hands on it (and my head ...).

Some time ago, however, I promised some ReCoins to those who made resteem the launch posts for my Contest of Contests, they are generally just a few users, but the manual skill of having to make a certain number of submissions weighed on me.

At one point on the Steem-engine discord appeared a guy who presented a service he set up to make air drop easier.
Basically it was necessary to send to a certain user a certain amount of any token putting in the memo some keywords.
Paying 2% of the value to be distributed could be divided equally the tokens sent (minus 2%) to all the users who had made resteem, to all those who had voted a post in equal parts or percentage based on the weight of the vote on the total.

I have used this service sometimes, but its author was (and is) often absent, the service sometimes did not work, etc.
I asked this user to add the possibility to divide the tokens between those who had submitted a post based on the percentage of the vote and not based on the weight of the vote itself, receiving the promise to add this new feature shortly.

Since then the guy disappeared from the radar and his service no longer works.

All this premise to explain why, in the end, I decided to take the first steps to interact with Steemit's blockchain directly.

After banging my head against the wall called windows ... I decided and installed a lubuntu virtual machine.
I started from a small program made by @themarkymark [seairdrop] (https://github.com/themarkymark-steem/seairdrop) in Python, which uses as a base [Beem] (https://github.com/holgern/beem ), a Python library written by @holgern.

This airdrop tool uses a simple csv file as a list of steemit users to which send tokens with a fixed memo.

Working on it, I pulled out the solution that specifically serves me, for my particular needs, trying to automate everything that can be automated.

Here's how my first tool for Steemit was born.

What does this tool do?
In its current version it requires as input only one steemit user (of which it is necessary, obviously to have the two keys posting and active).
Starting from this user, through a series of questions, it allows:

  • Make an Air Drop of a Token (of which obviously the user is in possession) to all the users who have submitted a post in the list of the last 10 posts (this limit is a necessity of mine, not a constraint) assigning a share for each user based on the voting percentage
  • Make an airdrop of a Token (of which obviously that user is in possession) to all the users who have made Resteem a post in the list of the last 10 posts (this limit is a necessity of mine, not a constraint) ; the subdivision is in equal parts
  • Make a sort of curation of comments.

The latter is an initiative of @themagazine: basically the user @themagazine comments on a comment to one of his posts with a key phrase, I used the "Sending xx.xx ReCoin" formula.
My tool identifies this type of comment (only if written by the user @themagazine on a comment to a @thamagazine post) it sends the ReCoins to the user who wrote the comment and updates the original comment ("Sending xxx .xx ReCoin ") with a comment specifying the sending of ReCoins.
You can find an example [in this post] (https://steempeak.com/steempossible/@themagazine/movies-and-television-ciak-3-lost-the-one-and-only-en-it-es-de ) where the comment by @massrado was awarded with 0.5 ReCoin.

Let's see how the tool looks:

A shell is launched which passes the name of the user steemit:

As a first step you are asked if you want to do a Curation , to date I have provided this feature only for @themagazine:

In this example the program does not find any comment of the type "Sending xx.xx ReCoin":

A small change will be to avoid the question whether to perform curation or not in the case where the list, as in this case, is empty.

We now move on to the two air drops, by vote and by resteem, in this case we are asked if we want to do one of the two or change or none of the two:

If one of the two types of airdrop is chosen or both, the list of the last 10 user posts (in this example @ ilnegro) is presented, from which to choose which post the airdrop is to be made for:

Currently this choice involves both types of air drop, perhaps, in the future, they could be two different posts, I still have to think about what could be the most functional solution.

It is then asked how many tokens, in total, are intended to be sent to users who have submitted the selected post:

The program then automatically calculates the value to be sent to each user based on the percentage of votes eliminating the users who voted 0% and those who sent 0 Steem, for this reason we see at the bottom, 2 values; in this example the chosen post was voted by 21 users, but only 17 voted for it with a percentage> 0 and with a vote weight of> 0:

So here we are with the last feature, that of the air drop based on the resteems, in this case the tokens are divided equally among all those who made resteem of the chosen post:

Here we are at the end of the shell:

I must say that, all things considered, apart from the difficulties with windows, overcome simply by switching to Unix, I enjoyed myself and I was able to implement exactly what I needed without great difficulty.

I currently use this tool for my account, @ilnegro, for @themagazine and for @storychain.

Fin dal primo approccio con Steemit ho covato il desiderio di fare qualcosina per automatizzare alcune funzioni.
Complice il poco tempo e, tutto sommato, il fatto che non avevo in effetti una vera e propria necessità, non ho mai nemmeno provato a metterci le mani (e la testa...).

Tempo fa però ho promesso alcuni ReCoin a chi faceva resteem dei post di lancio del mio Contest of Contests, si tratta generalmente di pochi utenti, ma la manualità di dover fare un certo numero di invii mi pesava.

Ad un certo punto sul discord di Steem-engine è apparso un tipo che ha presentato un servizio da lui messo in piedi per poter fare air drop in modo più semplice.
Sostanzialmente occorreva inviare ad una certo utente una certa quantità di un qualunque token mettendo nel memo alcune parole chiave.
Pagando il 2% del valore da distribuire si potevano suddividere equamente i token inviati (meno il 2%) a tutti gli utenti che avevano fatto resteem, a tutti quelli che avevano votato un post in parti uguali oppure percentualmente in base al peso del voto sul totale.

Ho usato qualche volta questo servizio, ma il suo autore era (ed è) spesso assente, il servizio a volte non funzionava, etc.
Ho chiesto a questo utente di aggiungere la possibilità di suddividire i token tra chi aveva upvotato un post in base alla percentuale di voto e non in base al peso del voto stesso, ricevendo la promessa di aggiungere questa nuova funzionalità a breve.

Da allora il tizio è scomparso dai radar e il suo servizio non funziona più.

Tutta questa premessa per spiegare come mai, alla fine, mi sono deciso a muovere i primi passi per interagire con la blockchain di Steemit direttamente.

Dopo aver sbattuto la testa contro il muro chiamato windows... mi sono deciso ed ho installato su una virtual machine lubuntu.
Sono partito da un piccolo programmino fatto da @themarkymark seairdrop in Python, che utilizza come base Beem, una libreria Python scritta da @holgern.

Questo tool per airdrop utilizza un semplice file csv come elenco di user steemit a cui mandare token con un memo fisso.

Lavorandoci sopra ho tirato fuori la soluzione che serve specificamente a me, per le mie esigenze particolari, cercando di automatizzare tutto l'automatizzabile.

Ecco come è nato il mio primo tool per Steemit.

Cosa fa questo tool?
Nella sua versione attuale richiede in input solo uno user steemit (di cui occorre, ovviamente avere le due chiavi posting e active).
Partendo da questo user, attraverso una serie di domande, permette di:

  • Fare un Air Drop di un Token (di cui ovviamente quello user è in possesso) verso tutti gli user che hanno Upvotato un post all'interno dell'elenco degli ultimi 10 post (questo limite è una mia necessità, non un constraint) assegnando una quota parte a ciascun utente in base alla percentuale di voto
  • Fare un airdrop di un Token (di cui ovviamente quello user è in possesso) verso tutti gli user che hanno fatto Resteem di un post all'interno dell'elenco degli ultimi 10 post (questo limite è una mia necessità, non un constraint); la suddivisione è in parti uguali
  • Fare una sorta di curation dei commenti.

Quest'ultima è una iniziativa di @themagazine: sostanzialmente l'utente @themagazine commenta un commento ad un suo post con una frase chiave, ho usato la formula "Sending xx.xx ReCoin".
Il mio tool individua questo tipo di commento (solo se scritto dall'utente @themagazine su un commento ad un post di @thamagazine) esegue l'invio dei ReCoin all'utente che ha scritto il commento e aggiorna il commento originario ("Sending xxx.xx ReCoin") con un commento che specifica l'invio dei ReCoin.
Potete trovare un esempio in questo post dove il commento di @massrado è stato premiato con 0.5 ReCoin.

Vediamo come si presenta il tool:

Viene lanciata una shell a cui viene passato il nome dell'utente steemit:

Come primo passaggio viene chiesto se si vuole effettuare una Curation, ad oggi ho previsto questa funzionalità solo per @themagazine:

In questo esempio il programma non trova nessun commento del tipo "Sending xx.xx ReCoin":

Una piccola modifica sarà quella di evitare la domanda se eseguire o meno la curation nel caso in cui l'elenco, come in questo caso, è vuoto.

Si passa ora ai due air drop, per voto e per resteem, in questo caso viene chiesto se si vuole fare uno dei due o entrambio o nessuno dei due:

Nel caso venga scelto uno dei due tipi di airdrop oppure entrambi, viene presentato l'elenco degli ultimi 10 post dello user (in questo esempio @ilnegro) tra i quali scegliere per quale post si vuole fare l'airdrop:

Attualmente questa scelta coinvolge entrambi i tipi di air drop, forse, in futuro, potrebbero essere due post diversi, devo ancora pensare a quale possa essere la soluzione più funzionale.

Viene quindi chiesto quanti token, in totale, si intendono inviare agli utenti che hanno upvotato il post scelto:

Il programma quindi calcola automaticamente il valore da inviare a ciascun utente in base alla percentuale di voto eliminando gli utenti che hanno votato allo 0% e quelli che hanno inviato 0 Steem, per questo motivo vediamo in fondo, 2 valori; in questo esempio il post scelto è stato votato da 21 utenti, ma solo 17 lo hanno votato con una percentuale > 0 e con un peso del voto > 0:

Eccoci quindi all'ultima funzionalità, quella dell'air drop in base ai resteem, in questo caso i token vengono suddivisi equamente tra tutti coloro che hanno fatto resteem del post scelto:

Eccoci alla fine della shell:

Devo dire che, tutto sommato, a parte le difficoltà con windows, superate semplicemente passando a Unix, mi sono divertito ed ho potuto implementare esattamente quello di cui avevo bisogno senza grandissime difficoltà.

Attualmente utilizzo questo tool per il mio account, @ilnegro, per @themagazine e per @storychain.



0
0
0.000
8 comments
avatar
Questo post è stato selezionato, votato e condiviso dal team curatori di discovery-it in collaborazione con la community di C-Squared Curation Collective. Puoi utilizzare il tag #discovery-it per rendere i tuoi post di facile reperibilità agli occhi dei curatori. Ti invitiamo inoltre a votare @c-squared come witness per supportare questo progetto.

This post was selected, voted and shared by the discovery-it curation team in collaboration with the C-Squared Curation Collective. You can use the #Discovery-it tag to make your posts easy to find in the eyes of the curator. We also encourage you to vote @c-squared as a witness to support this project.
0
0
0.000
avatar
(Edited)

Complimenti. Un bel lavoro.
Un consiglio: usa Linux come s.o. principale, ed eventualmente Windows in virtual machine ;-)

0
0
0.000
avatar

Io "nasco" (parliamo dei primi anni 80 dello scorso millennio) come sviluppatore C su Unix, quindi non mi devi convincere...
Purtroppo se compri un portatile ti trovi già installato windows, comunque la VM funziona perfettamente, quindi direi che non mi crea nessun problema la virtualizzazione.

0
0
0.000
avatar

Siamo nella stessa barca. Io a un nuovo acquisto di PC faccio subito la partizione da boot per Linux. Windows lo uso solo per quei programmi che funzionano solo in quell'ambiente. Se non ci fossero quei casi, acquisterei direttamente senza Windows, e certi produttori li vendono, pagando anche meno perché non c'è licenza.
L'occhiolino nel commento era proprio per dare banalità al consiglio. Devo dire però che sono sorpreso che tu non abbia un boot su Linux.

0
0
0.000
avatar

Ullalà che lavorone! Complimenti, invidio chi sa mettere le mani su queste cose
Un saluto, nicola

0
0
0.000
avatar

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

You distributed more than 11000 upvotes. Your next target is to reach 12000 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemFest Meet The Stemians Contest - The mysterious rule revealed
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
0
0
0.000