Skip to content

Instantly share code, notes, and snippets.

@djma
djma / EthereumMessageSigningDemo.java
Last active September 25, 2023 06:11
Ethereum EIP-712 message signing and address recovery with web3j
import java.math.BigInteger;
import java.security.SignatureException;
import org.web3j.crypto.ECKeyPair;
import org.web3j.crypto.Keys;
import org.web3j.crypto.Sign;
import org.web3j.utils.Numeric;
/**
* This runnable demo summarizes my understanding of this gist after spending a
@djma
djma / dune_query
Last active October 13, 2024 23:28
2023-05-10 10m
with erc20_value as (
select
wallet_address,
sum(cast(amount_raw as double) / pow(10, p.decimals)) as balance,
sum(cast(amount_raw as double) / pow(10, p.decimals) * p.price) as value_usd,
token_address,
p.symbol
from transfers_ethereum.erc20 t
-- left join tokens.erc20 tok on t.token_address = tok.contract_address
left join prices.usd_latest p on t.token_address = p.contract_address
@djma
djma / README.txt
Created June 24, 2023 17:01
In-browser proof of group membership with spartan-ecdsa
This is example code to generate a zk-proof that you know the ecdsa private key to either
1) an ecdsa public key part of a merkle set
2) an ethereum address part of a merkle set
Public inputs:
- Merkle root
- Message hash
Private inputs:
- Merkle path