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
[Unit] | |
After=network.target | |
[Service] | |
ExecStart=/usr/bin/node /home/ubuntu/project/app.js | |
ExecStop=/bin/kill -s INT $MAINPID | |
ExecReload=/bin/kill -s HUP $MAINPID | |
User=ubuntu | |
Group=ubuntu | |
WorkingDirectory=/home/ubuntu/project |
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
{ | |
"since": 7380137, | |
"addresses": [ | |
"0x8c6b04da932d1151e0e1c65f3d8b12a971e02b17", | |
"0xd04a779f681014832013a5cc58bfafafa26cbaf5", | |
"0x439aa60d35338b01e7ce16b98469c26dd8a79b52", | |
"0x904224d70521a09aC117CD499F6B4A68aBc5B852" | |
], | |
"transactions": [ | |
{ |
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
const net = require('net') | |
// Server side | |
const server = net.createServer({ allowHalfOpen: true }, function (socket) { | |
console.log('[server side] new connection') | |
socket.on('data', function (data) { | |
console.log('[server side] received:', data.toString()) | |
socket.write('server says hey') |
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
const Hypercore = require('hypercore') | |
const Hyperswarm = require('hyperswarm') | |
const ram = require('random-access-memory') | |
const core = new Hypercore(ram, process.argv[2], { | |
valueEncoding: 'json' | |
}) | |
main() |
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
const Hypercore = require('hypercore') | |
const RAM = require('random-access-memory') | |
const core = new Hypercore(RAM) | |
// console.log(core) | |
main().then(() => { | |
console.log('main ended') // it doesn't reach this line | |
}) |
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
const DHT = require('@hyperswarm/dht') | |
const keyPairServer = DHT.keyPair() | |
main() | |
async function main () { | |
const node1 = new DHT() | |
const node2 = new DHT() | |
await node1.ready() |