Skip to content

Instantly share code, notes, and snippets.

View adria0's full-sized avatar
💭
crustaceanin'

adria0.eth adria0

💭
crustaceanin'
View GitHub Profile
const IPFS = require('ipfs')
const Room = require('ipfs-pubsub-room')
window.ipfs = new IPFS({
init : true,
start : true,
config: {
Addresses: {
Swarm: [
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star'
@adria0
adria0 / gist:a6a8c8553835aa6bfddfdce5e975713e
Last active September 19, 2018 08:56
creació claus node
1) docker run -i -t ethereum/client-go:alltools-v1.8.15 /bin/sh
2) bootnode -genkey p2p.key
3) bootnode -nodekey p2p.key -writeaddress > p2p.address
p2p.key -> clau privada del node P2P
p2p.address -> clau publica del node P2P
4) geth account new
Address: {address}
@adria0
adria0 / crappytokens.sol
Created August 31, 2018 10:13
a collection of crappy tokens
pragma solidity ^0.4.24;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
@adria0
adria0 / hadhshake.md
Created August 3, 2018 13:11
hadhshake.md

Abstract

The foundation for the internet's security has relied upon trusted Certificate Authorities (CAs) which attest that a user is connecting to the correct server or node. This has created a reliance upon a handful of trusted actors, many of whom are for-profit corporations or other actors who may not have long-term incentive towards stewardship of the internet. The net-effect is a "1-of-m multisig" whereby if any one of the trusted CAs fail, the entire security of the internet fails. This failure has occurred and will continue to occur with the trusted-CA design, with catastrophic risks as more and more infrastructure

@adria0
adria0 / comments.md
Created July 10, 2018 21:39
Comments on blockparty smartcontract

https://github.com/makoto/blockparty/tree/61e0e1a6a7f010edbb2469739f3ff4c928e16425/contracts

  • global bool paid seems that is not used
  • require(now > endedAt + coolingPeriod); condition in Conference.clear() can be bypassed by using Destructible.destroy()
  • if owner key is lost, participants ether will be stuck in the contract forever
  • different coventions... uint256 vs uint , _XXX vs XXX naming in parameters
  • registered++; participantsIndex[registered] = msg.sender; the usual pattern is to use an array and not a vector for that, as also as starting with a 1 index.
// Threats
// - TX/Blockchain scan and registering offline
// - Sending code to other people (sending code)
// - Sybil attacks onsite
// - Sybil attacks offsite
// Main designs goal
// - Absolutely minimal implementation
@adria0
adria0 / aragon_mythril.txt
Created February 9, 2018 16:37
mythril results
root@4cd197a038d6:/opt/aragonOS# myth -t
Analysis result for CallsScript: No issues found.
Analysis result for APMRegistryFactory:
==== Integer Underflow ====
Type: Warning
Contract: APMRegistryFactory
Function name: _function_0xff289fc5
PC address: 14117
A possible integer underflow exists in the function _function_0xff289fc5.
The SUB instruction at address 14117 may result in a value < 0.
@adria0
adria0 / GometB
Last active January 18, 2018 17:27
GometA
pragma solidity ^0.4.18;
import "./GometBridge.sol";
contract GometParent is GometBridge {
event LogLockToChild(address from, uint value);
event LogUnlockFromChild(address to, uint value);
pragma solidity ^0.4.19;
contract GometBridge {
event LogTransactionCreated(bytes32 hash, uint nonce, bytes data);
event LogTransactionApproved(bytes32 hash, uint nonce, bytes data);
event LogTransactionDiscarded(bytes32 hash);
event LogTransactionRevoked(bytes32 hash);
event LogTransactionExecuted(bytes32 hash, uint nonce, bytes data, bytes32[] sigs);
@adria0
adria0 / gomet_genesis.json
Created January 9, 2018 21:24
gomet_genesis.json
{
"config": {
"chainId": 13902,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 4,
"clique": {