Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. const express = require('express');
  2. const golos = require('golos');
  3. //const golos = require('steem');
  4. const app = express();
  5.  
  6. var username = 'nikitavelesevich',
  7. password = 'P5JhQ13gpGf1C7kutZfardugM1NTKwiWf552LtJfZJDNyt72okM3';
  8. var wif = 'GLS5KtEb9UCjyhErj6AEoYDcb76oaDTjXX6qJ9bLf9rweNW1QoFFc'; //golos.auth.toWif(username, password, 'posting');
  9. var keys = golos.auth.generateKeys(username, password, ['posting'])
  10.  
  11.  
  12. /**
  13. * comment() add a post
  14. * @param {Base58} wif - private posting key
  15. * @param {String} parentAuthor - for add a post, empty field
  16. * @param {String} parentPermlink - main tag
  17. * @param {String} author - author of the post
  18. * @param {String} permlink - url-address of the post
  19. * @param {String} title - header of the post
  20. * @param {String} body - text of the post
  21. * @param {String} jsonMetadata - meta-data of the post (images etc.)
  22. */
  23. golos.api.getBlock('29404', function(err, result) {
  24. console.log(err, result);
  25. });
  26. var wif = '5J7hT52s4yYLop5JMNu4oRLoBVtNABG74XbG88m7t7VvpD7f1pS';//keys['posting'];
  27. var parentAuthor = '';
  28. var parentPermlink = 'vox-populi';
  29. var author = username;
  30. var permlink = 'test-url';
  31. var title = 'test';
  32. var body = 'test2';
  33. var jsonMetadata = '{}';
  34.  
  35. var commentPermlink = golos.formatter.commentPermlink(parentAuthor, parentPermlink).toLowerCase();
  36. console.log(commentPermlink);
  37. // => 're-ned-a-selfie-20170621t080403765z'
  38.  
  39. golos.broadcast.comment(wif, parentAuthor, parentPermlink, author, commentPermlink, title, body, jsonMetadata, function(err, result) {
  40. //console.log(err, result);
  41. if (!err) {
  42. console.log('comment', result);
  43. }
  44. else console.error(err);
  45. });
  46.  
  47. app.get('/', (req, res) => res.send('Hello World!'));
  48.  
  49. app.listen(8000, () => console.log('Example app listening on port 8000!'))
  50.  
  51. /*
  52. 29404
  53. re--vox-populi-20180225t003631495z
  54. Example app listening on port 8000!
  55. comment { ref_block_num: 29672,
  56. ref_block_prefix: 1199962799,
  57. expiration: '2018-02-25T00:36:46',
  58. operations: [ [ 'comment', [Object] ] ],
  59. extensions: [],
  60. signatures:
  61. [ '1f5144b71bbda6e77dab5647e110bc7d0c8c913ced7c500b9dd2addcf5f6ba87ed0cb0e985a388d927eb986d51ecccb64b3e68ce279699b0bd1bdcccf14040adab' ] }
  62. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement