You are viewing a single comment's thread from:

RE: Steem Pressure #3 - Steem Node 101

in #steem-pressure6 years ago (edited)

@gtg ... sorry if my question is a bit off topic ... But, how does one broadcast a raw+signed tx to the STEEM blockchain? Is there any way one can do this via HTTP RPC using public api servers? Or, will I need to:

  • setup my own Steem Node in the cloud
  • open ports to receive data
  • use Steemd to broadcast?
Sort:  

Well, just a bit. It's about nodes after all, so don't worry :-)

Yes, all you need is an RPC endpoint (at one of the public API nodes).

What's very on topic is that, in fact, it's enough to use consensus node for such broadcasting (as long as it provides RPC endpoint). In our universe, those nodes that provide such endpoints are most often "full nodes".

Here's an old, but very good read from @xeroc: Steem transaction signing in a nutshell

Yes, all you need is an RPC endpoint (at one of the public API nodes).

Excellent, thank you! So, I assume I can do this with Steemit's API then? I was just worried that all the call methods were read-only.

Would you happen to have any curl examples for broadcasting a tx? If not, that's ok, I'll just go hunting for it. Or, I'll just look through the source code to figure out what parameters the api wants.

Thank you very much for the assistance fellow wizard! :)

Ah! I think I found what I was looking for.


It seems like the hard part is just going to be constructing the message and getting the signatures as Xeroc described ...

Exactly, that would be a hard part but we have few libraries that can help you deal with signing.
The easy part looks like:

{"id":1,"jsonrpc":"2.0","method":"call","params":["network_broadcast_api","broadcast_transaction_synchronous",[{"operations":[["vote",{"voter":"fulltimegeek","author":"gtg","permlink":"steem-pressure-3-steem-node-101","weight":10000}]],"extensions":[]}]]}

but then you need to sign it and even before that to add reference block number and block prefix along with expiration time and to all that you add a signature which the call something like this:

{"id":1,"jsonrpc":"2.0","method":"call","params":["network_broadcast_api","broadcast_transaction_synchronous",[{"ref_block_num":123,"ref_block_prefix":1234567890,"expiration":"2018-03-08T12:34:56","operations":[["vote",{"voter":"fulltimegeek","author":"gtg","permlink":"steem-pressure-3-steem-node-101","weight":10000}]],"extensions":[],"signatures":["signaturesignaturesignaturesignaturesignaturesignaturesignature"]}]]}

That would be hard if you would like to script that signing in bash but existing libraries will do that for you without need of re-inventing the wheel.

@GTG, you are one sexy bastard! lol ... Those curl snippets are a huge aphrodisiac to me ...

Thank you again for all you do and your help. I have looked into libraries, as you mentioned, but I'm trying to do this natively in Android so I don't need any dependencies. I think I have it all figured out now.

Expect some dank apps from me sometime this year :D