Skip to content

Instantly share code, notes, and snippets.

@alex-miller-0
alex-miller-0 / sign-validator-exits.py
Last active April 27, 2023 16:05
Pre-sign validator exits as insurance against hardware failure for an ETH staker
# It may be a good idea to pre-sign exit messages so that if your staking setup
# encounters a hardware failure or goes down for some long period of time, you
# can safely exit and restrict penalties to only the few days in the exit queue.
# This script will sign (but NOT broadcast) exits for each of your validators
# and will write the result to a local file.
# NOTE: Be careful with this file. If someone obtains it, they can exit your
# validators for you (though they can't steal any money unless they have access
# to your withdrawal key).
# NOTE: This was designed for use with Lighthouse. It will need to be updated
# for use with other clients.
@alex-miller-0
alex-miller-0 / check_validator_proposal_duties.py
Last active April 20, 2023 19:17
Upcoming Ethereum Validator Proposal Duties (Lighthouse)
# Validator proposals are determined two epochs (~12 min) in advance, so we
# can do a quick check and see if any of our validators have upcoming proposals.
# This is helpful for determining when to restart our consensus client, as it
# will force the validators offline for two epochs.
# NOTE: This was designed for use with Lighthouse. It will need to be updated
# for use with other clients.
from datetime import datetime, timezone
from math import trunc
import json
import os
@alex-miller-0
alex-miller-0 / gridplus_abi_builder.js
Last active June 14, 2021 16:18
GridPlus ABI pack builder
/*
This is a node.js script to generate GridPlus ABI packs, which are generally uploaded to a public S3 bucket and
installable via the GridPlus Web Wallet (wallet.gridplus.io). You will need to have `gridplus-sdk` and `superagent`
installed to run this script.
To add more packs, take a look at the formatting of the existing ones (e.g. `UNISWAP_PACK`) and replicate that format:
* `address` - smart contract address. This script scans mainnet by default, though in theory you could modify
it to scan contracts on a different network.
* `app` - the human readable name of the app or set of contracts. This is what gets displayed on web.gridplus.io
* `fname` - the file name where this will be saved: `./abi_packs/<fname>.json`

Keybase proof

I hereby claim:

  • I am alex-miller-0 on github.
  • I am crypto_alex (https://keybase.io/crypto_alex) on keybase.
  • I have a public key ASCNZTxlnnSURcR1AS2PG7TTnv2A7VJOybMnwhecbfGLago

To claim this, I am signing this object:

@alex-miller-0
alex-miller-0 / metaNFT.md
Created March 6, 2018 00:41
Meta-Non-Fungible Token

Meta-Non-Fungible Token

Non-fungible tokens (NFTs) are all the rage these days, but their current manifestation (ERC721) is inefficient. It is not possible to move multiple tokens at the same time or package multiple tokens for e.g. deposit into a plasma child chain.

Contract pseudocode

The following is a new design for an NFT token that allows aggregation of assets. The rest of the functionality can be inherited from ERC721.

contract NFT {
 tokens mapping(address =&gt; mapping(bytes32 =&gt; uint));
@alex-miller-0
alex-miller-0 / plasma-withdrawal-mockup.sol
Created March 1, 2018 20:04
Mockup of withdrawals in a UTXO plasma system
struct Deposit {
address to;
uint value;
}
struct Withdrawal {
uint status; // number (timestamp) = started, 2 = finished, 3 = failed
address owner;
uint value;
}
mapping (bytes32 => Deposit) deposits;
@alex-miller-0
alex-miller-0 / eth-utxo.md
Last active February 3, 2024 15:20
UTXO tokens on Ethereum

Suppose we wish to model a UTXO system on the EVM. We need to represent UTXO tokens such that all value is preserved when tokens are spent. Note: For this example, we are not concerned about the security of the system and are satisfied with giving authorities the power to create tokens (e.g. as in a plasma system).

Consider the following object:

{
  owner: <address>,
  value: <uint>,
0x3db2ABc7efa4f8E053EbC24B699E14E75F61bBd8
Loading SOFC webpage locally
1) Navigate to the directory with this document in your terminal.
2*) Run the command:
python -m SimpleHTTPServer
3) Open your browser and navigate to the address: