Skip to content

Instantly share code, notes, and snippets.

View kushti's full-sized avatar

Alexander Chepurnoy kushti

View GitHub Profile
@kushti
kushti / gist:270320175b8b0469d680d41ce13670b1
Created April 14, 2024 19:07
2-out-of-2 signing algo
An example test where Alice (A) and Bob (B) are signing an input in a distributed way. A statement which
protects the box to spend is "pubkey_Alice && pubkey_Bob". Note that a signature in this case is about
a transcript of a Sigma-protocol ((a_Alice, a_Bob), e, (z_Alice, z_Bob)),
which is done in non-interactive way (thus "e" is got via a Fiat-Shamir transformation).
For that, they are going through following steps:
- Bob is generating first protocol message a_Bob and sends it to Alice
- Alice forms a hint which contain Bob's commitment "a_Bob", and puts the hint into a hints bag
- She proves the statement using the bag, getting the partial protocol transcript
@kushti
kushti / sigmabankv2.es
Created March 12, 2024 12:06
SigmaUSD bank v2
{
// diff from V1:
// * no cooling off period
// this box
// R4: Long : Number of stable-coins in circulation
// R5: Long : Number of reserve-coins in circulation
// R6: Int : Last oracle update height (to have limits per cycle)
// R7: (Long, Long) : Remaining limit for SigUsd and SigRSV minting per oracle update
package org.ergoplatform
import io.circe.jawn.JawnParser
import org.ergoplatform.http.api.ApiCodecs
import org.ergoplatform.modifiers.mempool.{ErgoTransaction, ErgoTransactionSerializer}
import scorex.util.encode.Base16
object Checker5015 extends App with ApiCodecs {
package org.ergoplatform
import io.circe.jawn.JawnParser
import org.ergoplatform.http.api.ApiCodecs
import org.ergoplatform.modifiers.history.{BlockTransactions, BlockTransactionsSerializer}
import scorex.util.encode.Base16
import java.io.File
object Checker5015 extends App with ApiCodecs {
@kushti
kushti / bts.bytes
Created November 22, 2023 18:42
bts.bytes
7f4c79e846593509f75f3d10afb2924c3c75c88d94327919cbab944a8628952083ade2040501787525a02a6507e0e10c635c629781c32f2ecef56e0b402c2e214ad8068187b50000000220fa2bf23962cdf51b07722d6237c0c7b8a44f78856c0f7ec308dc1ef1a92a51d9a2cc8a09abfaed87afacfbb7daee79a6b26f10c6613fc13d3f3953e5521d1a0280c89ad595cff726101004020e36100204a00b08cd0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ea02d192a39a8cc7a7017300730110010204020404040004c0fd4f05808c82f5f6030580b8c9e5ae040580f882ad16040204c0944004c0f407040004000580f882ad16d19683030191a38cc7a7019683020193c2b2a57300007473017302830108cdeeac93a38cc7b2a573030001978302019683040193b1a5730493c2a7c2b2a573050093958fa3730673079973089c73097e9a730a9d99a3730b730c0599c1a7c1b2a5730d00938cc7b2a5730e0001a390c1a7730fb0cb450200010180b0bbcc9b9fe51b008084d6d1a701100204a00b08cd02bd04525e3e2bba4f910cda41ef195183c8ce8961d40fda5465ff134bdd93be59ea02d192a39a8cc7a70173007301b0cb45010180f085da2c0003f64a3f6033ac9436035f1281db6da9be26b4f06b4f4d16e38d6e66e02b4b5a260002000e9f0f03eb6ce4f6ebf591fb573a
{
"headerId": "7f4c79e846593509f75f3d10afb2924c3c75c88d94327919cbab944a86289520",
"transactions": [
{
"id": "9c2b83d82211661c9b136f9bfe72cb3594a63dd25362730f96922f2d07a0ada9",
"inputs": [
{
"boxId": "787525a02a6507e0e10c635c629781c32f2ecef56e0b402c2e214ad8068187b5",
"spendingProof": {
"proofBytes": "",
@kushti
kushti / 5013
Created November 22, 2023 18:39
b07bd12db941668bdf08210b43554a4793e3322a8a2ece9c4168e78cd165d0f0
ArrayBuffer(9c2b83d82211661c9b136f9bfe72cb3594a63dd25362730f96922f2d07a0ada9, d5c0a7908bbb8eefe72ad70a9f668dd47b748239fd34378d3588d5625dd75c82, 5ea61efedf4b6cae7a04df60665ad49d9a601e3178159571f264bbc51c2bc2df, 386c52236e7caaf9def02610ec2c55d9803f40b9bbd91ac65a762c7602ed5f9d, 9fb147d908151c4ce9666975d14a5088bc2eff5541ae8fbe7628cb142ae1face)
import org.ergoplatform.modifiers.mempool.ErgoTransactionSerializer
import org.ergoplatform.http.api.ApiCodecs
import scorex.util.encode.Base16
object Checker5015 extends App with ApiCodecs {
import io.circe.parser._
val txJsonString =
"""
update_contract_parameters:
ergo_tree_bytes: 100f0400040004000402040204020e203c45f29a5165b030fdb5eaf5d81f8108f9d8f507b31487dd51f4ae08fe07cf4a0400040004000e2019ccf4c9950e9c370c694f5781d37da182c84d871cee27389b434100ec859b290100050004000420d80ad601b2a4730000d602db63087201d603b27202730100d604b2a5730200d605db63087204d606b2a5730300d607b27205730400d6088c720701d6098c720702d60ab27202730500d1ededed938c7203017306edededed937203b2720573070093c17201c1720493c672010405c67204040593c672010504c672040504efe6c672040661edededed93db63087206db6308a793c27206c2a792c17206c1a7918cc77206018cc7a701efe6c67206046192b0b5a4d9010b63d801d60ddb6308720b9591b1720d7308d801d60ec6720b070eededed938cb2720d73090001730a93e4c6720b05048cc7a70193e4c6720b060ecbc2720495ede6720ee6c6720b0805ed93e4720e720893e4c6720b08057209ed938c720a017208938c720a027209730b730cd9010b41639a8c720b018cb2db63088c720b02730d00027e730e05
pool_nft_index: 6
ballot_token_index: 10
min_votes_index: 14
min_votes: 6
tokens_to_mint:
pool_nft: ~
refresh_nft: ~
update_nft:
update_contract_parameters:
ergo_tree_bytes: 100f0400040004000402040204020e203c45f29a5165b030fdb5eaf5d81f8108f9d8f507b31487dd51f4ae08fe07cf4a0400040004000e2019ccf4c9950e9c370c694f5781d37da182c84d871cee27389b434100ec859b290100050004000420d80ad601b2a4730000d602db63087201d603b27202730100d604b2a5730200d605db63087204d606b2a5730300d607b27205730400d6088c720701d6098c720702d60ab27202730500d1ededed938c7203017306edededed937203b2720573070093c17201c1720493c672010405c67204040593c672010504c672040504efe6c672040661edededed93db63087206db6308a793c27206c2a792c17206c1a7918cc77206018cc7a701efe6c67206046192b0b5a4d9010b63d801d60ddb6308720b9591b1720d7308d801d60ec6720b070eededed938cb2720d73090001730a93e4c6720b05048cc7a70193e4c6720b060ecbc2720495ede6720ee6c6720b0805ed93e4720e720893e4c6720b08057209ed938c720a017208938c720a027209730b730cd9010b41639a8c720b018cb2db63088c720b02730d00027e730e05
pool_nft_index: 6
ballot_token_index: 10
min_votes_index: 14
min_votes: 2
tokens_to_mint:
pool_nft: ~
refresh_nft: ~
update_nft: