Skip to content

Instantly share code, notes, and snippets.

View ninabreznik's full-sized avatar
🐝
Building the future

Nina Breznik ninabreznik

🐝
Building the future
View GitHub Profile
@ninabreznik
ninabreznik / log.bash
Created September 10, 2020 01:53
p2plex log
peer2 startup +0ms
peer1 startup +0ms
peer1 {
peer1 from: 'peer2',
peer1 peerKey: {
peer1 type: 'Buffer',
peer1 data: [
peer1 8, 64, 243, 28, 211, 46, 157, 17,
peer1 88, 173, 3, 183, 188, 140, 195, 163,
peer1 55, 250, 30, 132, 141, 157, 191, 73,
@ninabreznik
ninabreznik / peer2.js
Created September 10, 2020 01:50
p2plex peer2
const debug = require('debug')
const getChatAPI = require('./chatapi')
const { seedKeygen } = require('noise-peer')
const SDK = require('dat-sdk')
const p2plex = require('p2plex')
const sodium = require('sodium-universal')
const pump = require('pump')
const ndjson = require('ndjson')
const { PassThrough } = require('stream')
@ninabreznik
ninabreznik / peer1.js
Created September 10, 2020 01:45
p2plex Peer1
const debug = require('debug')
const getChatAPI = require('./chatapi')
const { seedKeygen } = require('noise-peer')
const SDK = require('dat-sdk')
const p2plex = require('p2plex')
const sodium = require('sodium-universal')
const pump = require('pump')
const ndjson = require('ndjson')
const { PassThrough } = require('stream')
const Hypercore = require('hypercore')
@ninabreznik
ninabreznik / readFeed.js
Last active August 26, 2020 14:52
Read feed
const Hypercore = require('hypercore')
const reallyReady = require('hypercore-really-ready')
const ram = require('random-access-memory')
const hyperswarm = require('hyperswarm')
const swarm = hyperswarm()
const feedkey = '49ca10ed402f7385466c6dcea59a0169585765a289d972f0498cc6d200616637'
const swarmkey = 'b69ffcfbdc4dae9d9d8df33adec6f4386db41c292e62c9e0759e2950ea95fc05'
goReader(feedkey, swarmkey)
@ninabreznik
ninabreznik / makeFeed.js
Created August 20, 2020 15:21
MakeFeed
const Hypercore = require('hypercore')
const reallyReady = require('hypercore-really-ready')
const ram = require('random-access-memory')
const hyperswarm = require('hyperswarm')
makeFeed()
// MAKE FEED and SEED IT
async function makeFeed () {
ninabreznik@comp ~/Documents/code/play/datdotorg/datdot/service $ node cli.js
[chatserver] running on http://localhost:8000 +0ms
[fakechain] running on http://localhost:8080 +0ms
[alice] start: {
name: 'alice',
roles: [ 'peer', 'sponsor', 'publisher', 'attestor' ]
} {
chain: [ 'ws://localhost', '8080' ],
chat: [ 'ws://localhost', '8000' ]
} +0ms
@ninabreznik
ninabreznik / Dockerfile
Last active March 2, 2020 03:51
Substrate dockerfile (updated 01.03.2020)
# ===== FIRST STAGE ======
FROM phusion/baseimage:0.11 as builder
ARG PROFILE=release
WORKDIR /substrate
COPY ./substrate /substrate
ninabreznik@comp ~/Documents/code/play/datdotorg/service $ node index.js
Unknown types found, no types for ActiveRecovery,ChangesTrieConfiguration,RecoveryConfig
Archive array is: [
<Buffer c5 57 de 1d 88 ab c6 21 22 4d 9f 57 de 3f 58 cf 64 d6 ea 53 15 d4 ad 8a bd 78 b7 43 7b 79 f7 56>,
{ hashType: 2, children: [ [Object], [Object], [Object] ] },
<Buffer 0a 5e 6d 96 ca 0e e4 d3 d5 53 04 4f f1 9d c0 6e 1e 5d 39 06 d6 e4 b0 db d1 81 be f4 87 12 98 0a 18 fa f0 9c cb fe d2 0c 02 14 b7 69 68 97 33 05 5c 8f ... 14 more bytes>
]
You are connected to chain Development using substrate-node v2.0.0
Chain is at block: #10
Alice 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
pragma solidity ^0.5.1;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
const hypercore = require('hypercore')
const hypertrie = require('hypertrie')
const ram = require('random-access-memory')
const { ClientSwarm } = require('hyperswarm-ws')
const eos = require('end-of-stream')
const dat = 'e7cc14d1f92fc7058d5fc5d5ad6ce450f7b1d9ea67154dbd20ab91b59d9f1104'
const swarm = new ClientSwarm('ws://localhost:4200')