How do I send the proof of work to a node that is executed on a client?
Do I use "attachToTangle" and for branch and trunk transactions do I just use the hashed transaction with the nonce?
Iota Stack Exchange is a question and answer site for users of Iota, the open-source cryptocurrency for IoT that does not use a blockchain. It only takes a minute to sign up.Sign up to join this community
broadcastTransaction. And that how the client does the PoW!
To understand how this works, you have to take a look at how transactions are generated: https://learn.iota.org/faq/what-is-needed-to-make-a-transaction
I'm assuming you use a light node.
Signing: The transaction is constructed and validated using your private key. This is done locally on your PC.
Tip selection: You ask a full node to give you two tips to reference and therefore validate them.
Proof of work: In most cases, this is done on your side, for three reasons:
A: Nodes are already busy handling transactions. Having to do the proof of work would probably break them and create a backlog.
B: In most cases, Nodes are not rewarded in any way. They are keeping up the tangle for free by propagating transactions, choosing tips for light nodes and getting their neighbours up to date if they aren't.
C: The POW is done to prevent spam attacks to the network. If a node would allow it for free, someone could just spam it.
There are a few outliers, but not many. So you just broadcast the whole transaction (with nonce) to the network (needn't be the node you received the tips from). Any node will accept the transaction, given that it is valid and not directly or indirectly validating an invalid transaction. So there is no need to send the POW, just send the whole transaction one you have completed the POW