mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 14:24:09 -05:00
27 lines
623 B
Plaintext
27 lines
623 B
Plaintext
k = 13;
|
|
field = "pallas";
|
|
|
|
constant "Simple" {
|
|
EcFixedPointShort VALUE_COMMIT_VALUE,
|
|
EcFixedPoint VALUE_COMMIT_RANDOM,
|
|
}
|
|
|
|
witness "Simple" {
|
|
Base value,
|
|
Scalar value_blind,
|
|
}
|
|
|
|
circuit "Simple" {
|
|
# Pedersen commitment for coin's value
|
|
vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
|
|
vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
|
|
value_commit = ec_add(vcv, vcr);
|
|
# Since the value commit is a curve point, we fetch its coordinates
|
|
# and constrain them:
|
|
value_commit_x = ec_get_x(value_commit);
|
|
value_commit_y = ec_get_y(value_commit);
|
|
constrain_instance(value_commit_x);
|
|
constrain_instance(value_commit_y);
|
|
}
|
|
|