Skip to content

Instantly share code, notes, and snippets.

@danfinlay
danfinlay / event-resources.md
Created June 16, 2023 15:37
Here are some resources you can use when listing me on your event page

Dan Finlay Event Resources

Here are some resources you can use when listing me on your event page:

Avatar

avatar

Bio

@danfinlay
danfinlay / capped_wisps.md
Last active April 13, 2020 21:04
Capped Wisp Account
  • Goal:
    • An [[Ethereum]] smart account architecture composed from a very small and simple pattern of flexible delegation with maximally off-chain, low-state contracts.
  • Axioms / Dependencies / Prior Art / Prerequisites & Tools
    • [[gnosis-safe style module]]s
      • Each module can call any function on the parent contract.
    • [[create2]] deterministic addressing
      • Account can delegate to unpublished contracts.
    • [[Will-o-wisps]]
  • Stateless delegations can clean themselves up, leaving no state-bloat on-chain.
@danfinlay
danfinlay / eth_raw_sign.md
Created March 9, 2020 19:17
Low level signing method roadmap
  • low-level signing method
    • Things that need to be done
      • Consider this kind of raw signing from security. Ask [[Christian Lundkvist]]
      • Consider drafting an EIP for this, so it can get broader security consideration.
    • Code that would need to be changed
  • MetaMask Controller
@danfinlay
danfinlay / map-func-identity.js
Created November 21, 2019 19:40
Proof that JavaScript maps index functions by identity, not source string.
const funcString = '() => "foo"';
const funcA = new Function(funcString);
const funcB = new Function(funcString);
const map = new Map();
map.set(funcA, 'a');
map.set(funcB, 'b');
const aVal = map.get(funcA);
console.log(aVal === 'a');
did:muport:QmRirsVfbq9KhAYjrTeWKBcEyTaJ6LLtjLBQkJX2cGwjQo
@danfinlay
danfinlay / signTypedData_testCases.md
Created August 30, 2019 18:01
signTypedData test cases

signTypedData Test Cases

signTypedData_v1 (aka signTypedData in the MetaMask provider)

  • privKey: 4af1bceebf7f3634ec3cff8a2c38e51178d5d4ce585c52d6043e5e2cc3418bb0
  • param: [ { type: 'string', name: 'message', value: 'Hi, Alice!' } ]
  • signature: 0x49e75d475d767de7fcc67f521e0d86590723d872e6111e51c393e8c1e2f21d032dfaf5833af158915f035db6af4f37bf2d5d29781cd81f28a44c5cb4b9d241531b

signTypedData_v3 (aka EIP 712 spec, aka ethSigUtil.signTypedData for bad reasons)

@danfinlay
danfinlay / request-perms.js
Last active August 8, 2019 19:14
json-rpc-capabilities-middleware example usage via MetaMask
const requestedPermissions = {
eth_accounts: {},
eth_sendTransaction: {},
eth_decrypt: {},
};
async function main () {
const provider = window.ethereum
await provider.enable({ requestedPermissions });
await provider.send({ method: 'eth_sendTransaction', parameters:[{ to: me, value: aModestSum }] });
@danfinlay
danfinlay / pge-logic.csv
Created November 15, 2018 16:53
A pros-cons table to performing preventative maintenance for a corporation.
Do maintenance Pocket money
Get paid less Get paid more
Maybe prevent someone else's fire Aw it won't happen!
Your civic duty Worst case scenario the company goes under! you'll be fine.
@danfinlay
danfinlay / plugin.js
Created October 5, 2018 04:40
Quick mockup for a simple plugin system
console.log('plugin loaded!')
window.parent.postMessage('PLUGIN ping', '*', false)
window.addEventListener('message', function (e) {
console.log('PLUGIN RECEIVED', e )
window.parent.postMessage('PLUGIN pong', '*', false)
})
@danfinlay
danfinlay / collateral-cash.md
Last active September 29, 2023 15:43
A code-free introduction to a blockchain-minimized digital social collateral system.

CounterFactual Social Collateral Cash

A code-free introduction to a blockchain-minimized digital social collateral system.

Imagine a situation where Alice has an account with $100 in it. This is a special kind of account that allows her to give out special spending limit codes to her friends which allow them to in turn to give out their own spending-limit codes.

For example, imagine this set of signed messages:

  • “Bob may withdraw up to $100 from my account” - Alice, signed 5/8/2018
  • “Carol may withdraw up to $50 of my allowance from Alice” - Bob, signed 7/6/2018 (includes reference to previous Alice message)