Questions tagged [zkp]
15 questions
3
votes
1 answer
ZKP, Gnark: Does AssertIsLessOrEqual work with negative numbers?
Does gnarks (ZeroKnowledgeProof framework) AssertIsLessOrEqual work with negative numbers and ecc.BN254 curve?
https://pkg.go.dev/github.com/consensys/gnark@v0.7.0/frontend
It seems most computations including multiplication works with negative…

Max
- 6,286
- 5
- 44
- 86
2
votes
2 answers
Number of wires in a ZKP Circom circuit is greater than expected
I compile this simple circuit:
pragma circom 2.0.0;
template Multiplier2() {
signal input a;
signal input b;
signal output c;
c <== a*b;
}
component main = Multiplier2();
and the compiler says 4 wires:
circom 1.circom --r1cs…

egor10_4
- 331
- 2
- 9
2
votes
0 answers
Input string of variable length in circom?
I would like to show that a user knows a preimage to a sha256 hash in circom. The preimage can be of any length, but realistically between 100-700 bytes. I tried code:
template ArbitraryLengthSha256 () {
signal input nBits;
signal input…

nnsk
- 93
- 5
2
votes
2 answers
How to write a constraint that depends on a condition in Circom?
I have code of the following form in Circom circuit compiler
template DecodeUint(len) {
signal input x;
signal input pos;
signal output value;
signal output nextpos;
component getV = GetV(len);
if (x <= 23) {
value…

Ilia Sidorenko
- 2,157
- 3
- 26
- 30
2
votes
1 answer
How to access array element with an "Unknown" index in Circom?
I have the following Circom (circuit compiler language) program:
pragma circom 2.0.0;
template MAIN() {
signal input array[2512];
signal output d;
signal v;
v <== 168;
d <== array[v];
}
component main = MAIN();
I want to…

Ilia Sidorenko
- 2,157
- 3
- 26
- 30
1
vote
0 answers
Implementing grpc in gnark v0.8.1, how to convert Proof, Verification Key & Public Witness to go-native type?
In gnark v0.8.1,
We first need to convert those 3 to go-native i.e. we convert them to []byte.
I tried implementing Serialize() and DeSerialize(), but I am facing errors.
Issue: groth16.Proof is an interface and its implementation depends upon…

Anupam Shaw
- 11
- 1
1
vote
0 answers
How to implement a >=0 check in gnark for unsigned integers when a can be any integer (negative or positive) in the clear?
I have the following block of code in golang in the clear.
for i := 0; i < 10; i++ {
if val[i]>=0{
postcheck[i] = val[i]
bitpostcheck[i] = 1
} else {
postcheck[i] = 0
bitpostcheck[i] = 0
}
}
val[i] can…

stateless
- 19
- 2
1
vote
1 answer
Converting felt252 to ContractAddress in Cairo
How do I create a ContractAddress from a hex value like 0x06D98dC7ea54CF77eeD141F423f6007Dd61fbd2b6bD429Facdf5d4803353063f?
let addr : ContractAddress = 0x06D98dC7ea54CF77eeD141F423f6007Dd61fbd2b6bD429Facdf5d4803353063f; is throwing an exception…

Mathe Eliel
- 658
- 2
- 6
- 16
1
vote
1 answer
Zero-knowledge sequencing of messages
I have multiple servers (for redundancy) sending data to clients. The clients need to process these messages in sequence and ignore duplicates.
We use external information to determine a special sequencing string that is deterministic across all our…

David Callanan
- 5,601
- 7
- 63
- 105
1
vote
1 answer
How to Convert type byte to Kyber.Scalar in Go
I am using the kyber.scalar method in Go. I would like to send my data(kyber.scalar) with socket programing and can read other program. When i read, i can't turn back into kyber.scalar type again.
This my code for sending
r :=…

Daniel Perdana Putra
- 39
- 5
1
vote
1 answer
How to run a loop with unknown number of iterations in Circom?
I have the following circuit in Circom cicuit compiler:
pragma circom 2.0.0;
template MAIN() {
signal len;
len <== 32;
for (k = 0; k < maplen; k++) {
// do something
}
}
component main = MAIN();
I'm getting an…

Ilia Sidorenko
- 2,157
- 3
- 26
- 30
1
vote
1 answer
How to use & (AND) operator in a signal in Circom
I'm trying to use & operator on a signal and get another signal in Circom circuit compiler language like so:
pragma circom 2.0.0;
template MAIN() {
signal input a;
signal output x;
signal v;
v <== 168;
x <== v &…

Ilia Sidorenko
- 2,157
- 3
- 26
- 30
1
vote
1 answer
How to pass function argument by reference in Circom?
How to pass function argument by reference in the circom circuit language?
I'm trying to do the following:
pragma circom 2.0.0;
function increment(foo) {
foo++;
}
template MyTemplate() {
signal input a;
signal output b;
var foo;
…

Ilia Sidorenko
- 2,157
- 3
- 26
- 30
0
votes
0 answers
Asymmetric Encryption: without knowing the signer's public key owner
I am working for a big consulting firm and we have a platform that exchanges data with couple of big companies. We are trying to enhance then platform on which enterprises will be able to deposit data. The workflow that we are building is that we…

Viktor SettleMint
- 37
- 1
- 6
-1
votes
1 answer
How to solve a question about comparing two inputs using `IsEqual` function?
I am working on passing a test for a hackerhouse where I need to compare two inputs using an IsEqual function. Please provide code and explanation of it. Thank you!

Pavel Fedotov
- 748
- 1
- 7
- 29