Lets say hypothetically I wanted to host a raffle, where the amount of sats zapped is the amount of tickets you get, and each ticket has a number and at the end a random number is drawn. What would be the best way to assign the numbers and keep track of it? Is there a website where I can put in “person a: 50 tickets” and it assigns them tickets?
Discussion
You could track in excel. Or even the online version of excel.
Multiple ways to do it. I’ll list the simplest.
Create a columns and for each zap value you put the users name in. 10 sats = name (10 times). Each in a separate row in the column.
Then in an adjacent column have a number scale 1,2,3,… going all the way down.
Now for the winner. Write a formula to pick a random # from your # column.
=randomnumber(1,x)
Where x = the last number you have in your list.
Then do a look up for the winner manual. Or you can write another formula.
I am fluent in excel if you need help
Might DM you tm, basically I wanna do a 50/50 raffle. 50% of the sats go to a dev, 50% go to the winning number. I would do multiple so that several devs would get sats.
Hypothetically, allegedly
#[3]
I will publicly state everyone should look up their local laws on raffles and betting. Also that I will not be participating in a raffle. That is my official public statement.
But I love to discuss excel and my DMs are always open.
Sounds like a good idea for a bot. Can automate this and track to avoid the manual overhead. Main caveat is the bot can only see zaps for relays it listens to.
You know how to do relay bots?? 📝
I have 2 bots..
Mary Botzzapp is a publish only. Writes a note once an hour to the relays it's connected to.
Polly Botzzapp is more involved. It connects to relays with subscription and listens for direct messages, as well as any zaps on posts that it is explicitly monitoring. Direct messages are how it lets you create and manage polls and it replies in mind. When polls are started it publishes them, and same for when a poll is expired or ended.
pragma solidity ^0.8.0;
contract Raffle {
mapping(address => uint) public ticketCount;
mapping(uint => address) public ticketToOwner;
uint public ticketIndex = 0;
uint public totalTickets = 0;
function zapSats(uint numTickets) public payable {
require(msg.value >= numTickets * 1000, "Insufficient sats zapped.");
ticketCount[msg.sender] += numTickets;
for (uint i = 0; i < numTickets; i++) {
ticketToOwner[ticketIndex] = msg.sender;
ticketIndex++;
totalTickets++;
}
}
function drawWinner() public returns (address) {
require(totalTickets > 0, "No tickets purchased.");
uint winningTicket = uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty))) % totalTickets;
address winner = ticketToOwner[winningTicket];
ticketCount[winner] = 0;
ticketToOwner[winningTicket] = address(0);
totalTickets--;
winner.transfer(address(this).balance);
return winner;
}
}