Skip to content

Instantly share code, notes, and snippets.

View djrtwo's full-sized avatar

danny djrtwo

  • Ctrl^T
  • New Orleans
View GitHub Profile
@djrtwo
djrtwo / casper_abi_v0.2.0.json
Created May 16, 2018 03:19
Casper Contract ABI for release v0.2.0
[{'name': 'Deposit', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'address', 'name': '_validation_address', 'indexed': False}, {'type': 'int128', 'name': '_start_dyn', 'indexed': False}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Vote', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'bytes32', 'name': '_target_hash', 'indexed': True}, {'type': 'int128', 'name': '_target_epoch', 'indexed': False}, {'type': 'int128', 'name': '_source_epoch', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Logout', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_end_dyn', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Withdraw', 'in
@djrtwo
djrtwo / reward-reduction.md
Created April 24, 2018 02:18
Analysis of Casper PoW Reward Reduction

Analysis of Casper PoW Reward Reduction

EIP 1011 - Hybrid Casper FFG proposes further reducing PoW block reward from 3 ETH to 0.6 ETH. The EIP briefly mentions that this is "because the security of the chain is greatly shifted from PoW difficulty to PoS finality and because rewards are now issued to both validators and miners." This document is to serve as an addendum to that statement, providing additional data, analysis, and arguments.

We aim to show that in Hybrid Casper FFG with an 80% reduction in block reward:

  • a PoW attack on the finality enabled chain cannot do much in comparison to a pure PoW attack
  • a pure PoW attack just as costly as other prominent PoW chains
  • there are options in the event of an attack
  • all of the above is a strong discouragement for an attack to be conducted in the meantime before full pos
@djrtwo
djrtwo / casper_runtime_bytecode_v0.2.0.hex
Created May 16, 2018 03:22
Casper Runtime Byte code for v0.2.0 release. `CASPER_CODE` in EIP 1011
0x600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526316d5c53d60005114156103105761010060046101403734156100b557600080fd5b606051600435806040519013585780919012156100d157600080fd5b50606051602435806040519013585780919012156100ee57600080fd5b506060516044358060405190135857809190121561010b57600080fd5b50606435602051811061011d57600080fd5b50608435602051811061012f57600080fd5b5060605160e4358060405190135857809190121561014c57600080fd5b506015541561015a57600080fd5b6101006101405112600061014051131661017357600080fd5b600061016051121561018457600080fd5b600261018051121561019557600080fd5b60006101e05112156101a657600080fd5b60006102005112156101b757600080fd5b600061022051136101c757600080fd5b60016015556101405160165561016051601755610180516018556101e051601b5561020051601c5561022051601d55600060a051601654
@djrtwo
djrtwo / attestation.txt
Created April 5, 2022 18:46
Attestation
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore16
Contributor # 71
Hash: af53f98f 92589863 7ce3c597 59b32e86
e0b36eb2 037e9fcf 344fd151 1d7f413b
deb06026 5b520093 0499069c 1eb41c4a
250e0ec8 31d29ea4 475d428d fda98090
@djrtwo
djrtwo / million_adds.py
Last active March 1, 2022 02:37
Time adding 1 million integers together. Run 1000 times and output average time.
import time
def exp():
adder = 0
start = time.time()
for i in range(1000000):
adder += 1
end = time.time()
return (end - start)

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@djrtwo
djrtwo / casper_abi_v0.1.0.json
Last active July 31, 2020 17:51
Casper Contract ABI for release v0.1.0
[{'name': 'Deposit', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'address', 'name': '_validation_address', 'indexed': False}, {'type': 'int128', 'name': '_start_dyn', 'indexed': False}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Vote', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'bytes32', 'name': '_target_hash', 'indexed': True}, {'type': 'int128', 'name': '_target_epoch', 'indexed': False}, {'type': 'int128', 'name': '_source_epoch', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Logout', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_end_dyn', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Withdraw', 'in
@djrtwo
djrtwo / dump_sanity_tests0.5.1.py
Created April 17, 2019 03:27
dump sanity tests from v0.5.1
import os
import sys
import build.phase0.spec as spec
from tests.phase0.helpers import (
create_genesis_state,
)
from tests.phase0.conftest import (
overwrite_spec_config,
@djrtwo
djrtwo / state_test_gen.py
Created April 17, 2019 03:25
tempory helper file used to generate state tests in v0.5.1
import build.phase0.spec as spec
from build.phase0.spec import (
hash_tree_root,
)
from build.phase0.utils.jsonize import jsonize
CONFIG_FIELDS = [
# Misc
"SHARD_COUNT",
import os
import sys
import build.phase0.spec as spec
from tests.phase0.helpers import (
create_genesis_state,
)
from tests.phase0.conftest import (
overwrite_spec_config,