Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBadi committed Jan 29, 2024
0 parents commit 64e4f4b
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Tests

on:
push:
branches: ["main"]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: aiken-lang/[email protected]
with:
version: v1

- run: aiken fmt --check
- run: aiken check -D
- run: aiken build
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Aiken compilation artifacts
artifacts/
# Aiken's project working directory
build/
# Aiken's default documentation export
docs/
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ak-381

Write validators in the `validators` folder, and supporting functions in the `lib` folder using `.ak` as a file extension.

For example, as `validators/always_true.ak`

```gleam
validator {
fn spend(_datum: Data, _redeemer: Data, _context: Data) -> Bool {
True
}
}
```

## Building

```sh
aiken build
```

## Testing

You can write tests in any module using the `test` keyword. For example:

```gleam
test foo() {
1 + 1 == 2
}
```

To run all tests, simply do:

```sh
aiken check
```

To run only tests matching the string `foo`, do:

```sh
aiken check -m foo
```

## Documentation

If you're writing a library, you might want to generate an HTML documentation for it.

Use:

```sh
aiken docs
```

## Resources

Find more on the [Aiken's user manual](https://aiken-lang.org).
15 changes: 15 additions & 0 deletions aiken.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file was generated by Aiken
# You typically do not need to edit this file

[[requirements]]
name = "aiken-lang/stdlib"
version = "1.7.0"
source = "github"

[[packages]]
name = "aiken-lang/stdlib"
version = "1.7.0"
requirements = []
source = "github"

[etags]
14 changes: 14 additions & 0 deletions aiken.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name = "modulo-p/ak-381"
version = "0.0.0"
license = "Apache-2.0"
description = "Aiken contracts for project 'modulo-p/ak-381'"

[repository]
user = "modulo-p"
project = "ak-381"
platform = "github"

[[dependencies]]
name = "aiken-lang/stdlib"
version = "1.7.0"
source = "github"
25 changes: 25 additions & 0 deletions lib/ak-381/groth16.ak
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use aiken/builtin.{bls12_381_final_verify, bls12_381_miller_loop}

type VerificationKey {
nPublic: Int,
vkAlpha: List<Int>,
vkBeta: List<List<Int>>,
vkGamma: List<List<Int>>,
vkDelta: List<List<Int>>,
vkAlphaBeta: List<List<List<Int>>>,
vkIC: List<List<Int>>,
}

type Proof {
piA: List<Int>,
piB: List<List<Int>>,
piC: List<Int>,
}

pub fn pairing(alfa: G1, beta: G2) -> Bool {
todo
}

pub fn groth_verify(vk: VerificationKey, proof: Proof) -> Bool {
todo
}

0 comments on commit 64e4f4b

Please sign in to comment.