Last active
May 10, 2022 00:56
-
-
Save aunyks/55c206194a3a5e52450593077553aa03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require('request'); | |
| function createTransaction(fromAddress, toAddress, amount, peerUrl){ | |
| // Send a post request | |
| request.post( | |
| // ...to the provided url | |
| peerUrl, | |
| { | |
| // ...in JSON | |
| json: { | |
| from: fromAddress, | |
| to: toAddress, | |
| amount: amount | |
| } | |
| }, | |
| function (error, response, responseBody) { | |
| if (!error && response.statusCode == 200) { | |
| // ...and output the response to the console | |
| console.log(responseBody) | |
| } | |
| } | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment