Skip to content

Instantly share code, notes, and snippets.

View meyer9's full-sized avatar
🏠
Working from home

Julian Meyer meyer9

🏠
Working from home
View GitHub Profile

== Blockchain == getbestblockhash getblock "hash" ( verbose ) getblockchaininfo getblockcount getblockhash index getblockheader "hash" ( verbose ) getchaintips getdifficulty getmempoolinfo

@meyer9
meyer9 / phore.diff
Created November 28, 2017 17:14
Difference between Phore headers and PIVX headers
diff -ENwbur pivxheaders/accumulatormap.h phoreheaders/accumulatormap.h
--- pivxheaders/accumulatormap.h 2017-11-28 09:12:03.000000000 -0800
+++ phoreheaders/accumulatormap.h 2017-11-28 09:12:27.000000000 -0800
@@ -1,8 +1,8 @@
// Copyright (c) 2017 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#ifndef PIVX_ACCUMULATORMAP_H
-#define PIVX_ACCUMULATORMAP_H
+#ifndef PHORE_ACCUMULATORMAP_H
@meyer9
meyer9 / deserialize_tx.py
Created June 7, 2018 20:53
Deserialize a Bitcoin transaction
import sys
import struct
WITNESS = 1
class RawTransaction:
def __init__(self, tx_data):
self.tx_data = bytearray.fromhex(tx_data)
def __str__(self):
return self.tx_data.hex()
@meyer9
meyer9 / tpos-sec.md
Last active August 5, 2018 23:25
Security Analysis of TPoS

Note to XSN devs: Not to dwell on TPoS, but I'm on vacation and have nothing better to do than analyze protocols of other coins.

Introduction

I'm arguing against XSN's claim that TPoS increases network security. It either decreases or does not change security.

We'll analyze how much it costs for an attacker to attack the network through a 51% attack by either buying up 51% of coins or bribing 51% of staking power. Note that the second scenario is much more applicable to Proof-of-Stake because market liquidity generally prevents buying 51% of the coins in any economically-efficient attack, so we'll focus on that.

The second scenario is easier because users do not have to give away/sell their coins to participate in the attack. Users simply have to act like the attacker asks. (Download a different client)

TPoS enables stakers to allow others to stake their coins for a (generally) small commission.

diff --git a/src/crypter.cpp b/src/crypter.cpp
index d3866652b..55eeb6645 100644
--- a/src/crypter.cpp
+++ b/src/crypter.cpp
@@ -259,7 +259,7 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
uint256 hashSeed;
if (CWalletDB(pwalletMain->strWalletFile).ReadCurrentSeedHash(hashSeed)) {
-
+ LOCK(pwalletMain->cs_wallet);
sha256(transaction_id + output_index + time + block_header) < difficulty * transaction_value
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDdN41lde3vUp+u1P434DIiai0kMgL+KEq7FAbI0PYwlZnnl5Oq7Fio8lK0QYl42Eiqpczcimn6GFiEeOmd21FP5Ens5yYhV0trfe2mjULf0EavPqCK+41nHoVZzJZDHsBWrldRhojQNEVCQJOO5X7nmg7/saZv4/mmiWZ2qchkraHc5bJMeOkmdSy7grk3c3JvCYTAXxBKUcuofTJnmJmgr7+K00wSVSMk7B/4HesyBusDkqA6QSl0omZFlyw07u8cgUmmp4bKoexY/JZ5AayRIzisTNMQm7sZ1Fge3NhwSukzTQcRyc+8hScGdzTBqrNIKBbE0mJuS8m+dXB+Q3CJ julian@cameran-desktop

Keybase proof

I hereby claim:

  • I am meyer9 on github.
  • I am meyer9 (https://keybase.io/meyer9) on keybase.
  • I have a public key ASBtv1P2LiSqJjlEGYODoIYvXSsmRh5DzbNj73Z6RHqO0go

To claim this, I am signing this object:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDdN41lde3vUp+u1P434DIiai0kMgL+KEq7FAbI0PYwlZnnl5Oq7Fio8lK0QYl42Eiqpczcimn6GFiEeOmd21FP5Ens5yYhV0trfe2mjULf0EavPqCK+41nHoVZzJZDHsBWrldRhojQNEVCQJOO5X7nmg7/saZv4/mmiWZ2qchkraHc5bJMeOkmdSy7grk3c3JvCYTAXxBKUcuofTJnmJmgr7+K00wSVSMk7B/4HesyBusDkqA6QSl0omZFlyw07u8cgUmmp4bKoexY/JZ5AayRIzisTNMQm7sZ1Fge3NhwSukzTQcRyc+8hScGdzTBqrNIKBbE0mJuS8m+dXB+Q3CJ julian@cameran-desktop
@meyer9
meyer9 / transactioncoding.py
Last active March 7, 2024 21:54
Bitcoin transaction decoding/encoding
import sys
import struct
WITNESS = 1
from test_framework.script import *
class RawTransaction:
def __init__(self, tx_data):
self.tx_data = bytearray.fromhex(tx_data)