Skip to content

Instantly share code, notes, and snippets.

@wanseob
Last active April 29, 2020 07:56
Show Gist options
  • Save wanseob/d4d31e204d25cf31416a0af4ee98e2e6 to your computer and use it in GitHub Desktop.
Save wanseob/d4d31e204d25cf31416a0af4ee98e2e6 to your computer and use it in GitHub Desktop.
ZkTransaction minimum circuit
template ZkTransaction(tree_depth, n_i, n_o) {
/** Private Signals */
// Spending notes
signal private input spending_note[7][n_i];
signal private input signatures[3][n_i];
signal private input note_index[n_i];
signal private input siblings[tree_depth][n_i];
// New notes
signal private input new_note[7][n_o];
/** Public Signals */
/// tx fee
signal input fee;
/// for atomic swap
signal input swap;
/// preventing double-spending
signal input inclusion_references[n_i];
signal input nullifiers[n_i];
/// UTXO note hash
signal input new_note_hash[n_o];
signal input typeof_new_note[n_o]; // 0: UTXO, 1: Withdrawal, 2: Migration
signal input public_data[6][n_o];
}
component main = ZkTransaction(31, 1, 2);
{
"spending_note[0][0]":"3333",
"spending_note[1][0]":"13577801964721201725969022539064064072337151708525135468972757039134035251004",
"spending_note[2][0]":"1172725736932280467029218019209856830835957095684381876155172720586300437440",
"spending_note[3][0]":"11",
"spending_note[4][0]":"0",
"spending_note[5][0]":"0",
"spending_note[6][0]":"0",
"signatures[0][0]":"15408555623614686187500759725858207501427602640628243111490158562185043752162",
"signatures[1][0]":"17555671869796576122242208356184597871896382304888430736956554881443970455370",
"signatures[2][0]":"672896583754074372412670257165078481019252869977123205245612309864430866382",
"note_index[0]":"0",
"siblings[0][0]":"12533326181770994361036335177354830652110226223517172687087221766289532855790",
"siblings[1][0]":"6701230655463557533568014270522205722747846783653244236267046472377897093095",
"siblings[2][0]":"10488716412536683522952972770619913257353769824858963173830621041273290325994",
"siblings[3][0]":"13885591554777381877366224924349366531482911716654944947037772192662181203542",
"siblings[4][0]":"10912008737682409653203114945639067991633976008052243085128825902624340861168",
"siblings[5][0]":"9732737454380580329183904048440825860694023428282278695669419211114787948305",
"siblings[6][0]":"15464895793651327944688608026231568151028127428198267598617758383655582163283",
"siblings[7][0]":"14633004519223478016241938360603511574137178193641357011730869438104381176233",
"siblings[8][0]":"6633293237192586491761472601286371658082923084150209560863117933230816897111",
"siblings[9][0]":"1403962777258157686336011047110856458740519587815530786193452206743801448577",
"siblings[10][0]":"13944491274051751625552702218653169459495092342548081057642485898514047997033",
"siblings[11][0]":"7108792818474896522482112819968422687145778468739872103994552404066602083134",
"siblings[12][0]":"21210756157863481393836841754092314251386137973444972185725366019889841757627",
"siblings[13][0]":"8860700169902197520771595908079796376207109320506648029128829508916938227203",
"siblings[14][0]":"11971941140269170684019918939305753158085693574373255157018210072640405391746",
"siblings[15][0]":"5815179016408851394540862157979097748150202490127349292634897046107350602222",
"siblings[16][0]":"8995746462075652506424875911056231830702511407611415891966227013690679970477",
"siblings[17][0]":"18944400354233562926154088665361897321801961588440673140177398372676841207826",
"siblings[18][0]":"15218491376025155717692102271775014280586885519506109475787365026617180024840",
"siblings[19][0]":"2836001529096685711058003517613272619201476314423342665904661976745573846828",
"siblings[20][0]":"361440555313133364062142746568445886995024275193498311260745163701612741247",
"siblings[21][0]":"21080474937414888541832742670930262273651619647595663693779668304301408964765",
"siblings[22][0]":"14965323551304231926472905167735143486658616301503506177422557712436438957795",
"siblings[23][0]":"7417260826726950799664416637845013550829258920895984676907122060189715945401",
"siblings[24][0]":"10188779943450036703013007463751994318554008945602231387798814792333922551116",
"siblings[25][0]":"11282687385185551770873914830193898762017191203830454584455608348094579975945",
"siblings[26][0]":"6001480939684889092676442146979430867515304826637385331009562933020006965741",
"siblings[27][0]":"18385424805055766429747790088082540745855872407775231708848709653196782285276",
"siblings[28][0]":"19457680442588488928051513717605150444002466012710352412177639182982539861385",
"siblings[29][0]":"12334925775101114327286643430495647463636697542679632238987556432000968461135",
"siblings[30][0]":"6841546132780698576381135602877181100599246471765578685788423006538048199600",
"inclusion_references[0]":"12547397250687365363327739972911450878797086822643290022179974101890464516625",
"nullifiers[0]":"3366413119061324003992465271864812552684621759813671472131088210255262822748",
"new_note[0][0]":"2221",
"new_note[1][0]":"3028017751056820947657561015451638818242693225071957122378429523429116475720",
"new_note[2][0]":"18812508419569863838240068273714891774800237982486311856794043141260969308859",
"new_note[3][0]":"12",
"new_note[4][0]":"0",
"new_note[5][0]":"0",
"new_note[6][0]":"0",
"new_note_hash[0]":"15480950380547040691895041909966933756262397122154438824345445593531240476939",
"typeof_new_note[0]":"0",
"public_data[0][0]":"0",
"public_data[1][0]":"0",
"public_data[2][0]":"0",
"public_data[3][0]":"0",
"public_data[4][0]":"0",
"public_data[5][0]":"0",
"new_note[0][1]":"1111",
"new_note[1][1]":"13577801964721201725969022539064064072337151708525135468972757039134035251004",
"new_note[2][1]":"1172725736932280467029218019209856830835957095684381876155172720586300437440",
"new_note[3][1]":"13",
"new_note[4][1]":"0",
"new_note[5][1]":"0",
"new_note[6][1]":"0",
"new_note_hash[1]":"4141512454473108634010494715760427604630543386232707715229946970463874410017",
"typeof_new_note[1]":"0",
"public_data[0][1]":"0",
"public_data[1][1]":"0",
"public_data[2][1]":"0",
"public_data[3][1]":"0",
"public_data[4][1]":"0",
"public_data[5][1]":"0",
"swap":"0",
"fee":"1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment