Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Sep 10, 2024
1 parent b0af5d8 commit e21f1a3
Show file tree
Hide file tree
Showing 8 changed files with 4,649 additions and 7 deletions.
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Minimal library for Ethereum transactions, addresses and smart contracts.
- 🔓 Secure: 3 deps, audited [noble](https://paulmillr.com/noble/) cryptography, no network code
- 🔻 Tree-shakeable: unused code is excluded from your builds
- 🔍 Reliable: 150MB of test vectors from EIPs, ethers and viem
- ✍️ Create, sign and decode transactions using human-readable hints
- 🌍 Fetch balances and history from an archive node
- 🆎 Call smart contracts: Chainlink and Uniswap APIs are included
- 🦺 Typescript-friendly ABI, RLP and SSZ decoding
- 🪶 1200 lines for core functionality
- ✍️ Transactions: create, sign, decode with human-friendly hints
- 🆎 Execute contracts in JS: includes Chainlink and Uniswap APIs
- 🦺 Typescript-friendly: ABI parsing, RLP, SSZ, KZG proof generation & verification
- 🌍 Archive-node-friendly: fetch balances & history
- 🪶 Lightweight: 1200 lines for core functionality

Check out article [ZSTs, ABIs, stolen keys and broken legs](https://github.com/paulmillr/micro-eth-signer/discussions/20) about caveats of secure ABI parsing found during development of the library.

Expand Down Expand Up @@ -40,6 +40,7 @@ If you don't like NPM, a standalone [eth-signer.js](https://github.com/paulmillr
- [RLP parsing](#rlp-parsing)
- [SSZ parsing](#ssz-parsing)
- Utilities
- [KZG EIP-4844 proofs](#kzg-eip-4844-proofs)
- [Send whole account balance](#send-whole-account-balance)
- [Sign and verify messages](#sign-and-verify-messages)
- [Security](#security)
Expand Down Expand Up @@ -372,6 +373,33 @@ const isValid = messenger.verify(sig, msg, address);

### Utilities

#### KZG EIP-4844 proofs

```ts
import { KZG } from 'micro-eth-signer/kzg';
import mainnetSetup from 'micro-eth-signer/kzg-mainnet';

const kzg = new KZG(mainnetSetup);
// kzg.computeProof(blob, z);
// kzg.verifyBlobProof(blobs, commitments, proofs);
```

All methods:

```ts
type Blob = string | string[] | bigint[];
type Scalar = string | bigint;
export declare class KZG {
constructor(setup: SetupData);
computeProof(blob: Blob, z: bigint | string): [string, string];
verifyProof(commitment: string, z: Scalar, y: Scalar, proof: string): boolean;
blobToKzgCommitment(blob: Blob): string;
computeBlobProof(blob: Blob, commitment: string): string;
verifyBlobProof(blob: Blob, commitment: string, proof: string): boolean;
verifyBlobProofBatch(blobs: string[], commitments: string[], proofs: string[]): boolean;
}
```

#### Send whole account balance

```ts
Expand Down
2 changes: 1 addition & 1 deletion build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
"import": "./esm/address.js",
"require": "./address.js"
},
"./kzg": {
"import": "./esm/kzg.js",
"require": "./kzg.js"
},
"./kzg-mainnet": {
"import": "./esm/kzg-mainnet.js",
"require": "./kzg-mainnet.js"
},
"./net": {
"import": "./esm/net/index.js",
"require": "./net/index.js"
Expand Down
4,184 changes: 4,184 additions & 0 deletions src/kzg-mainnet.ts

Large diffs are not rendered by default.

Loading

0 comments on commit e21f1a3

Please sign in to comment.