# Plonky2

Plonky2\[32] = Brave Taboo System + Deep-Fri Promise + Goldilocks Domain. We plan to use Plonky2 as our recursive layer 2 and 3 (to be supported in the future), as it is more suitable for specific computations than Starky which is more suitable for ZKVM. It should be noted that the design described in this article is the original version of Plonky2, which will be more convenient for readers to learn.

## protocol configuration

Standard recursive configuration

Drink and self.

self{

num\_wires: 135,

n um \_ r o u t e d  w ir e : 80 ,

n um  c o n t in ts : 2 ,

You're real, you're real,

The security system: 100,

n um  c l e n g e s : 2 ,

Zero\_know where:false,

m a x  qu e o t e n t e g r e e  f a c t o r : 8 ,

fri \_config: FriConfig {

rate  bits: 3,

\_Height:4

p r o f\_ o f\_ w o r k\_b i t s : - 16 ,

F r i r e d u c t i o n t e r a t e g e l l e d i o n t e r a t e g o n t o n t e r a t o n t e r o n t o n t e r o n t o n t e r a t e b i t s (4 , 5) ,

n um  that and r y\_ r or a d s : 28 ,

},

}}

Standard recursive zk configuration

Bar and () ->Self{

Self{

num \_  wires： 135，

n um \_  r o u t e d \_  w ir e s : 80 ,

n um \_  c o ns t an ts : 2 ,

You're real, you're real,

Security system: 100,

n um \_  c h a l l e n g e s : 2 ,

Zero, know l side: true,

m a x \_  qu o t i e n t \_  d e g r e e \_  f a c t o r : 8 ,

fri \_  config： FriConfig {

rate \_  bits： 3，

cap \_ Height: 4,

p r o o f \_  o f \_  w o r k \_  b i t s :   16 ,

r e d u c t i o n \_  s t r a t e g y :   F r i R e d u c t i o n S t r a t e g y :: C o n s t a n t A r i t y B i t s (4 ,   5) ,

n um \_  qu e r y \_  r o un d s : 28 ,

} ,

}

}

Standard configuration

Bar and () ->Self{

Self{

num \_  wires： 136，

n um \_  r o u t e d \_  w ir e s : 80 ,

n um \_  c o ns t an ts : 2 ,

Security system: 100,

n um \_  c h a l l e n g e s : 2 ,

Zero\_ Knowing edge l: false,

m a x \_  qu o t i e n t \_  d e g r e e \_  f a c t o r : 8 ,

fri \_  config： FriConfig {

rate \_  bits： 3，

cap \_ Height: 4,

p r o o f \_  o f \_  w o r k \_  b i t s :   16 ,

r e d u c t i o n \_  s t r a t e g y :   F r i R e d u c t i o n S t r a t e g y :: C o n s t a n t A r i t y B i t s (4 ,   5) ,

n um \_  qu e r y \_  r o un d s : 28 ,

} ,

}}

## wide area configuration

num \_ wires： 234，

n um \_ r o u t e d \_ w ir e s : 80 ,

n um \_ c o ns t an ts : 2 ,

，

n um \_ c h a l l e n g e s : 2 ,

m a x \_ qu o t i e n t \_ d e g r e e \_ f a c t o r : 8 ,

fri \_ config： FriConfig {

rate \_ bits： 3，

cap \_high：4，

p r o o f \_ o f \_ w o r k \_ b i t s :   16 ,

r e d u c t i o n \_ s t r a t e g y :   F r i R e d u c t i o n S t r a t e g y :: C o n s t a n t A r i t y B i t s (4 ,   5) ,

n um \_ qu e r y \_ r o un d s : 28 ,

} ,

}

}

## Gates

Each gate is a gate with a row of 135 columns. Since different custom doors have different complexities, for some complex doors, 135 columns may limit only one operation, while for other simple doors, 135 columns may limit multiple operations. The operation index in the row is called the slot index.

Steps to use a custom door:

Ensure the type of gate;&#x20;

Secure gate row and slot positions;&#x20;

Secure the wire layout of the gate;

Ensure the consistency of public data and gate wires;&#x20;

Ensuring the row position of public data;&#x20;

Finalize the tracking form;&#x20;

Constraints on the tracking table;&#x20;

Evidence of sand scab formation.&#x20;

For ease of description, the trace tables in this article only show that one operation is slot 0.

## Curve assertion works

1 goal: check if the point is on the curve y 2= x3+ax+b.

Gate Type Number: 13

– 8: U32AddManyGate{2,3,5,7,9,11,13,15}

– 1: ComparisonGate

– 1: ArithmeZK WorldGate

– 1: U32ArithmeZK WorldGate

– 2: U32RangeCheckGate{0,8}

## curve-msm

.1 Goal: Implement Multiplicative Scalar Multiplication (MSM).

.2 Constraint information and cost:

Gate Type Number: 14

Door Instance Number: 147553

## curve scalar

1. Goal: To realize the multiplication operation between scalar and point.

<figure><img src="https://1596861963-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIiKcuHbHZ9FnXtvk4nmm%2Fuploads%2FREf0k881yWASrGAw1iPD%2Fimage.png?alt=media&#x26;token=52f7126b-2ba1-4189-9df0-bb9953bf63b3" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1596861963-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIiKcuHbHZ9FnXtvk4nmm%2Fuploads%2FkvoBjMQiNVrXld5j1vCR%2Fimage.png?alt=media&#x26;token=e8039459-f244-4b6c-8329-b69d94056ba7" alt=""><figcaption></figcaption></figure>

. 2 Constraint logic: see figure.

.3 Constraint information and costs:

Gate Type Number: 13

Door Instance Number: 180364

<figure><img src="https://1596861963-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIiKcuHbHZ9FnXtvk4nmm%2Fuploads%2F7U13tb1ST1IZtO1VXrqG%2Fimage.png?alt=media&#x26;token=af85f17c-814e-4bc1-8920-311ff5e88b79" alt=""><figcaption></figcaption></figure>
