BeamMW / beam

Beam: Scalable Confidential Cryptocurrency. Leading the way to Confidential DeFi
https://beam.mw
Apache License 2.0
699 stars 202 forks source link

beam-node Websocket #1930

Closed blackmennewstyle closed 1 year ago

blackmennewstyle commented 1 year ago

Hello,

Is there any documentation about the BEAM-node websocket, how to communicate with it? What method can be called? etc...

anatolse commented 1 year ago

Hi! Actually, we don't have any documentation for this feature. The only aim of it is to allow web wallets to communicate with a node without changing node protocol. Web wallet internally is a regular beam wallet that is written in C++ and compiled to WASM with Emscripten. All socket calls are converted into websoket during this process. So, we need some kind of mediator in between. Technically it could be a separate tool like websockify. We chose to add this functionality directly to the node.

blackmennewstyle commented 1 year ago

Thanks for the answer. So does it mean that the only way to communicate with BEAM-NODE, if i am not mistaken, is through the Stratum (API)?

anatolse commented 1 year ago

well, yes, Strarum is an API. And it is for miners, you can get block data from the node and feed the solution back. Theoretically, you can use node p2p protocol (which is exposed via websockets), but it's not documented, and tricky to implement, because this means that you have to implement the wallet's logic. So, if you want to communicate with the node we have the following options for devs:

Here are the links for details:

https://github.com/BeamMW/beam/wiki/Beam-wallet-protocol-API-v7.2

https://github.com/BeamMW/beam/wiki/WASM-wallet-client

https://github.com/BeamMW/beam/wiki/Beam-Node-Explorer-API

blackmennewstyle commented 1 year ago

Thanks for all the answers very helpful.

I don't see any RPC method for submitting block? Any inputs on the matter?

blackmennewstyle commented 1 year ago

My bad, asking question when the answer was provided previously lol Thanks for the inputs :)