This implementation is sensitive about the sizes of transactions. Specifically, each consecutive transaction in the rollup (except for the genesis transaction), must all have the same size. Additionally it is important that each transaction has a consistent structure w.r.t. funding and spending outputs.
The -w
flag is to indicate stripping the debug symbols. Smaller binary is the result.
$ go get
$ go mod tidy
$ go build -ldflags "-w" .
You should have a binary called onesatrollup
in the home folder. This is a statically-linked
binary for your platform, and needs no external library dependencies.
The first time you run the application it will generate the Prover and Verifier keys for both the "base case" and the "normal case". So four keys in total. This will take a total of around 2 minutes. The next time you run the app the existing keys will be re-imported, but the startup time does not appreciably reduce, so expect it to still take around 2 minutes for the app to boot.
$ ./onesatrollup
Base case proofs are for the issuance transactions. They are the start of the chain of proofs.
The initial base case proof only needs the raw transaction data in Hex.
$ curl --location 'http://localhost:8080/prove/base' \
--header 'Content-Type: application/json' \
--data '{
"raw_tx": "020000000190bc0a14e94cdd565265d79c4f9bed0f6404241f3fb69d6458b30b41611317f7000000004847304402204e643ff6ed0e3c3e1e83f3e2c74a9d0613849bb624c1d12351f1152cf91ebc1f02205deaa38e3f8f8e43d1979f999c03ffa65b9087c1a6545ecffa2b7898c042bcb241feffffff0200ca9a3b000000001976a914662db6c1a68cdf035bfb9c6580550eb3520caa9d88ac40276bee000000001976a9142dbbeab87bd7a8fca8b2761e5d798dfd76d5af4988ac6f000000"
}'
The normal case proof requires a little additional information.
Specifically one needs to specify the outpoint of the UTXO that this transaction is spending from.
The Proof parameter is the output of a previous proof generated by a call to either /prove/base
or /prove/normal
curl --location 'http://localhost:8080/prove/normal' \
--header 'Content-Type: application/json' \
--data '{
"raw_tx": "0200000001faf3013aab53ae122e6cfdef7720c7a785fed4ce7f8f3dd19379f31e62651c71000000006a47304402200ce76e906d995091f28ca40f4579c358bce832cd0d5c5535e4736e4444f6ba2602204fa80867c48e6016b3fa013633ad87203a18487786d8758ee3fe8a6ad5efdf06412103f368e789ce7c6152cc3a36f9c68e69b93934ce0b8596f9cd8032061d5feff4fffeffffff020065cd1d000000001976a914662db6c1a68cdf035bfb9c6580550eb3520caa9d88ac1e64cd1d000000001976a914ce3e1e6345551bed999b48ab8b2ebb1ca880bcda88ac70000000",
"input_index" : 0,
"is_parent_base" : true,
"proof" : "{\"Ar\":{\"X\":\"18834827440829432204413296213765959020191505555628385718537511767690898828963056679127881914537\",\"Y\":\"16470019328531873715582041905165250532825085247757090920641171599915613895312762753227347638338\"},\"Krs\":{\"X\":\"24410580171895596625826316249519071951193262229815601215261173291698707024270851788153404338785\",\"Y\":\"2079927713281624127136889331010614485485495355172136922368820923972023330996548753523921026577\"},\"Bs\":{\"X\":{\"B0\":{\"A0\":\"33457221294563843250210554157658009038809892131351418404184881177839853850086619342841545705074\",\"A1\":\"25987625957669401742048563685066012112884261330911018537032954804462098048769608330002236461212\"},\"B1\":{\"A0\":\"36988886813109287755864744818776007965036766909639695692207213298031043638474995064829294120088\",\"A1\":\"36294059204007249680123040532839798354349841318049637495949595077294713390946590342679430537988\"}},\"Y\":{\"B0\":{\"A0\":\"32123174592607746954617707402300211883694672856447406992386206007155032318322794754923020002064\",\"A1\":\"18081727395069982190266914456425452420297858742348760231691482837905594006538175413646837972150\"},\"B1\":{\"A0\":\"14408606258898926088572400546312990842145220169989455953979888840809302816143993484990767617727\",\"A1\":\"15166081576206605078004306921640547612017428630071466591432022144580226780935620581257182936235\"}}},\"Commitments\":[{\"X\":\"12964950994495450066568872298380045294026983819556662987460190111807515507099156249541375416509\",\"Y\":\"32287518133657023671906266120225940061133703918725663107842703786394829317777894304257102019920\"}],\"CommitmentPok\":{\"X\":\"3330808717954947554648654585678216446087156838329278450070362199433176200397093238558636846147\",\"Y\":\"20167191096935563730728006368478435501554936095591888447668625592711824351575074297347422651730\"}}"
}'