Inertia's Cosgrove Bot on the Raspberry Pi

in #discordbot5 years ago (edited)

This weekend I was aiming to get the ruby voting discord bot running on the raspberry pi (so it could do something other than sit there). Yes, not super-productionized, but will suit its purpose. Anyway, I can spin it up on cloud hosting if need be.

I followed roughly the same steps as I documented here, and I do have my versions of the files on github, though they aren't in a cleaned up state for general use.

This time I got the following error:

undefined method `regenerate_key` for Bitcoin::OpenSSL_EC:Module

It seems also to be reported here, as well as some older posts on Steemit, but without resolution. So that didn't look so good. But after toying around a bit, I was able to get past it. The weird thing is that I didn't understand why what I did fixed the problem! Anyway, here's what did it for me:

I went into where the bitcoin-ruby gem was installed, which for me was

/var/lib/gems/2.3.0/gems/bitcoin-ruby-0.0.19/lib/bitcoin/ffi/openssl.rb

In this line in the ruby bitcoin module that was giving complaints, I changed it from

    def self.regenerate_key(private_key)

to

    def OpenSSL_EC.regenerate_key(private_key)

For some really bizarre reason, on the raspberry pi, prior to this change it wouldn't recognize regenerate_key, and when I debugged by dumping the methods, none of the methods were showing up. After this single change it suddenly worked... and I have no idea why. I didn't have to change any other methods... Ruby experts, any idea? (@inertia maybe?)

In any case, I'm not going to worry too much about it. I have a working bot that's at the mercy of my home internet and not being accidentally being unplugged by Opal... (no just kidding, there's no chance of that, but someone else...)

Anyway, I just wanted to document how I got it working. Maybe there's something more obvious I could have been doing. If you happen to want to run that particular flavor of bot on your raspberry pi, well there you go (probably too late for someone that was asking roughly 1 year ago).

This is for the bot that is powering @helpiecake manual curation right now. Issuing lots and lots of cake. Like seen in https://steemit.com/@helpiecake/comments. Maybe more bells and whistles soon. We'll see!


Addendum

I did one other thing that I wasn't sure if it actually did anything, because it was not the initial error, and I possibly needed both actions, so I'll include this here as well. When debugging I ran the bot a slightly different way, and ran into the error documented in this issue

FFI::NotFoundError: Function 'SSL_library_init' not found in [libssl.so]

This I resolved by installing libssl v1.0.0 as documented here. Though the link there doesn't work for the package, and I used this one instead.

Sort:  

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

Hi @eonwarped!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 5.003 which ranks you at #1142 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 186 contributions, your post is ranked at #11.

Evaluation of your UA score:
  • You've built up a nice network.
  • The readers appreciate your great work!
  • Great user engagement! You rock!

Feel free to join our @steem-ua Discord server


This post has been voted on by the SteemSTEM curation team and voting trail.

If you appreciate the work we are doing, then consider supporting our witness stem.witness!

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

Please consider setting @steemstem as a beneficiary to your post to get a stronger support.

Please consider using the steemstem.io app to get a stronger support.

You got a 2.70% upvote from @ocdb courtesy of @eonwarped! :)

@ocdb is a non-profit bidbot for whitelisted Steemians, current max bid is 45 SBD and the equivalent amount in STEEM.
Check our website https://thegoodwhales.io/ for the whitelist, queue and delegation info. Join our Discord channel for more information.

If you like what @ocd does, consider voting for ocd-witness through SteemConnect or on the Steemit Witnesses page. :)

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.035
BTC 65090.19
ETH 3379.11
USDT 1.00
SBD 4.55