Run methode simultaneously

my question refer to gol libp2p
i want to create three peers : two peers exucute a function in parallèle and the result must be send to another peer the cordinator (or the validator).
any help please to start implementig my network with libp2p

You can set up a pub/sub chanel for tasks. When the validator emits a task a worker answer with “i’ll take that” with a timstamp. The other nodes see that the task was taken. If they answered at the same time, they compare the timestamp to see if they answered just before the ither peer, or just after. The first one gets the task. The validator sends the task direcrly to this peer. When it finishes, it sents it to the validator(no need to polute the chanel).

You might want to set up peering agreements between all the peers.