Thinking about if we should do lottery or crowdfunding, we realized that they are not that different and we’ve taken up the challenge of writing a single turret txFunction that can handle both.

What it does

Locks NFT/token into a “crowdlottery” txfunction. The NFT/token will be distributed to contributors later depending on the parametrization. The parametrization can be used to create a crowdfunding or a lottery or something in between.

It might even get used as a launchpad/distribution for a new token.

How we built it

It's a turret txFunction written in Javascript.

Challenges we ran into

Tracking contributors without falling victim to unconfirmed dependencies with Turrets.

Distributing to more than 100 wallets.

Accomplishments that we're proud of

Overcoming the 100 operation limit through iterative distribution.

What we learned

That creating front ends is more work than it appears.

What's next for Crowd Lottery

Finish implementing and testing all the parametrization.
Secure the transaction hash random seed that's used for drawing.
Deploy to turrets
Finish the front end

Testnet Transaction Hashes from the Video




6f5676b099b068d42b64d17426b4797ca6438d49ac46384bcedf3ab67de3bc69 a294089502967c7c84ed054e93b59cc264d236ce82ad1c2e616fc4a29bf269d7 34d8f95cf5b23099d1befee92cae62cb7f83f9bcb56d9fdf5cb984f2fd325787 afae46434d3384a67e0c347b54fef3cf10724e880d7eecb9ee24fb257553afd0 a95770d33bc4fa88e751afc9cd7937f90af6ece0f22a8e44c1c22ba9c7a08823 4f19bb4c9a0c909cca3ac1e82c861d68d63b1f55f537b0f9a43b43031d38127a fcc9aaf9c79d3e5d060449712ae96ba32bd40d5aa49e806be33de7fe4107047e b62c5aefc39670d0cf5907af69d5a54db4f6014cc3d3827680f949d46b371d8f 33f0312149ac930661d95bf68ad33ae733e813f831676add67b5212a9021d686 6dbf2ad054c023b21d4401b7f098963af47139fc305944b5a5e444baf34f5fbb


e4a2b525b26d3a10699bb3d7f9f863484d43632e4f18e1e68749dae3c1d76ea7 a5f4c78151a4def01ed46682ca246628f7aa2a0e0a3d687eb4c707d22163592b 6d842930803202a31ef7e4cd24742aea5e269c0da25cee6e091d7328137f1720

WIP Docs

1. Action:create

Creates a new crowdlottery as a stellar account which holds settings in manageData keypairs.


source, assetCode, issuer, deadline, threshold, finishOnThreshold, distributionType, distributionCoeff, distributionAmount, contributionAmount, minContributionAmount, contributionFlatFee, contributionPerFee

  • source
  • assetCode:str, required
  • issuer:str, required
  • deadline
  • threshold
    • threshold for collected funds when crowdlottery becomes “successful”
  • finishOnThreshold
    • stop accepting contributions and allow distribution process to begin when threshold is reached
  • distributionType:str, required
    • constant - define distributionAmount
    • proportional
  • distributionCoeff:number, optional
    • needs to be defined if issuer is unlocked
    • float < 1 - ratio of contributers to receive token/NFT
    • integer > 1 - number of participants to receive token/NFT
  • distributionAmount:number, optional, default=0.0000001
  • contributionAmount: str, optional
    • if defined participants have to contribute this amount, otherwise they can contribute arbitrary amount.
  • minContributionAmount
  • contributionFlatFee
    • this fee is for crowdlottery creators
  • contributionPerFee
    • this fee is for crowdlottery creators

2. Action:contribute

People can send in contributions while a crowdlottery isn’t finished.


  • crowdlotteryPublicKey:str, required
  • source
  • amount:number, required

3. Action:distribute

When a crowdlottery is finished, the distribution starts.

Iteratively distribute token/NFT according to the parameters of the crowdlottery.


Update global parameters of the txfunctions.


  • newCreationFee:number, optional
  • newContributionFlatFee:number, optional
    • this fee is for developers
  • newContributionPerFee:number, optional
    • this fee is for developers
Share this project: