Skip to content

Commit

Permalink
add bn254 python file
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed7s committed Nov 12, 2023
1 parent b261051 commit 0e80f2a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/bn254.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
Field,
Bool,
SmartContract,
state,
State,
method,
ForeignGroup,
Circuit,
Provable,
Struct
} from "o1js";

Check failure on line 12 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module 'o1js' or its corresponding type declarations.
import {ForeignField } from "./foreign_field";

Check failure on line 13 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Cannot find module './foreign_field' or its corresponding type declarations.

export class bn254 extends SmartContract {
@state (Field)curve_order = Field(21888242871839275222246405745257275088548364400416034343698204186575808495617);
@state (Field) field_modulus = Field(21888242871839275222246405745257275088696311157297823662689037894645226208583);
fq2_coeffs = (1, 0)

Check failure on line 18 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Left side of comma operator is unused and has no side effects.
fq12_coeffs = (82, 0, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0)

Check failure on line 19 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Left side of comma operator is unused and has no side effects.

Check failure on line 19 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Left side of comma operator is unused and has no side effects.

Check failure on line 19 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Left side of comma operator is unused and has no side effects.

Check failure on line 19 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Left side of comma operator is unused and has no side effects.

Check failure on line 19 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Left side of comma operator is unused and has no side effects.

Check failure on line 19 in src/bn254.ts

View workflow job for this annotation

GitHub Actions / test

Left side of comma operator is unused and has no side effects.

@method check1 () {
return this.curve_order;
}
// (Field(2) ** this.curve_order) % this.curve_order == Field(2) ;
//}
//@method check2 () {
// Assuming curve_order and field_modulus are already defined BigInts
//}

bn128_FQ = new ForeignField (this.field_modulus)
bn128_FQP = new ForeignField (field_modulus)
bn128_FQ2 = new ForeignField (field_modulus, fq2_coeffs)
bn128_FQ12 = new ForeignField (field_modulus,fq12_coeffs)





}

0 comments on commit 0e80f2a

Please sign in to comment.