Skip to content

Commit

Permalink
Add zelu
Browse files Browse the repository at this point in the history
  • Loading branch information
only4sim committed Nov 27, 2023
1 parent 7dd97d3 commit 0996cca
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/libs/zelu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {
Field,
Mina,
PrivateKey,
AccountUpdate,
SelfProof,
ZkProgram,
Struct,
Bool,
Circuit,
Poseidon,
MerkleMap,
MerkleTree,
MerkleWitness,
MerkleMapWitness,
verify,
Provable,
} from 'o1js';

const Zelu = ZkProgram({
name: 'Zelu',
publicOutput: Field,
methods: {
zelu: {
privateInputs: [Field, Field],

method(input, remainder): Field {
const n = Field(1000000000); // Assuming n is 10^9
remainder.assertLessThan(n);
let tmp = input.square().add(input.mul(n));
return tmp.sub(remainder).div(n);
},
},
},
});

0 comments on commit 0996cca

Please sign in to comment.