node-red-contrib-nem2 create aggregate transaction example template

Description

Alt text

Alt text

The flow will make an escrow between the initiator and another account. It will create an aggregate bonded transation and also a lockfund transaction. The lockfund transaction is announced to the network and a listener is started, when the lockfund is confirmed the aggregateBonded transaction is announced.
The flow also opens 3 listeners.

  • Error listener.
  • Confirmed transaction listener
  • aggregate bonded transaction added

note: The publicAccount need to be send first.

Requirements

Mandatory

  • publicAccount
    • publicKey of the counter party
  • account
    • privateKey of the account that initiates the escrow
  • transfer transaction counter party
    • address of escrow initiator
    • mosaic name
    • amount
    • optional message
  • transfer transaction initiator
    • address of counter party
    • mosaic name
    • amount
    • optional message
  • listeners
    • url to a catapult server

In the the aggregateBonded supflow (open the aggregateBonded node and click:"Edit flow template").

  • announce transaction (2*)
    • url to a catapult server
  • listener
    • url to a catapult server
[{"id":"d56067f5.459558","type":"subflow","name":"aggregateBonded","info":"","in":[{"x":50,"y":60,"wires":[{"id":"5072f187.4dcc9"}]}],"out":[]},{"id":"598d556c.26847c","type":"signTransaction","z":"d56067f5.459558","name":"","privateKey":"","network":"2b9cf13.9eaf90e","x":170,"y":150,"wires":[["f1fb939e.360b1"]]},{"id":"5072f187.4dcc9","type":"aggregateBonded","z":"d56067f5.459558","name":"","trigger":"bundle","network":"2b9cf13.9eaf90e","x":250,"y":60,"wires":[["598d556c.26847c"]]},{"id":"a521cee3.2661a","type":"lockFund","z":"d56067f5.459558","name":"","lockAmount":"10","network":"2b9cf13.9eaf90e","x":670,"y":150,"wires":[["1c5e4a93.3c6705"]]},{"id":"1c5e4a93.3c6705","type":"signTransaction","z":"d56067f5.459558","name":"","privateKey":"","network":"2b9cf13.9eaf90e","x":890,"y":150,"wires":[["3c192685.453eca","796f3a6d.344d14"]]},{"id":"cf065fd4.f5b0e","type":"change","z":"d56067f5.459558","name":"set property to close listener","rules":[{"t":"set","p":"nem.closeListener","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":978,"y":483,"wires":[["7900edb9.f60784"]]},{"id":"7900edb9.f60784","type":"listener","z":"d56067f5.459558","name":"","server":"551021ac.e378e","address":"","listenerType":"confirmed","x":690,"y":240,"wires":[["59fd83f3.86cfac"]]},{"id":"f1fb939e.360b1","type":"change","z":"d56067f5.459558","name":"save signedTransation","rules":[{"t":"set","p":"nem.signedTransactionToSend","pt":"msg","to":"nem.signedTransaction","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":150,"wires":[["a521cee3.2661a"]]},{"id":"3c192685.453eca","type":"change","z":"d56067f5.459558","name":"get address to listen to","rules":[{"t":"set","p":"nem.address","pt":"msg","to":"nem.account.address.address","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":240,"wires":[["7900edb9.f60784"]]},{"id":"db2dbf23.a95e7","type":"change","z":"d56067f5.459558","name":"get saved transaction","rules":[{"t":"move","p":"nem.signedTransactionToSend","pt":"msg","to":"nem.signedTransaction","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":981,"y":285,"wires":[["6fe4b39d.46961c"]]},{"id":"59fd83f3.86cfac","type":"switch","z":"d56067f5.459558","name":"check for correct transactionhash","property":"nem.signedTransaction.hash","propertyType":"msg","rules":[{"t":"eq","v":"nem.transaction.transactionInfo.hash","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":981,"y":240,"wires":[["db2dbf23.a95e7"]]},{"id":"796f3a6d.344d14","type":"announce","z":"d56067f5.459558","name":"","server":"551021ac.e378e","announceType":"announce","x":1141,"y":151,"wires":[[]]},{"id":"6fe4b39d.46961c","type":"announce","z":"d56067f5.459558","name":"","server":"551021ac.e378e","announceType":"announceAggregateBonded","x":976,"y":338,"wires":[["cf065fd4.f5b0e"]]},{"id":"551021ac.e378e","type":"serverConfig","z":"","url":"http://localhost","customUrl":"","network":"2b9cf13.9eaf90e","port":"3000"},{"id":"2fb45355.2b33fc","type":"account","z":"e4c082d4.21dd9","name":"account escrow initiator","privateKey":"","network":"2b9cf13.9eaf90e","x":265,"y":277,"wires":[["7d3df951.9eef68","25acd86.5947c28","1404b884.c3bb67","9bd32cae.d4099"]]},{"id":"7d3df951.9eef68","type":"transfer","z":"e4c082d4.21dd9","name":"","recipient":"","message":"100 xem for 500 xem (example)","network":"2b9cf13.9eaf90e","mosaics":{"nem:xem":"100"},"x":542,"y":278,"wires":[["b75effb6.abed4"]]},{"id":"7d1fb52e.e9533c","type":"subflow:d56067f5.459558","z":"e4c082d4.21dd9","name":"","x":958,"y":139,"wires":[]},{"id":"b75effb6.abed4","type":"change","z":"e4c082d4.21dd9","name":"set trigger","rules":[{"t":"set","p":"nem.trigger","pt":"msg","to":"bundle","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":733,"y":277,"wires":[["7d1fb52e.e9533c"]]},{"id":"25acd86.5947c28","type":"listener","z":"e4c082d4.21dd9","name":"","server":"551021ac.e378e","address":"","listenerType":"confirmed","x":519,"y":411,"wires":[["d7131d0b.f4c95"]]},{"id":"d7131d0b.f4c95","type":"debug","z":"e4c082d4.21dd9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":781,"y":410,"wires":[]},{"id":"1404b884.c3bb67","type":"listener","z":"e4c082d4.21dd9","name":"","server":"551021ac.e378e","address":"","listenerType":"status","x":514,"y":355,"wires":[["569b476.178e9b8"]]},{"id":"569b476.178e9b8","type":"debug","z":"e4c082d4.21dd9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":783,"y":356,"wires":[]},{"id":"9bd32cae.d4099","type":"listener","z":"e4c082d4.21dd9","name":"","server":"551021ac.e378e","address":"","listenerType":"aggregateBondedAdded","x":557,"y":462,"wires":[["a3cf7808.ad1328"]]},{"id":"a3cf7808.ad1328","type":"debug","z":"e4c082d4.21dd9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":785,"y":462,"wires":[]},{"id":"67ca6ae6.fae684","type":"transfer","z":"e4c082d4.21dd9","name":"","recipient":"","message":"500 xem for 100 xem (example)","network":"2b9cf13.9eaf90e","mosaics":{"nem:xem":"500"},"x":546,"y":143,"wires":[["7d1fb52e.e9533c"]]},{"id":"5b0956.fe84d6ac","type":"publicAccount","z":"e4c082d4.21dd9","name":"public account counter party","publicKey":"","network":"2b9cf13.9eaf90e","x":272.2222213745117,"y":143.333327293396,"wires":[["67ca6ae6.fae684"]]},{"id":"16ba2013.74ad2","type":"comment","z":"e4c082d4.21dd9","name":"Send aggregate bonded transaction","info":"","x":187,"y":72,"wires":[]},{"id":"2b9cf13.9eaf90e","type":"networkConfig","z":"","network":"MIJIN_TEST","customNetwork":""}]
jorisadri

Flow Info

created 3 months, 1 week ago

Node Types

Core
  • change (x5)
  • comment (x1)
  • debug (x3)
  • switch (x1)
Other

Tags

  • nem
  • nem2
  • blockchain
  • escrow
  • aggregate
  • transaction
  • catapult
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option