Skip to content

Instantly share code, notes, and snippets.

View kushti's full-sized avatar

Alexander Chepurnoy kushti

View GitHub Profile
property("should break up fee inputs into multiple transactions if there are too many") {
val bh = boxesHolderGen.sample.get
val us = createUtxoState(bh, parameters)
val height = us.stateContext.currentHeight
// Generate a large number of fee boxes
val feeBoxes = (1 to 1000).map { _ =>
val value = Gen.choose(1, 100).sample.get
new ErgoBoxCandidate(value, feeProp, height)
}
# A config for the Development Network which is supposed to serve needs of protocol-breaking changes testing.
ergo {
networkType = "devnet"
node {
mining = true
offlineGeneration = true
useExternalMiner = false
@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 =
"""