Skip to content

Instantly share code, notes, and snippets.

View bonedaddy's full-sized avatar
🌷
pfSense > cisco

bonedaddy bonedaddy

🌷
pfSense > cisco
View GitHub Profile

Answers to Deep Questions about Solidity

The following list of questions was taken from https://www.reddit.com/r/ethereum/comments/72reba/do_you_have_deep_questions_about_solidity_or_the/

An updated summary on the different ways one could have two contracts interact (DELEGATECALL, STATICCALL, libraries, all that stuff) with clear pros/cons for each (gas cost, whether it requires EVM assembly directives, etc)

Question by /u/drcode

I won't talk about low-level opcodes here because of the brevity of the answer. In general, there are four ways functions can be called in Solidity:

@bonedaddy
bonedaddy / aes_encryption.go
Created July 9, 2018 04:37 — forked from stupidbodo/aes_encryption.go
AES Encryption Example in Golang
// Playbook - http://play.golang.org/p/3wFl4lacjX
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
@bonedaddy
bonedaddy / rabbitmq-cluster.md
Created January 19, 2019 19:52 — forked from pobsuwan/rabbitmq-cluster.md
How to config rabbitmq server cluster [3 nodes]

How to config rabbitmq server cluster [3 nodes]

Do after install SLGInstallers

Edit /etc/hosts

vi /etc/hosts
192.168.10.157  rabbitmq-1
192.168.10.159  rabbitmq-2
192.168.10.161  rabbitmq-3
@bonedaddy
bonedaddy / toy-bleve-example.go
Created May 3, 2019 07:49 — forked from indraniel/toy-bleve-example.go
This is a toy search example using bleve. It also highlights how to retrieve the orignal input document(s) from the KV store.
package main
// mentioned in bleve google group
// https://groups.google.com/forum/#!topic/bleve/-5Q6W3oBizY
import (
"encoding/json"
"fmt"
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/document"
@bonedaddy
bonedaddy / TwoMethods.md
Created August 15, 2019 01:53 — forked from bloc97/TwoMethods.md
Two Fast Methods of Generating True Random Numbers on the Arduino

Two Fast Methods of Generating True Random Numbers on the Arduino

Arduino true random number generator

B. Peng

December 2017

Abstract

The AVR series microcontrollers are a collection of cheap and versatile chips that are used in many applications ranging from hobbist projects to commercial infrastructure. One major problem for some hobbists is the lack of secure random number generation on the Arduino platform. The included pseudo-random number generator (PRNG) is very easy to defeat and is useless for any crypto-related uses. One recommendation from the Arduino Reference Manual is to use atmospheric noise from the chip's analog sensor pins as seed data[6].
Unfortunately this method is extremely weak and should not be used to emulate a true random number generator (TRNG). Existing methods such as using the internal timer drift or using a dedicated generator are either too slow, requires extensive external hardware or modifications to the microcontroller's internal mech

@bonedaddy
bonedaddy / account.js
Created November 2, 2019 10:35 — forked from Bluebie/account.js
Partially encrypted account model for IPFS app
// Model to represent an account in the distributed database
// Accounts are mainly a place users can store information like their private keys, in a password protected
// vault, so they can login conveniently from other devices and keep hold of their private keys and record
// what blogs they are authors of. It's also a way for other users to lookup an authors public keys to validate
// their other objects when determining if a new version of some data really belongs to the blog it claims to be
// related to.
const nacl = require('tweetnacl')
const cbor = require('borc')
class HSAccount {
@bonedaddy
bonedaddy / filecoin-network-stats-bug.md
Last active November 14, 2019 04:23 — forked from Schwartz10/filecoin-network-stats-bug.md
Bug in filecoin-network-stats description

Chainsaw fetches a block with tipset bafy2bzaceaxd64ic4e36kbkn3apxdbjkknrdar7kozc552pd55aurowy5kocs and block height 4684. One of the messages in this block represents an addAsk method. The param passed to this method chokes up when it gets decoded https://github.com/openworklabs/filecoin-network-stats/blob/master/backend/src/client/ABI.ts#L68.

Essentially the param passed in the message gets “chunked” into 2 buffers, the second of which appears to be an empty buffer, which goes on to get decoded by the BigIntDecoder https://github.com/openworklabs/filecoin-network-stats/blob/master/backend/src/client/ABI.ts#L22. The BigIntDecoder attempts to decode the empty buffer, but returns “NaN” instead. This causes the message to become malformed, it looks like this:

  { 
    height: 4684,
    tipsetHash:
     'bafy2bzaceaxd64ic4e36kbkn3apxdbjkknrdar7kozc552pd55aurowy5kocs',
    index: 2,
@bonedaddy
bonedaddy / future.c
Created February 4, 2020 04:45 — forked from Geal/future.c
small future and promise library in C with pthreads
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <stdbool.h>
#include <time.h>
#include <stdarg.h>
#include <string.h>
#include "future.h"
@bonedaddy
bonedaddy / cgo.md
Created February 5, 2020 23:19 — forked from zchee/cgo.md
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.