1

I am working on an ethereum project but I have some doubts. I have a backend that connects to the blockchain via web3.js. To connect to the blockchain I use a geth node. I understand that the sequence is this:

send transacrion enter image description here listen to events enter image description here my questions are:

  • What is the component sending the transaction? Is it the backend component or the geth node?
  • Then suppose that another smart contract in the network emits an event that I want to capture. What is the component that captures the event? Is it the backend component or the geth node?

1 Answer 1

4

First question - There are two options here:

  1. The backend forms a transaction, and geth signs and sends it to the Ethereum network
  2. The backend forms and signs the transaction, and the geth sends it to the network

Second question - maybe 2 options:

  1. The backend requests new blocks from the geth, extracts events from them and selects the necessary ones
  2. The backend configures the event filter in the geth according to the parameters it needs, after which it periodically requests new events, catched by geth.
3
  • In my project I'm assuming the geth node belongs to the backend. The first answer is clear. In the second answer I struggle to understand the difference between the two possibilities. 'The backend requests new blocks from the geth, extracts events from them and selects the necessary ones'. Can I listen to events using myContract.events.MyEvent () or web3.eth.subscribe ('logs',…) ;? And in the second possibility does something change?
    – EMANUEL
    Commented Jan 21, 2021 at 15:36
  • I have updated the drawing. In the second case (events) is it right to connect the arrows in this way?
    – EMANUEL
    Commented Jan 21, 2021 at 15:41
  • Unfortunately, I use the json rpc, so I can't tell you about the specific implementation of these options in web3. :-( Second way - Ok
    – Mad Jackal
    Commented Jan 21, 2021 at 15:42

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.