Skip to content

Instantly share code, notes, and snippets.

@aunyks
Last active May 10, 2022 00:56
Show Gist options
  • Select an option

  • Save aunyks/55c206194a3a5e52450593077553aa03 to your computer and use it in GitHub Desktop.

Select an option

Save aunyks/55c206194a3a5e52450593077553aa03 to your computer and use it in GitHub Desktop.
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