Skip to content

Instantly share code, notes, and snippets.

View bergkvist's full-sized avatar

Tobias Bergkvist bergkvist

  • Sr. Software Engineer @ Irreducible
  • Oslo, Norway
View GitHub Profile
@bergkvist
bergkvist / eth2spec-shell.nix
Last active September 24, 2023 22:52
eth2spec 1.4.0-beta.2 environment (https://github.com/ethereum/consensus-specs) with jupyterlab in nix.
# To get started:
# 1. Copy this into a file called `shell.nix` locally
# 2. Install nix (https://nix.dev/tutorials/install-nix)
# 3. Type nix-shell --run "jupyter lab"
# 4. Create a new Python notebook by clicking on the button in the browser UI
# 5. Put `import eth2spec.capella` into a cell and press Shift+Enter
# 6. Put `eth2spec.capella.mainnet.BeaconBlock()` into the next cell and press Shift+Enter
{ pkgs ? import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.05.tar.gz";
@bergkvist
bergkvist / fireblocks-mpc-lib-wasm32-wasi.nix
Last active October 27, 2023 01:51
Fireblocks MPC compiled to wasm32-wasi using zig
# How to use:
# 1. Make sure you have nix installed (https://nix.dev/install-nix)
# 2. Download this file, and name it for example `fireblocks-mpc-lib-wasm32-wasi.nix`
# 3. Run `nix-shell fireblocks-mpc-lib-wasm32-wasi.nix`.
# 4. Run `wasitest` inside the nix-shell environment to run the paillier benchmark.
{ pkgs ? import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/51d906d2341c9e866e48c2efcaac0f2d70bfd43e.tar.gz";
sha256 = "16nmvxfiyna5y9gwd2i3bhkpbn0nn37i481g53zc0ycw67k268sv";
}) {}
use winter_math::{FieldElement, fields::f64::BaseElement as Felt};
use winter_prover::{Prover, Trace};
/* +---+---+ Fibonacci: 2 columns per row.
| a | b | Single column fibonacci is not possible with this constraint system as that would require looking back more than previous time step.
+---+---+ Transition constraints:
| c | d | c = a + b
+---+---+ d = b + c */
fn main() {
let (f0, f1) = (Felt::new(1), Felt::new(1));