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.
I don't understand half of what's going on in bitcoin-ruby and ffi in general. I've debugged some of this stuff around OpenSSL in the past, but only on Windows. So I'd chalk it up to a strange OpenSSL distribution.
In the Windows example, instead of trying to figure it out, I ended up going to the Windows Subsystem for Linux route, which addressed it.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
You know, I just realized that I forgot to mention another error I encountered that had to do with some deprecated SSL library method, but it was a completely different error, but I installed libssl v1.0.0 from advice from similar error messages on a different application. However, it didn't actually fix the original error.
But maybe there's some strange caching behavior or delay in change propagation somewhere along my sequence of changes and it is maybe due to that.... I'll update the post with more specifics later.
Very strange environment differences causing funny behaviors... The bot worked fine on linux box in VPS (Ubuntu 16.04)
That would make more sense to me, since the change I cited above doesn't look like I even did anything. From a ruby point of view it should be a no-op....
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
My guess is that since
OpenSSL_EC
is a module andself
must be a concrete class,ffi
was confused when it looked upself
and found something other thanOpenSSL_EC
. Maybe there's a later version offfi
that can deal with this issue.I'm using some hand-waving language here because, like I said, I don't fully understand
ffi
.Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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:
Feel free to join our @steem-ua Discord server
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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. :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit