I'm new to the field, I'm trying ethereum-ruby to bind Ethereum node into a Rails app.
I have a node running APIs via IPC like
geth --ipcapi "admin,eth,debug,miner,net,shh,txpool,personal,web3"
and in Rails console I can do
client = Ethereum::IpcClient.new("#{ENV['HOME']}/.ethereum/geth.ipc")
but when I try puts client.coinbase["result"] I get and error:
JSON::ParserError: 776: unexpected token at '{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}
Most likely the call to node resulted in error (no coinbase set?) and therefore there is no "result" field, only "error".
You can also check the other ruby ethereum library ethereum.rb. It was designed to be easy to use for the programmer.
Related
I am writing an IBM Cloud Function which uses the python SDK to interface with a Cloudant service. I have the Cloudant service up, the databases populated, and service credentials / API key ready. However when I try to instantiate the CloudantV1 service inside my Function I get a runtime error "must provide authenticator".
I looked up the error in their git repos and it seems like it is trying to setup an authenticator object by looking up values from environment variables, which do not exist in the Function. I just want to pass my API key directly, but I have not found a method to do this. I am using basic code from the examples so I think my calls are correct.
I have considered injecting the environment variables inside the Function, but that sounds like a major hack. I must be doing something incorrectly. Please help me understand what it is. Here is basic Function python code which reproduces the error:
from ibmcloudant.cloudant_v1 import CloudantV1
def main(params_dict):
service = CloudantV1.new_instance()
# unreachable
return { "message" : "hello world" }
There is an example for programmatic authentication at https://cloud.ibm.com/apidocs/cloudant?code=python#programmatic-authentication - it basically looks like this:
from ibmcloudant.cloudant_v1 import CloudantV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
authenticator = IAMAuthenticator('yourAPIkey')
service = CloudantV1(authenticator=authenticator)
service.set_service_url('https://yourserviceurl.example')
I have a situation where I want to import my graph data to database.I am having janusgraph(latest version) running with cassandra(version 3) and elasticsearch(version 6.6.0) using Docker.I have been suggested to use gryo format.So I have tried this command
graph.io(IoCore.gryo()).reader().create().readGraph(ToInputStream.from("my_graph.kryo"), graph);
but ended up with an error
No such property: ToInputStream for class: Script4
The documentation I am following is here.Please take a look and put me in a right procedure. Thanks in advance!
ToInputStream is not a function of Gremlin or JanusGraph. I believe that it is only a function of IBM Compose so unless you are running JanusGraph on that specific platform, this command will not work.
Versions of JanusGraph that utilize TinkerPop 3.4.x will support the io() step and this is the preferred manner in which to load gryo (as well as graphson and graphml) files.
Graph graph = ... // setup JanusGraph instance
GraphTraversalSource g = traversal().withGraph(graph); // might use withRemote() here instead depending on how you are connecting I suppose
g.io("graph.kryo").read().iterate()
Note that if you are connecting remotely - it seems you are sending scripts to the Docker instance given your error - then be sure that that "graph.kryo" file path is accessible to Docker. That's what's nice about ToInputStream from Compose as it allows you to access remote sources.
I am using Elasticsearch 6.2.4 with my RoR application using elasticsearch-rails and elasticsearch-model.
My indexation is runninng without getting any errors. but when I try to perform a search from the application I am getting this error from Elasticsearch
<Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"}],"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"},"status":400}>
Everything was working normal prior to the upgrade of Elasticsearch from 1.5 to 6.2.4
I simplified my search query to try narrowing down the problem.
q = { "query" => { "match_all" => {} } }
But I still getting the same error. Probably I am not specifying a type in the query but wouldn't be unnecessary since I have a match_all condition ?
> {"query":{"match_all":{}}}
< {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"}],"type":"illegal_argument_exception","reason":"text is empty (possibly HTTP/0.9)"},"status":400}
I am brand new to Elasticsearch so excuse me in advance if there are some evident stuff that I am missing
Do you have any idea what is causing this error ? If you need more specific info just ask and I'll update this question.
Thanks.
Search request from application is resulting in HTTP 400 Bad Request. Are you able to perform a search request from outside the application i.e. invoking a curl command from your local etc ?
We have a main portal site (running Rails 4 with a PostgreSQL database), and an external image server (running Node.js with Mongo database). I'm trying to establish a connection from Rails to the database - I installed the mongo gem - https://docs.mongodb.org/ecosystem/drivers/ruby/ - and have been following the guide, but got stuck on an odd key error that I can't seem to find any information on.
The image server itself is running fine with no problems (it has a GUI interface that is working fine).
In my controller (I changed the names and left out the passwords):
image_server = Mongo::Client.new([ 'image.companyname.com:####' ], :database => 'db-name')
It seems to connect:
D, [2015-11-11T00:41:22.730360 #9410] DEBUG -- : MONGODB | Adding image.companyname.com:#### to the cluster.
But then just spams this message over and over (and queries don't do anything but return this error even faster).
D, [2015-11-11T00:41:22.991386 #9410] DEBUG -- : MONGODB | key not found: "t"
Eventually it returns one error message as well, but keeps spamming the key not found error as well:
Mongo::Error::NoServerAvailable (No server is available matching preference: #<Mongo::ServerSelector::Primary:0x007f5a943f6ee8 #options={"mode"=>:primary, "database"=>"db-name"}, #tag_sets=[], #server_selection_timeout=30>):
app/controllers/admin/model_controller.rb:9:in `index'
EDIT
I even tried connect directly to the UNIX socket, and got the same error:
image_server = Mongo::Client.new('mongodb://image.companyname.com:####/path/to/socket/socketname.sock')
END EDIT
I'm unsure what the heck this 'key not found "t"' error is, or how to even begin to diagnose this. I've messed with every single connection option I can think of, and nothing changes. Any ideas?
I have a process running on node2. Can I register this process using register/2 on node1? Basically I am trying to do this:
register(process_name, spawn_link(node2, module, function, [Arg1, Arg2]))
I get this error:
** exception error: bad argument
in function register/2
called as register(process_name, <5902.92.0>)
When I register a process local to node1, this works perfectly fine. I could not find any documentation which prevents registration of processes of other nodes.
Thanks.
Actually it is well documented, and the expected behaviour as register() is for local process registration.
http://www.erlang.org/doc/man/erlang.html#register-2
Failure: badarg if PidOrPort is not an existing, local process or port, [...]
If you want global registration across your cluster, read http://erlang.org/doc/man/global.html
Note that if you use standard OTP behaviours, (gen_server, etc) most of the time you don't need to use the global module directly.