5

I was wondering if it were possible to launch an external command (system call) when a transaction sent by a node is confirmed?

For example if node A runs pyethapp (in the context of a private blockchain) as:

$ pyethapp -c eth.network_id=1337 -c node.privkey_hex=091bd6067cb4612df85d9c1ff85cc47f259ced4d4cd99816b14f35650f59c322 -b 'enode://288b97262895b1c7ec61cf314c2e2004407d0a5dc77566877aad1f2a36659c8b698f4b56fd06c4a0c0bf007b4cfb3e7122d907da3b005fa90e724441902eb19e@0.0.0.0:30303' -c eth.genesis_hash=283bd9430c5f3114872f93beefe99d6626980b3a4a18a44ddd27749cd89688f2 -m 50 run

and then node B connects to it through pyethapp:

$ pyethapp -c eth.network_id=1337 -b 'enode://288b97262895b1c7ec61cf314c2e2004407d0a5dc77566877aad1f2a36659c8b698f4b56fd06c4a0c0bf007b4cfb3e7122d907da3b005fa90e724441902eb19e@192.168.2.12:30303' -c eth.genesis_hash=283bd9430c5f3114872f93beefe99d6626980b3a4a18a44ddd27749cd89688f2 run

and sends a transaction from an account on its end to one on A's end can it take action (initiate a system call) once the transaction is confirmed?

1

I think this is a good question, but it never got an answer, so I'm answering it.

There's two ways to do this, I think.

First would be to modify the source code of the node in such a way that nothing changes except immediately after the finalization of a transaction it would fire off a system call. This would require you to download, modify, and build the node code however. That may or may not appeal to you. I wouldn't do it this way.

Another way would be to write a web3 script to listen for events (described here: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter) and respond to changes that you're interested in. The web3 script would be running off-chain, so you can do anything including make system calls.

There is no way to make a system call from inside a Solidity program, if that's what you're asking.

  • the second option i think is interesting and i'll add he could use the python implementation of the web3 – Badr Bellaj Jun 6 '17 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.