Skip to content

Instantly share code, notes, and snippets.

View nolash's full-sized avatar

lash nolash

View GitHub Profile
@nolash
nolash / gist:c232e32e019ea1e78cf6a00f22dfc8a7
Last active May 8, 2019 13:08
Some thoughts on chats using with shuffling feed and pss locations

I am currently experimenting with a concept for chat rooms using a combination of swarm feeds and pss. And right now an idea has come up of enabling “band changes” in the chat updates that only the participants will know of.

Here’s some background on swarm feeds if necessary: ethersphere/swarm#881 and ethersphere/swarm#1332

I’ll try to keep this simple, some constraints:

  • We can exchange session public keys without outside entities associating them with identity used in initial discovery/connect.
  • We assume peer discovery and service discovery exists.
  • We assume we can promiscuously connect to pss nodes to send and receive in exchange for payment.
  • Consensus between peers on who chatroom participants are is out of scope.
@nolash
nolash / gist:9434ea24a71474bebcd0341c98685ff4
Last active September 6, 2020 21:47
POC bzzkey over ENR
package main
import (
"bytes"
"crypto/ecdsa"
"flag"
"fmt"
"io"
"math/rand"
"net"
@nolash
nolash / maparraybench_test.go
Created June 4, 2018 09:57
benchmark map versus array retrievals in go
package maparraybench
import (
"fmt"
"os"
"testing"
)
const (
itemCount = 100
@nolash
nolash / argon2_key.c
Last active May 21, 2018 00:29
example on encryption using libsodium kdf key
#include <stdio.h>
#include <sodium.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#define SUBKEYS_COUNT 8
#define SUBKEYS_SIZE crypto_secretstream_xchacha20poly1305_KEYBYTES
#define SUBKEYS_CONTEXT "foo"
@nolash
nolash / hasher_test.go
Created April 24, 2018 13:47
Benchmark swarm hash worker handling
package hasher
import (
"encoding/binary"
"math/rand"
"strconv"
"strings"
"sync"
"testing"
@nolash
nolash / gist:3a0294d7722cb89120757c473f2be026
Created April 24, 2018 08:24
swarm throttling with iptables + tc
#!/bin/bash
UID=$1
iptables -A OUTPUT -t mangle -m owner --uid-owner $UID -j MARK --set-mark 6
tc qdisc add dev enp2s0 root handle 1: htb default 30
tc class add dev enp2s0 parent 1: classid 1:1 htb rate 6mbit burst 15k
tc class add dev enp2s0 parent 1: classid 1:2 htb rate 1mbit burst 15k
tc filter add dev enp2s0 protocol ip parent 1:0 prio 1 handle 6 fw flowid 1:2
@nolash
nolash / README_truebit_simple.md
Last active April 2, 2018 16:58
Working build configuration for truebit proof-of-concept "coindrop" example

EMSCRIPTEN SETUP

https://github.com/juj/emsdk @ 2324e5d8

  • LLVM_CMAKE_ARGS="-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly" emsdk install sdk-tag-1.37.28-64bit (be patient!)

To activate correct paths for emscripten and dependencies use:

  • ./emsdk activate sdk-tag-1.37.28-64bit
  • ./emsdk_env.sh
@nolash
nolash / raw.go
Last active December 8, 2017 06:40
Ethereum raw eth transaction
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"math/big"
"os"
"os/user"
@nolash
nolash / startswarm.sh
Last active December 3, 2017 23:27
Script for polling bzzd.ipc when starting swarm
#!/bin/bash
function killswarm {
kill -TERM $1
exit 1
}
# take the newest key if none is given
function latest_key {
echo -n `find $1/keystore -regex ".*--[a-fA-F0-9].*" | sort -r | head -n1 | sed -e 's/.*Z--\([a-fA-F0-9]*\)$/\1/g'`
@nolash
nolash / telegram-req_pq.c
Last active December 3, 2017 00:58
Telegram req_pq
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <openssl/rand.h>
#include <zlib.h>
#include <math.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>