var DHT = require('bittorrent-dht') var dht = new DHT() var value = new Buffer(11).fill('hello world') console.log('putting data, please wait...') dht.on('ready', function () { dht.put({ v: value }, function (errors, hash) { console.error('errors=', errors) console.log('hash=', hash) console.log('getting data, please wait...') dht.get(hash, function(errors, res){ console.error('errors=', errors) console.log(res.v.toString()) }) }) })