4

I'd like to build an application with rails. I want to make an account through Ruby. I got the advice that, in order to make an account, I should not use JSON-RPC for security. Instead I should use IPC and the javascript API, but I don't want to use javascript. I want to write with Ruby only. Could you tell me if there's a way to do that?

2 Answers 2

3

There's a lot of mixup in your question. Lets clear up the concepts first.

JSON is the data serialization format that all API endpoints use, independent on how you get that request to Geth. All the various endpoints exposed by Geth use exactly the same JSON-RPC protocol to invoke methods. This is programming language independent, as long as you can generate a JSON string and parse a JSON reply, you can implement it in whatever language you want.

The difference that some people talk about are the transport through which these requests can get to Geth and back to you. There you have 3 options: HTTP, WebSockets (only available in develop) and IPC. All of these "speak" the exact same JSON-RPC protocol, with the only difference that by default some API methods are only exposed via the IPC channel. The reason is that any program running in your browser can access your local HTTP/WebSocket endpoints, whereas only programs running on your computer natively can access to IPC endpoint.

Account management is one such thing, which is not exposed on the HTTP endpoint to prevent arbitrary websites from mucking around with your accounts. That's why people were suggesting you use IPC.

PS: None of these have anything to do with JavaScript. Ethereum provides a JavaScript library to talk to these RPC endpoints, but you're free to talk to them directly (in fact a lot of projects do so using their own programming languages).

0

You can create private keys and build/sign transactions with ethereum-tx. You can generate that key offline, or anywhere that runs ruby, then you just have to send the address to whoever you want to send you Ether. You can then sign and send raw transaction hex to any of the block explorers that accept it, or use your own JSON-RPC API on a node you control.

Alternatively, there is a ruby full node implementation in the works. Not sure about the APIs that are ruby specific, but you could include the gem, and then run the full node from inside your ruby app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.