Author

Topic: ANN- The 1st blockchain Lottery | P2P Lottery | open source Lottery Launched... (Read 4159 times)

hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 30VPN win 2,000,000 VPN   Grin Grin Grin


BitNet Lottery code:
Code:
BitNet:00314403AC7Ig68w2SvioT6eiLpx1P4qhYCjTdW6Nb9kFWz8LXhF4Wx7rK1VQ/oWQ28Z4o/ppIr4q5dLbgjsBaTkiqZ+rNok0qMDUoGQ7vmEI/8BMDpMv7bu0rnVKbfNzdRPm8KiXW5GqedrZBK/n0olpVvqTgS2dlwtuOjURTHLo5m2RQfI2/qNHOxIe7g/4ktGQkooJTcNmxvQalH9pw/SOTs/qppQoJP2Amd53j7tOd6dTehIQWh9rNrVDk2ykYCixrd8Nbz4fZqaIi/h7XjCJtdxVwoUf/8tsFJWW7v8OR1yaDHhuk5EZpnRniHkhwYoWXTsoBow==
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Betting 50VPN Win 1,000,000VPN.
Below is BitNet Lottery Code:

Code:
BitNet:00314403AC7Ig68w2ShvbUpRAIAT87+DDyxRI8PrNDQ4CnL3r7Lb8I0u4uVqo9wgSrWZV3ovRyJV5sqiyBZdT5RRMJdcT5+3AiGd4mlK+Zh9NHzzt3FZKInFRDsFol0fHCg7sdRf+a8EamYy15oP2F6Qa4S0klC6vUyraiihAFlARljqQCT0H1jK23ANRHTASYwMsakec8rb1sD9oSamA46VJYiMXE18mfoLDbVjsexTnhg4OBeL7qtd4KhOXlqhNxCwVm97yNCwXZ0PawBnOKTA+9KWKWleLy/5dlJPZw1mjgOFUbzEDCQD95YHcvtHHjZCHXprvUtNyM
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50VPN Win 500,000VPN.

Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: VodeNvGFaeVmdKVRqF8UTzohcyVWAhUXU1
Creator Bet: 500000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "520"
Start block: 346445, Target block: 349448
Bet block range: 346446~349445 (3000)
Transaction id: 5c33de8d5441e17e65dc384218a2947805a378d121edca1bc7a09be5f5cbb502
Create time: 2015-06-11 21:46:04
Total Bonus: 500000.00000000VPN

Betting List:
----------------------------------------------------------------------------------------
Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8 500000VPN, bet txt '520'


hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50VPN Win 500,000VPN.

Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: Vfg1iwvaQZQX5nHmfapvgKcVixUDTgAvtr
Creator Bet: 500000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "25b"
Start block: 338631, Target block: 341634
Bet block range: 338632~341631 (3000)
Transaction id: 1d93c34809a5de54504d0db7a68183ece822d03d95ba6ffe50cbd341a010054b
Create time: 2015-06-05 20:09:24
Total Bonus: 500000.00000000VPN




Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: Vfg1iwvaQZQX5nHmfapvgKcVixUDTgAvtr
Creator Bet: 500000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "25b"
Start block: 338631, Target block: 341634
Bet block range: 338632~341631 (3000)
Transaction id: 1d93c34809a5de54504d0db7a68183ece822d03d95ba6ffe50cbd341a010054b
Create time: 2015-06-05 20:09:24
Total Bonus: 501297.00000000VPN

Winner is: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8(Creator)
Bet amount: 500000.00000000VPN
Winning number: "e7a"
Private key: WZS2obAbdYxkpShFrVhZ2Sd8svWGAPw6BtuFubn5mztRmagqT1nG

Betting List:
-------------------------------------------------------------------------------------------------
Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8   500000VPN, bet txt '25b'
VrTeHUZi1rvnzj4TJDw6x9hFC4wm69RKwT   80VPN, bet txt '257'
VcNGnB3mNBZtEZZTvY774z2uYwyLzwgJyj   50VPN, bet txt '00f'
VassSb4EY2vKy5UmEW94XDbfJSTmTBfuMt   66VPN, bet txt '471'
VcNGnB3mNBZtEZZTvY774z2uYwyLzwgJyj   50VPN, bet txt '12f'
VcNGnB3mNBZtEZZTvY774z2uYwyLzwgJyj   50VPN, bet txt '1b7'
Vuo95qFk1W67AS6HpyqjsRcqQ8BaZ1PR7d   50VPN, bet txt '618'
Vuo95qFk1W67AS6HpyqjsRcqQ8BaZ1PR7d   50VPN, bet txt '315'
VjsNuA61ujJxsxhs2VmYPGLL3hpRQJeJzA   50VPN, bet txt 'd47'
VjsNuA61ujJxsxhs2VmYPGLL3hpRQJeJzA   50VPN, bet txt '512'
VjsNuA61ujJxsxhs2VmYPGLL3hpRQJeJzA   50VPN, bet txt '427'
VjsNuA61ujJxsxhs2VmYPGLL3hpRQJeJzA   50VPN, bet txt 'a34'
VdoW8aym4fULmmfahyZkvYEoFSaqxJcrWR   50VPN, bet txt '3b6'
VdoW8aym4fULmmfahyZkvYEoFSaqxJcrWR   50VPN, bet txt '9f2'
VrTeHUZi1rvnzj4TJDw6x9hFC4wm69RKwT   100VPN, bet txt '357'
VrTeHUZi1rvnzj4TJDw6x9hFC4wm69RKwT   50VPN, bet txt '51c'
VhoCAvabt4Grnz6UZc9ci5w9kvfThozH8f   50VPN, bet txt '6d3'
VhoCAvabt4Grnz6UZc9ci5w9kvfThozH8f   50VPN, bet txt '6d3'
VhoCAvabt4Grnz6UZc9ci5w9kvfThozH8f   50VPN, bet txt '915'
VvFQkfU4b3xLAG2vGrjFUxEsE5rWFCvjAg   50VPN, bet txt '25b'
VvFQkfU4b3xLAG2vGrjFUxEsE5rWFCvjAg   50VPN, bet txt 'a17'
VdoW8aym4fULmmfahyZkvYEoFSaqxJcrWR   50VPN, bet txt '270'
VeZPFkWrsdaDHcYazSQBWaRusqNFYWuTZ5   50VPN, bet txt 'e7c'
VnX8NiDg8CLGkHDVraMBg1QYP8wAk24YvJ   101VPN, bet txt 'b37'
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50VPN Win 500,000VPN.

Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: Vfg1iwvaQZQX5nHmfapvgKcVixUDTgAvtr
Creator Bet: 500000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "25b"
Start block: 338631, Target block: 341634
Bet block range: 338632~341631 (3000)
Transaction id: 1d93c34809a5de54504d0db7a68183ece822d03d95ba6ffe50cbd341a010054b
Create time: 2015-06-05 20:09:24
Total Bonus: 500000.00000000VPN

hero member
Activity: 980
Merit: 1010
Blockchain engineer


Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: VwMycGrg3KSjGDah7KEYmCfNM88QTmBfv9
Creator Bet: 300000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "369"
Start block: 333226, Target block: 336229
Bet block range: 333227~336226 (3000)
Transaction id: 3162fbb26f370a27b317bfa733e27e90345dabb7e1b2b8fd12291268e425710a
Create time: 2015-06-01 15:29:03
Total Bonus: 300800.00000000VPN

Winner is: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8(Creator)
Bet amount: 300000.00000000VPN
Winning number: "a7e"

Code:
getblockhash 336229

ff66740b53b07d4dee8f8a4cf2920017dfef99dc9351c91e50d1c655f725da7e
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50VPN Win 300,000VPN.

Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: VwMycGrg3KSjGDah7KEYmCfNM88QTmBfv9
Creator Bet: 300000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "369"
Start block: 333226, Target block: 336229
Bet block range: 333227~336226 (3000)
Transaction id: 3162fbb26f370a27b317bfa733e27e90345dabb7e1b2b8fd12291268e425710a
Create time: 2015-06-01 15:29:03
Total Bonus: 300000.00000000VPN

hero member
Activity: 980
Merit: 1010
Blockchain engineer


Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: Vw5x5cALxo3ngf2hRWjjLFN7Kr9LGSvNqf
Creator Bet: 300000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "1bf"
Start block: 329060, Target block: 332063
Bet block range: 329061~332060 (3000)
Transaction id: 8b78c25ff400c2c10678a255c72317535a7298913b1afa8842f476d9c10aa046
Create time: 2015-05-29 09:43:08
Total Bonus: 300457.00000000VPN

Winner is: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8(Creator)
Bet amount: 300000.00000000VPN
Winning number: "a77"
Private key: WXys7315tNDYrYJ6jpFYDKSnzJ4ruvpQXQySoV1Y7d3rDfXFrNaX
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50VPN Win 300,000VPN.

Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: Vw5x5cALxo3ngf2hRWjjLFN7Kr9LGSvNqf
Creator Bet: 300000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 3 characters
Creator bet number: "1bf"
Start block: 329060, Target block: 332063
Bet block range: 329061~332060 (3000)
Transaction id: 8b78c25ff400c2c10678a255c72317535a7298913b1afa8842f476d9c10aa046
Create time: 2015-05-29 09:43:08
Total Bonus: 300000.00000000VPN

hero member
Activity: 980
Merit: 1010
Blockchain engineer
A luck guy win 316436.00000000VPN

Code:
getblockhash 328399

741f52332ad5362556c165cd270fff4c860eb5e04f032b6f10ff5a18766cc461

Code:
getlotterywinner 57bd427a7db753fb3e5a4af19553886d64f1c6b1eb756a896f79e6330f1e7531

{
"Is Winner" : 1,
"Winning number" : "7",
"Winner address" : "Vbn927Cy6eMSbUHNqbpJAeC4eaGcAcCz3w",
"Bet amount" : 1002.00000000
}

hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50VPN Win 240,000VPN.


Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: VaRJZWdjeeaMwaZMJUXtPykBTtyaV8YBHb
Creator Bet: 240000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)'s digit value
Difficulty: 2 characters
Creator bet number: "f4"
Start block: 327166, Target block: 328399
Bet block range: 327167~328396 (1230)
Transaction id: 57bd427a7db753fb3e5a4af19553886d64f1c6b1eb756a896f79e6330f1e7531
Create time: 2015-05-27 22:14:23
Total Bonus: 240000.00000000VPN

Lottery Code:
Code:
BitNet:00313C03BA7Ig68w2ShvZY2ZgLM57POWyWouRqOwTQ3bXR7pHajbW7pJ3pIplBmD8xkUtwo7ENFhjhIkK1NW0RsTRBMleflf3+Yw4IlseSUThSl66/i/t44zRNj+mAcvpmR59LbiR7rIKknRyZBacO0JAkcYyW+qIaG/TNO0MO2BPyJSKaUrSXilGMZaf6DqZ5jPAPV9XU/JuFEU8yr9vH3y5v6POOCydq91B6EqZE6YGdRHgSqJnJeFkvtAF+ZX1rtAqU7JK7GkfK+wvCuW5uatmLTirJk3d6WAo01UTqbvS9OHhQlWlV37mJQa6bJPne4cE=

hero member
Activity: 980
Merit: 1010
Blockchain engineer
Code:
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: VwudXXEikYXfSCgyHSuK4wYAotMYQpFV5m
Creator Bet: 230000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 2 characters
Creator bet number: "56"
Start block: 325844, Target block: 326847
Bet block range: 325845~326844 (1000)
Transaction id: 9fda19694694558526ff66d83d765a3bb8e7e64a46f6f97ad795dfd7741b55cf
Create time: 2015-05-26 21:34:27
Total Bonus: 267218.00000000VPN

Winner is: VwXG2Xu1zW4wrWhi4ktXcSNXCfdj3rLbXi
Bet amount: 66.00000000VPN
Winning number: "f7"

Code:
getblockhash 326847
3fd6fef67508ed74e1c949928a07013502ea88491314335622baa0491eb834f7

A Luck guy win 267218 VpnCoins.
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Total Bonus: 260869.00000000VPN
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Total Bonus: 239979.00000000VPN
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50VPN win 230,000VPN, come on!!!

hero member
Activity: 980
Merit: 1010
Blockchain engineer
Creator: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8
Lottery address: VqUk7SFQgtQ8hE4bnyKQmhtnzDaxvawcGX
Creator Bet: 220000VPN
Minimum Bet: 50VPN
Type: Guess a future block's hash(last N byte)
Difficulty: 2 characters
Creator bet number: "56"
Start block: 325220, Target block: 325823
Bet block range: 325221~325820 (600)
Transaction id: c2b8b41c2ca50f6a3c9ad8602887f4f8ef62e83f5918dc1be047992ac12d6a80
Create time: 2015-05-26 09:53:04
Total Bonus: 227279.00000000VPN

Winner is: Vq9EBcb43uEfFDJYbcRDL4fk8V9mB6mkT8(Creator)
Bet amount: 220000.00000000VPN
Winning number: "37"
Private key: Wapqnc3Sdbrh6Bf7kq3j5ZMbrBenTYXJhtf7GWU28HRGkwXeMHT3
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Total Bonus: 224274.00000000VPN
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Bet 50 VpnCoin Win 220000 VPN, difficulty is very low, only 2 chars, come on.

hero member
Activity: 980
Merit: 1010
Blockchain engineer
After 320,000 block, I'll put some BitNet Lottery card at here, with the lowest difficulty,
Glad to see who has good luck.   Grin Grin Grin

Such as this:
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Hello everyone,
After hard work more than six months,
Today, BitNet Lottery protocol finally released, it's based on blockchain's P2P Lottery, maintenance-free, fair, simple and easy to use.
The source code is uploaded to http://github.com/bit-net/vpncoin
This version also optimize the user experience, support wallet online reward VPN service time,
Yes, it's mean that we provided free VPN service, enjoy.
This is a mandatory update, please timely upgrades.

Windows qt version: https://drive.google.com/file/d/0B7Kd-l4hTU3GV3o4WG5LZjd2Uzg/view?usp=sharing
Thanks.
hero member
Activity: 980
Merit: 1010
Blockchain engineer
vpn coin is really not getting the credibility it deserves

We tested a few days and found some problems, we solve these problems.
Stability is important Smiley
hero member
Activity: 980
Merit: 1010
Blockchain engineer
we plan to launch it at Vpncoin's 310000th block.


May I ask when will that be?



Today Will launch,
Lottery rules in the 320,000th block become effective.
hero member
Activity: 1082
Merit: 505
A Digital Universe with Endless Possibilities.
vpn coin is really not getting the credibility it deserves
newbie
Activity: 149
Merit: 0
we plan to launch it at Vpncoin's 310000th block.


May I ask when will that be?

newbie
Activity: 149
Merit: 0
Interesting, will there be a minimum? fixed amount?

I like this idea, but will wait to hear more.

Smiley
sr. member
Activity: 490
Merit: 250
thanks a lot for the project...
waiting for VPN block 310.000
hero member
Activity: 980
Merit: 1010
Blockchain engineer
So the question is, is the whole concept easy to use for the everyday user ?

Yes, very easy.
legendary
Activity: 1554
Merit: 1001
So the question is, is the whole concept easy to use for the everyday user ?
sr. member
Activity: 393
Merit: 250
block chain fans
hero member
Activity: 980
Merit: 1010
Blockchain engineer
BitNet Lottery Bet block range: "Start block + 1" ~ ("Target Block" - 3), To prevent cheating.
BitNet Lottery Encash must wait current block big than ("Target Block" + 3), also is to prevent cheating.

Some people think that use 51% attack will break our lottery rules, this is not established.
Because, in the valid bet block range, you do not know the answer, when you use 51% attack get the target block, you will lose the opportunity to bet,
No one can be insert a Bet transaction into an existing block.
So, our rules are valid.
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
seems good. but please take a look around NAScoin , its  Lottery function have been launched  a year ago but still dead already. that means  Lottery is not fit for us.

If you read my idea, you would not say that,
thanks.

Could you please elaborate more, in a less technical way? Smiley

We create a based on blockchain and did not need central server,
No maintenance,
Fairness and justice,
Everyone can play's lottery system.
member
Activity: 61
Merit: 10
seems good. but please take a look around NAScoin , its  Lottery function have been launched  a year ago but still dead already. that means  Lottery is not fit for us.

If you read my idea, you would not say that,
thanks.

Could you please elaborate more, in a less technical way? Smiley
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Looks good!

Thanks.
Our Lottery's rules is strong,
If you have any questions about Lottery, please post at here.
sr. member
Activity: 476
Merit: 250
legendary
Activity: 2254
Merit: 1290

You seem to be headed for a really intense educational experience, quite soon.

Cheers

Graham
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Quote
Because no one can customize a future block's HASH, so, blockchain's lottery is fair and equitable.

If the lottery reward became greater than the block reward, then mining pools would have a very strong incentive to ensure that they win. The way they could do that (assuming 50% of network hashing power or more) is they would mine the block, check if they won the lottery and if not, then discard the block and try mining another block with a block hash where they win the lottery. If the major pools collude together to do this (lets say, 90% of hash power). Then it would be fairly trivial to increase your chances of winning by at least 9 times. (you would get at least 9 "draws").

Also, there is more evil that lurks under the covers. With 90% hashing power, you could orphan off a winning lottery block by going backwards in the blockchain and mining old blocks again (with timestamp manipulation so your blocks are more difficult and thus better).

Cool idea, but it has serious security implications and will not work. All of this applies also to basing the lottery on a Bitcoin block hash as well, though your lottery would have to be really valuable to get Bitcoin mining pools to care.

Hello,
Maybe you not read our codes,
We use a future block as target, no one know the answer, so your say "check if they won the lottery and if not" is not established.
And we set bet block range is "Start block number + 1" to "Target block number - 3",
Maybe Someone can control the next one block, but no one can keep a block to future + 3.

Thanks.

Let me break it down into Chenglish for you.

Miner make block future + 3. He no win lottery with block. he decide not to publish block. he mine new block. he get second chance at lottery. he maybe win. unfair for people not miners.



Vpncoin is a PoS coin.
We set bet block range is "Start block number + 1" to "Target block number - 3",
For example:
Lottery's "Start block number" is 100, "Target block number" is 200, the valid Bet block range is 101 ~ 197,
And current block number is 196, you can DIY block 197, but our target block is 200, and when current block number > 197 every betting is invalid.

I know your mean is 51% attack? even you do that, it is also under our Lottery rules.
Why?
Because You cant know a future (target) block's hash, when you get the target block, you can't bet, it's under my rules.
Bet is a transaction, it must Stored in a block, you need think about this.
Like this:


Thanks.
legendary
Activity: 1036
Merit: 1000
https://bmy.guide
Quote
Because no one can customize a future block's HASH, so, blockchain's lottery is fair and equitable.

If the lottery reward became greater than the block reward, then mining pools would have a very strong incentive to ensure that they win. The way they could do that (assuming 50% of network hashing power or more) is they would mine the block, check if they won the lottery and if not, then discard the block and try mining another block with a block hash where they win the lottery. If the major pools collude together to do this (lets say, 90% of hash power). Then it would be fairly trivial to increase your chances of winning by at least 9 times. (you would get at least 9 "draws").

Also, there is more evil that lurks under the covers. With 90% hashing power, you could orphan off a winning lottery block by going backwards in the blockchain and mining old blocks again (with timestamp manipulation so your blocks are more difficult and thus better).

Cool idea, but it has serious security implications and will not work. All of this applies also to basing the lottery on a Bitcoin block hash as well, though your lottery would have to be really valuable to get Bitcoin mining pools to care.

Hello,
Maybe you not read our codes,
We use a future block as target, no one know the answer, so your say "check if they won the lottery and if not" is not established.
And we set bet block range is "Start block number + 1" to "Target block number - 3",
Maybe Someone can control the next one block, but no one can keep a block to future + 3.

Thanks.

Let me break it down into Chenglish for you.

Miner make block future + 3. He no win lottery with block. he decide not to publish block. he mine new block. he get second chance at lottery. he maybe win. unfair for people not miners.




lol he no know dat
sr. member
Activity: 439
Merit: 250
mmmmmm
Quote
Because no one can customize a future block's HASH, so, blockchain's lottery is fair and equitable.

If the lottery reward became greater than the block reward, then mining pools would have a very strong incentive to ensure that they win. The way they could do that (assuming 50% of network hashing power or more) is they would mine the block, check if they won the lottery and if not, then discard the block and try mining another block with a block hash where they win the lottery. If the major pools collude together to do this (lets say, 90% of hash power). Then it would be fairly trivial to increase your chances of winning by at least 9 times. (you would get at least 9 "draws").

Also, there is more evil that lurks under the covers. With 90% hashing power, you could orphan off a winning lottery block by going backwards in the blockchain and mining old blocks again (with timestamp manipulation so your blocks are more difficult and thus better).

Cool idea, but it has serious security implications and will not work. All of this applies also to basing the lottery on a Bitcoin block hash as well, though your lottery would have to be really valuable to get Bitcoin mining pools to care.

Hello,
Maybe you not read our codes,
We use a future block as target, no one know the answer, so your say "check if they won the lottery and if not" is not established.
And we set bet block range is "Start block number + 1" to "Target block number - 3",
Maybe Someone can control the next one block, but no one can keep a block to future + 3.

Thanks.

Let me break it down into Chenglish for you.

Miner make block future + 3. He no win lottery with block. he decide not to publish block. he mine new block. he get second chance at lottery. he maybe win. unfair for people not miners.

hero member
Activity: 980
Merit: 1010
Blockchain engineer
seems good. but please take a look around NAScoin , its  Lottery function have been launched  a year ago but still dead already. that means  Lottery is not fit for us.

If you read my idea, you would not say that,
thanks.
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Quote
Because no one can customize a future block's HASH, so, blockchain's lottery is fair and equitable.

If the lottery reward became greater than the block reward, then mining pools would have a very strong incentive to ensure that they win. The way they could do that (assuming 50% of network hashing power or more) is they would mine the block, check if they won the lottery and if not, then discard the block and try mining another block with a block hash where they win the lottery. If the major pools collude together to do this (lets say, 90% of hash power). Then it would be fairly trivial to increase your chances of winning by at least 9 times. (you would get at least 9 "draws").

Also, there is more evil that lurks under the covers. With 90% hashing power, you could orphan off a winning lottery block by going backwards in the blockchain and mining old blocks again (with timestamp manipulation so your blocks are more difficult and thus better).

Cool idea, but it has serious security implications and will not work. All of this applies also to basing the lottery on a Bitcoin block hash as well, though your lottery would have to be really valuable to get Bitcoin mining pools to care.

Hello,
Maybe you not read our codes,
We use a future block as target, no one know the answer, so your say "check if they won the lottery and if not" is not established.
And we set bet block range is "Start block number + 1" to "Target block number - 3",
Maybe Someone can control the next one block, but no one can keep a block to future + 3.

Thanks.
legendary
Activity: 2254
Merit: 1290
sr. member
Activity: 249
Merit: 250
seems good. but please take a look around NAScoin , its  Lottery function have been launched  a year ago but still dead already. that means  Lottery is not fit for us.
sr. member
Activity: 439
Merit: 250
mmmmmm
Quote
Because no one can customize a future block's HASH, so, blockchain's lottery is fair and equitable.

If the lottery reward became greater than the block reward, then mining pools would have a very strong incentive to ensure that they win. The way they could do that (assuming 50% of network hashing power or more) is they would mine the block, check if they won the lottery and if not, then discard the block and try mining another block with a block hash where they win the lottery. If the major pools collude together to do this (lets say, 90% of hash power). Then it would be fairly trivial to increase your chances of winning by at least 9 times. (you would get at least 9 "draws").

Also, there is more evil that lurks under the covers. With 90% hashing power, you could orphan off a winning lottery block by going backwards in the blockchain and mining old blocks again (with timestamp manipulation so your blocks are more difficult and thus better).

Cool idea, but it has serious security implications and will not work. All of this applies also to basing the lottery on a Bitcoin block hash as well, though your lottery would have to be really valuable to get Bitcoin mining pools to care.
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Hello,

Looks good, but I think you are posting in the wrong section of the forum.
I believe this is the place for your ANN.

Cheers

I must remove this thread?
legendary
Activity: 1960
Merit: 1176
@FAILCommunity
Hello,

Looks good, but I think you are posting in the wrong section of the forum.
I believe this is the place for your ANN.

Cheers
hero member
Activity: 980
Merit: 1010
Blockchain engineer
go on..... tell me more.... Smiley

Please wait, I'll posting here.
Thank you for attention.
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 560
Merit: 500
Am i broke yet?
go on..... tell me more.... Smiley
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
hero member
Activity: 980
Merit: 1010
Blockchain engineer
How can I win bonus?  How to Betting?

1, Save a Lottery card image to file,
2, Import this image file, on Betting GUI,
3, Set your Bet Text,
4, Click Bet Button.
hero member
Activity: 980
Merit: 1010
Blockchain engineer
Hello everyone,
Today I am pleased to announce that we create a based on blockchain's P2P lottery, it is open source.
We call it BitNet Lottery, we plan to launch it at Vpncoin's 320000th block.

Source code: http://github.com/bit-net/vpncoin
Windows qt version: https://drive.google.com/file/d/0B7Kd-l4hTU3GV3o4WG5LZjd2Uzg/view?usp=sharing

Because no one can customize a future block's HASH, so, blockchain's lottery is fair and equitable.
BitNet Lottery is a transaction, it comes with specific transaction messages and stored in the block chain.

Below is BitNet Lottery Format Description:
Lottery Flag | Lottery ID | Lottery Type (Genesis = 1, Bet = 2, Cash = 3) | Bet Type | Bet Amount | Mini Bet Amount | Start block | Target block | Guess HASH Length | Bet Text | Lottery wallet address | Lottery wallet Private Key | Bettor's default Wallet Address | Lottery Tx ID | Sign message

For example:
Genesis Lottery  
Bet Lottery        
BitNet Lottery: | 00000000E3C9 | 2 | 1 | 100 | 30 | 305048 | 305068 | 3 | 26 | VtV3QA45Cd6wNbgQsZoGaxTPoJzMKrtmpK | 0 | VevimYsrNKWbx2W6Bnq2qyLthcnEasLMTg | ed88213480fa502936141016b912c920a43c488e7b9045605fa945b61c74493f | 0

Parameter   1: BitNet Lottery: BitNet Lottery flag
Parameter   2: 00000000E3C9 BitNet Lottery serial number
Parameter   3: 2 BitNet Lottery type, Genesis BitNet Lottery = 1, Bet BitNet Lottery = 2, Encash BitNet Lottery = 3
Parameter   4: 1 betting type, Guess a future block's hash(last N byte) = 0, guess a future block's hash(last N byte)'s digit value = 1
Parameter   5: 100 bet amount
Parameter   6: 30 minimum bet, the player bets must >= this number
Parameter   7: 305048 BitNet Lottery start block,
Parameter   8: 305068, BitNet Lottery target block, the answer from this block,
Parameter   9: 3   guess the last N characters from the target block
Parameter 10: 26 betting number
Parameter 11: VtV3QA45Cd6wNbgQsZoGaxTPoJzMKrtmpK BitNet Lottery wallet address
Parameter 12: 0 BitNet Lottery wallet address's private key, BitNet Lottery Type = 1 (Genesis BitNet Lottery) must be specified this, when encase,
                    player need to import the private key, and then send coins from this address.
Parameter 13: VevimYsrNKWbx2W6Bnq2qyLthcnEasLMTg bettors wallet address, if winning, prize will be sent to this address.
Parameter 14: ed88213480fa502936141016b912c920a43c488e7b9045605fa945b61c74493f betting transaction hash,
                    BitNet Lottery Type = 1 (Genesis BitNet Lottery) is set to 0,
                    BitNet Lottery Type = 2 (Bet BitNet Lottery), is the "Genesis BitNet Lottery" transaction HASH (tx id),
                    BitNet Lottery Type = 3 (Encase BitNet Lottery), is the genesis or bet transaction HASH (tx id), for prove the player is betted.
Parameter 15: 0 use "bettors wallet address" signature "betting transaction hash"'s text,
                    BitNet Lottery Type = 3 (Encase BitNet Lottery) must be specified this,
                    to prove that the player is "bettor's wallet address"'s owner, other Type set to 0

How does it work?




Some people think that use 51% attack will break our lottery rules, this is not established.
Because, in the valid bet block range, you do not know the answer, when you use 51% attack get the target block, you will lose the opportunity to bet, no one can be insert a Bet transaction into an existing block.
So, our rules are valid.


We add some codes in main.cpp to check every transaction.
If the tx's transaction message field include BitNet Lottery flags, will check its legality.

Code:
bool IsStandardTx(const CTransaction& tx)
{
if (tx.nVersion > CTransaction::CURRENT_VERSION)
        return false;
        ......
if( isRejectTransaction(tx) )
{
if( fDebug ){ printf("IsStandardTx: isRejectTransaction = true, ban. \n"); }
return false;
}
        ......
}

......


bool CBlock::AcceptBlock()
{
    AssertLockHeld(cs_main);
    ......
    // Check that all transactions are finalized
    BOOST_FOREACH(const CTransaction& tx, vtx)
    {
        if (!IsFinalTx(tx, nHeight, GetBlockTime()))
            return DoS(10, error("AcceptBlock() : contains a non-final transaction"));
if( isRejectTransaction(tx) ){ return error("AcceptBlock() : block includes not under rules tx, ban."); }
     }
    ......
}

isRejectTransaction function:
Code:
bool isRejectTransaction(const CTransaction& tx)
{
bool rzt = false;
bool bCasherIsWinner = false;
//-- first check it is a valid lottery tx,
string sCashTxHash = tx.GetHash().ToString();
if( fDebug ){ printf("\n\n\n******************** begin [%s]\n", sCashTxHash.c_str()); }
int iCashTxHei = GetTransactionBlockHeight(sCashTxHash);
if( iCashTxHei == 0 )
{
if( fDebug )printf("isRejectTransaction: Cash tx's hei = [%u], set to nBestHeight [%u] \n", iCashTxHei, nBestHeight);
iCashTxHei = nBestHeight;  
}
string sTxMsg = tx.vpndata;
if( fDebug ){ printf("isRejectTransaction: Tx hei = [%u], nBestHeight [%u], Tx Msg = [%s] \n", iCashTxHei, nBestHeight, sTxMsg.c_str()); }

string sLotId_cash = "", sGuessTxt = "", sLotteryAddr_bet = "", sLotteryPrivKey_bet = "", sMakerAddr_cash = "", sLotteryBetTxid = "", sSignMsg = "";
int iLotteryType_cash = 0, iGuessType = 0, iKeyLen = 0;
int64_t iAmount = 0, iMiniBet = 0, iStartBlock = 0, iEndBlock = 0;

string sRztBiggerAddr = "", sCashTxLinkedGenesisTx = "";
int64_t i6RztBiggerValue = 0;

bool bCashMsgSignOk = false;
int i = 0, iWillBan = 0;

if( iCashTxHei < BitNetLotteryStartTestBlock_286000 ){ goto check_Complete; }
if( sTxMsg.length() < 34){ goto check_Complete; }

i = GetTxMsgParam(tx, sLotId_cash, iLotteryType_cash, iGuessType, iAmount, iMiniBet, iStartBlock, iEndBlock, iKeyLen,
sGuessTxt, sLotteryAddr_bet, sLotteryPrivKey_bet, sMakerAddr_cash, sLotteryBetTxid, sSignMsg);
if( i > 14 )
{
string sLotteryAnswer = "";
if(  iLotteryType_cash != 3 ) // if not a cash tx
{
if( iLotteryType_cash == 1 ) // is Genesis tx
{
if( isValidLotteryGenesisTx(tx, iCashTxHei, -1, -1, 0, "", "") == false )
{
iWillBan++;  printf("isRejectTransaction: Genesis tx [%s] not under rules, will ban :(\n", sCashTxHash.c_str());
if( isBitNetLotteryRuleStart() )
{
if( fDebug ){ printf("[%s] end ********************\n\n\n", sCashTxHash.c_str()); }
return true;
}
}
}
else if( iLotteryType_cash == 2 ) // is Bet tx
{
//bool isValidLotteryBetTx(const CTransaction& tx, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
if( isValidLotteryBetTx(tx, iCashTxHei, -1, -1, 0, "", "") == false )
{
iWillBan++;  printf("isRejectTransaction: Bet tx [%s] not under rules, will ban :(\n", sCashTxHash.c_str());
if( isBitNetLotteryRuleStart() )
{
if( fDebug ){ printf("[%s] end ********************\n\n\n", sCashTxHash.c_str()); }
return true;
}
}
}else{ printf("isRejectTransaction: [%s] not a Lottery tx, invalid type \n", sCashTxHash.c_str()); }
goto check_Complete;
}
// is a lottery cash tx
//if( validateAddress(sMakerAddr_cash) == false ){ goto check_Complete; }
if( sSignMsg.length() < 60 ){
printf("isRejectTransaction: Cash tx [%s]'s  msg sign [%s] invalid \n", sCashTxHash.c_str(), sSignMsg.c_str());
goto check_Complete;
}
if( verifyMessage(sMakerAddr_cash, sSignMsg, sLotteryBetTxid) == false ) // check cash sender is sMakerAddr_cash's owner
{
printf("isRejectTransaction: Cash tx [%s] sign invalid \n", sCashTxHash.c_str());
goto check_Complete;
}
bCashMsgSignOk = true;
if( fDebug ){ printf("isRejectTransaction: Cash Msg Sign Ok \n"); }

string sLotId_bet, sGuessTxt_bet, sMakerAddr_bet, sLotteryLinkedTxid_gen, sSignMsg_bet;
int iLotteryType_bet, iGuessType_bet, iKeyLen_bet;
int64_t iAmount_bet, iMiniBet_bet, iStartBlock_bet, iEndBlock_bet;

int iBetTxHei = GetTransactionBlockHeight(sLotteryBetTxid);
if( iBetTxHei < BitNetLotteryStartTestBlock_286000 )
{
printf("isRejectTransaction: Bet tx [%s] not exists or invalid, hei =[%u] \n", sLotteryBetTxid.c_str(), iBetTxHei);
goto check_Complete;
}
// get linked bet tx info
i = GetTxMsgParam(sLotteryBetTxid, sLotId_bet, iLotteryType_bet, iGuessType_bet, iAmount_bet, iMiniBet_bet, iStartBlock_bet, iEndBlock_bet, iKeyLen_bet,
sGuessTxt_bet, sLotteryAddr_bet, sLotteryPrivKey_bet, sMakerAddr_bet, sLotteryLinkedTxid_gen, sSignMsg);
if( i < 15 )
{
printf("isRejectTransaction: Cash tx [%s] linked bet tx [%s] is invalid, params count < 15 \n", sCashTxHash.c_str(), sLotteryBetTxid.c_str());
goto check_Complete;
}
if( sMakerAddr_cash != sMakerAddr_bet )
{
printf("isRejectTransaction: Cash tx [%s] maker [%s] != bet tx [%s] maker [%s], invalid \n", sCashTxHash.c_str(), sMakerAddr_cash.c_str(), sLotteryBetTxid.c_str(), sMakerAddr_bet.c_str());
goto check_Complete;
}
if(  iLotteryType_bet != 2 )
{
if(  iLotteryType_bet != 1 ) // If no one guessed, Lottery maker can cash it.
{
printf("isRejectTransaction: [%s] not a bet and genesis tx, invalid type \n", sLotteryBetTxid.c_str());
goto check_Complete;
}
if( fDebug ){ printf("isRejectTransaction: Cash tx linked genesis lottery \n"); }
// Is a Genesis lottery, Cash tx linked a Genesis tx, sMakerAddr_cash must be this lottery's creater
if( iCashTxHei < (iEndBlock_bet + iBitNetBlockMargin3) )
{
printf("isRejectTransaction: Can't cash, iCashTxHei [%u] < [%I64u], please wait :(\n", iCashTxHei, (iEndBlock_bet + iBitNetBlockMargin3));
goto check_Complete;
}
/* if( sMakerAddr_cash != sMakerAddr_bet ){
printf("sMakerAddr_cash [%s] != sMakerAddr_bet [%s], not this lottery's creater :( ", sMakerAddr_cash.c_str(), sMakerAddr_bet.c_str());
goto check_Complete;
} */
//bool isValidLotteryGenesisTxs(const string& txID, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
if( isValidLotteryGenesisTxs(sLotteryBetTxid, iBetTxHei, -1, -1, 0, sMakerAddr_cash, "") == false )
{
printf("isRejectTransaction: [%s] is a genesis tx, but not under rules :(\n", sLotteryBetTxid.c_str());
goto check_Complete;
}
sCashTxLinkedGenesisTx = sLotteryBetTxid.c_str();
// sMakerAddr_cash is this lottery's creater
// scan all of (iStartBlock ~ iEndBlock) blocks, find Bet biggest winner
sLotteryAnswer = getBlockNByteHashStrByType(iEndBlock_bet, iKeyLen_bet, iGuessType_bet);
if( fDebug ){ printf("isRejectTransaction:  sLotteryAnswer = [%s], sGuessTxt_bet = [%s] \n", sLotteryAnswer.c_str(), sGuessTxt_bet.c_str()); }
//int getBetBiggerWinnerFromBlockRange(int iBlockBegin, int iBlockEnd, int iTargetGuessLen, int iTargetGuessType, const string sCorrectAnswer, const string sLotteryGenAddr,
//  int64_t v_TargetValue, string& sRztBiggerAddr, int64_t& i6RztBiggerValue)  
if( getBetBiggerWinnerFromBlockRange(iStartBlock_bet, (iEndBlock_bet - iBitNetBlockMargin3), iKeyLen_bet, iGuessType_bet, sLotteryAnswer, sLotteryAddr_bet, iMiniBet_bet, sRztBiggerAddr, i6RztBiggerValue) > 0 )
{
// someone guessed
if( sRztBiggerAddr == sMakerAddr_cash )
{
bCasherIsWinner = true;
if( fDebug ){ printf("isRejectTransaction: [%s] linked lottery's winner is creator [%s]\n", sCashTxHash.c_str(), sRztBiggerAddr.c_str()); }
}else{ if( fDebug ){ printf("isRejectTransaction: [%s] linked lottery's winner is [%s], not creator [%s] \n", sCashTxHash.c_str(), sRztBiggerAddr.c_str(), sMakerAddr_cash.c_str()); } }
}else{ // no one guessed, lottery creater is winner
sRztBiggerAddr = sMakerAddr_cash;
i6RztBiggerValue = iAmount_bet;
bCasherIsWinner = true;
if( fDebug ){ printf("isRejectTransaction: [%s] linked lottery's winner is creator [%s]\n", sCashTxHash.c_str(), sRztBiggerAddr.c_str()); }
}
goto check_Complete;
}
// is lottery bet tx
if( fDebug ){ printf("isRejectTransaction: Cash tx linked bet lottery \n"); }
if( (iGuessType_bet < 0) || (iGuessType_bet > 1) ) // 0 = guess n byte of block hash text,  1 = guess n byte of block hash digital add
{
printf("isRejectTransaction: Bet guess type [%u] invalid \n", iGuessType_bet);
goto check_Complete;
}
int iGenTxHei = GetTransactionBlockHeight(sLotteryLinkedTxid_gen);
if( (iGenTxHei < BitNetLotteryStartTestBlock_286000) || (iBetTxHei < iGenTxHei) )
{
printf("isRejectTransaction: Genesis tx [%s] not exists or invalid, hei =[%u] \n", sLotteryLinkedTxid_gen.c_str(), iGenTxHei);
goto check_Complete;
}

//bool isValidLotteryGenesisTxs(const string& txID, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
/* if( isValidLotteryGenesisTxs(sLotteryLinkedTxid_gen, iGenTxHei, iGuessType_bet, iKeyLen_bet, 0, sMakerAddr_cash, sLotteryAddr_bet) == false )
{
printf("Bet tx [%s] linked genesis tx [%s] not under rules :(\n", sLotteryBetTxid.c_str(), sLotteryLinkedTxid_gen.c_str());
goto check_Complete;
} */
string sLotId_gen, sGuessTxt_gen, sLotteryAddr_gen, sLotteryPrivKey_gen, sMakerAddr_gen, sLotteryGenesisTxid_gen;
int iLotteryType_gen, iGuessType_gen, iKeyLen_gen;
int64_t iAmount_gen, iMiniBet_gen, iStartBlock_gen, iEndBlock_gen;
// get linked Genesis tx info
i = GetTxMsgParam(sLotteryLinkedTxid_gen, sLotId_gen, iLotteryType_gen, iGuessType_gen, iAmount_gen, iMiniBet_gen, iStartBlock_gen, iEndBlock_gen, iKeyLen_gen,
sGuessTxt_gen, sLotteryAddr_gen, sLotteryPrivKey_gen, sMakerAddr_gen, sLotteryGenesisTxid_gen, sSignMsg);
if( i < 15 )
{
printf("isRejectTransaction: Cash tx [%s] linked bet tx [%s] linked [%s] invalid, params count < 15 \n", sCashTxHash.c_str(), sLotteryBetTxid.c_str(), sLotteryLinkedTxid_gen.c_str());
goto check_Complete;
}
if( iLotteryType_gen != 1 )
{
printf("isRejectTransaction: [%s] not a genesis tx, invalid type \n", sLotteryLinkedTxid_gen.c_str());
goto check_Complete;
}
// is lottery Genesis tx
if( iCashTxHei <= (iEndBlock_gen + iBitNetBlockMargin3) )
{
printf("isRejectTransaction: Cash tx [%s]'s hei [%u] must > [%I64u], please wait \n", sCashTxHash.c_str(), iCashTxHei, (int64_t)(iEndBlock_gen + iBitNetBlockMargin3));
goto check_Complete;
}
//if( (iGenTxHei < iStartBlock_gen) || (iGenTxHei > iEndBlock) || (iEndBlock - iBitNetBlockMargin3)) )

if( (iBetTxHei < iStartBlock_gen) || (iBetTxHei > (iEndBlock_gen - iBitNetBlockMargin3)) )
{
printf("isRejectTransaction: Bet tx [%s]'s Hei (%u) not under rules, invalid :(\n", sLotteryBetTxid.c_str(), iBetTxHei);
goto check_Complete;
}
int64_t i6Mini = MIN_Lottery_Create_Amount;
if( isBitNetLotteryRuleStart() ){ i6Mini = BitNet_Lottery_Create_Mini_Amount_5K; }
if( iAmount_gen < i6Mini )
{
printf("isRejectTransaction: Genesis tx Amount [%I64u] < lottery's mini value [%I64u] :(\n", (iAmount_gen / COIN), (i6Mini / COIN));
goto check_Complete;
}
if( iAmount_bet < iMiniBet_gen )
{
printf("isRejectTransaction: bet amount [%I64u] < mini bet [%I64u] \n", (iAmount_bet / COIN), (iMiniBet_gen / COIN));
goto check_Complete;
}
if( iGuessType_bet != iGuessType_gen )
{
printf("isRejectTransaction: bet type [%u] != genesis type [%u] \n", iGuessType_bet, iGuessType_gen);
goto check_Complete;
}
if( iKeyLen_bet != iKeyLen_gen ) // guess block's hash text
{
printf("isRejectTransaction: bet type [%u], guess len [%u] != genesis guess key len [%u] \n", iGuessType_bet, iKeyLen_bet, iKeyLen_gen);
goto check_Complete;
}

if( isValidPrivKeysAddress(sLotteryPrivKey_gen, sLotteryAddr_gen) == 0 )
{
printf("isRejectTransaction: Genesis lottery PrivKey [%s]'s PubKey not  equ [%s] :(\n", sLotteryPrivKey_gen.c_str(), sLotteryAddr_gen.c_str());
goto check_Complete;
}

if( GetCoinAddrInTxOutIndex(sLotteryLinkedTxid_gen, sLotteryAddr_gen, iAmount_gen) == -1 ) // Check Lottery Amount, =-1 is invalid
{
printf("isRejectTransaction: Genesis tx not include: [%I64u] coins sent to Genesis lottery address [%s] \n", (iAmount_gen / COIN), sLotteryAddr_gen.c_str());
goto check_Complete;
}
if( GetCoinAddrInTxOutIndex(sLotteryBetTxid, sLotteryAddr_gen, iAmount_bet) == -1 )
{
printf("isRejectTransaction: Bet tx not include: [%I64u] coins sent to Genesis lottery address [%s] \n", (iAmount_bet / COIN), sLotteryAddr_gen.c_str());
goto check_Complete;
}

sLotteryAnswer = getBlockNByteHashStrByType(iEndBlock_gen, iKeyLen_gen, iGuessType_gen);
if( fDebug ){ printf("isRejectTransaction:  sLotteryAnswer = [%s], Bet txt = [%s] \n", sLotteryAnswer.c_str(), sGuessTxt_bet.c_str()); }
if( sGuessTxt_bet != sLotteryAnswer )
{
printf("isRejectTransaction: Bet guess text [%s] != [%s], Type = [%u] \n", sGuessTxt_bet.c_str(), sLotteryAnswer.c_str(), iGuessType_gen);
goto check_Complete;
}
// scan all of (iStartBlock_gen ~ iEndBlock_gen)'s block includes tx, find the "Bet Max" and "Bet first" bettor's address
if( getBetBiggerWinnerFromBlockRange(iStartBlock_gen, (iEndBlock_gen - iBitNetBlockMargin3), iKeyLen_gen, iGuessType_gen, sGuessTxt_bet, sLotteryAddr_gen, iAmount_bet, sRztBiggerAddr, i6RztBiggerValue) > 0 )
{
// someone guessed
if( sRztBiggerAddr == sMakerAddr_cash )
{
bCasherIsWinner = true;
sCashTxLinkedGenesisTx = sLotteryLinkedTxid_gen;
if( fDebug ){ printf("isRejectTransaction: [%s] linked lottery's winner is casher [%s]\n", sCashTxHash.c_str(), sRztBiggerAddr.c_str()); }
}else{ if( fDebug ){ printf("[%s] linked lottery's winner is [%s], not casher [%s] \n", sCashTxHash.c_str(), sRztBiggerAddr.c_str(), sMakerAddr_cash.c_str()); } }
}else{ // no one guessed, lottery creater is winner
if( fDebug ){ printf("isRejectTransaction: [%s] linked bet lottery's winner != [%s]\n", sCashTxHash.c_str(), sMakerAddr_cash.c_str()); }
}

}else{ if( fDebug )printf("isRejectTransaction: [%s] not a lottery tx, params count [%u] < 15 \n", sCashTxHash.c_str(), i); }

check_Complete:
if( fDebug ){ printf( "isRejectTransaction: check_Complete, bCasherIsWinner = [%u], tx.vin.size() = [%u], sCashTxLinkedGenesisTx = [%s], sRztBiggerAddr = [%s], \n", bCasherIsWinner, tx.vin.size(), sCashTxLinkedGenesisTx.c_str(), sRztBiggerAddr.c_str() ); }
int j = 0;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
    {
        uint256 hashBlock = 0;
        CTransaction txPrev;
j++;

        if( GetTransaction(txin.prevout.hash, txPrev, hashBlock) ) // get the vin's previous transaction
{  
string sPrevTxMsg = txPrev.vpndata;
CTxDestination source;
string preTxAddress = "";
string sPreTxHash = txPrev.GetHash().ToString();
int iPreTxHei = GetTransactionBlockHeight(sPreTxHash);

if (ExtractDestination(txPrev.vout[txin.prevout.n].scriptPubKey, source))  
{
                                CBitcoinAddress addressSource(source);
preTxAddress = addressSource.ToString();
}

// check for lottery tx, only protect under rules lottery.
string sLotId_Pre, sGuessTxt_Pre, sLotteryAddr_Pre, sLotteryPrivKey_Pre, sMakerAddr_Pre, sLotteryLinkedTxid_Pre, sSignMsg_Pre;
int iLotteryType_Pre, iGuessType_Pre, iKeyLen_Pre;
int64_t iAmount_Pre, iMiniBet_Pre, iStartBlock_Pre, iEndBlock_Pre;

i = GetTxMsgParam(txPrev, sLotId_Pre, iLotteryType_Pre, iGuessType_Pre, iAmount_Pre, iMiniBet_Pre, iStartBlock_Pre, iEndBlock_Pre, iKeyLen_Pre,
sGuessTxt_Pre, sLotteryAddr_Pre, sLotteryPrivKey_Pre, sMakerAddr_Pre, sLotteryLinkedTxid_Pre, sSignMsg_Pre);
if( fDebug ){ printf("isRejectTransaction: (%u) iLotteryType_Pre = [%u], Hei = [%u], Prev Address = [%s], Prev Tx Hash = [%s], Tx Msg = [%s] \n", j, iLotteryType_Pre, iPreTxHei, preTxAddress.c_str(), sPreTxHash.c_str(), sPrevTxMsg.c_str()); }
//if( (sPrevTxMsg.length() > 34) && (sPrevTxMsg.find(strBitNetLotteryMagic) == 0) )   //  "BitNet Lottery:"
if( i < 15 )
{
if( fDebug ){ printf("isRejectTransaction: (%u) Prev Tx [%s] not a lottery tx, params count [%u] < 15, continue \n", j, sPreTxHash.c_str(), i); }
continue;
}

// it's a lottery tx
bool bValidPayTx = false;
int iPreTx_linked_Hei = GetTransactionBlockHeight(sLotteryLinkedTxid_Pre); // genesis tx's sLotteryLinkedTxid_Pre is empt
if( fDebug ){ printf("isRejectTransaction: (%u) iPreTx_linked_Hei = [%u],  iCashTxHei = [%u], sLotteryLinkedTxid_Pre [%s] \n", j, iPreTx_linked_Hei, iCashTxHei, sLotteryLinkedTxid_Pre.c_str()); }
if( (iPreTxHei < BitNetLotteryStartTestBlock_286000) || (iCashTxHei <= iPreTxHei) )
{
if( fDebug )printf("isRejectTransaction: (%u) iPreTxHei = [%u] not under rules,  iCashTxHei = [%u], continue :(\n", j, iPreTxHei, iCashTxHei);
continue;
}
if( iLotteryType_Pre == 1 ) // genesis tx
{
//bool isValidLotteryGenesisTx(const CTransaction& tx, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
bValidPayTx = isValidLotteryGenesisTx(txPrev, iPreTxHei, -1, -1, 0, "", "");
}
else if( iLotteryType_Pre == 2 ) // bet tx
{
//bool isValidLotteryBetTx(const CTransaction& tx, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
bValidPayTx = isValidLotteryBetTx(txPrev, iPreTxHei, -1, -1, 0, "", "");
}else{
if( fDebug )printf("isRejectTransaction: (%u) invalid lottery, type [%u], continue \n", j, iLotteryType_Pre);
continue;
}

if( fDebug ){ printf("isRejectTransaction: (%u) bValidPayTx = [%u], bCasherIsWinner = [%u] \n", j, bValidPayTx, bCasherIsWinner); }
if( bCasherIsWinner == false )
{
if( bValidPayTx )
{
iWillBan++;
if( fDebug )printf("isRejectTransaction: (%u) sMakerAddr_cash(%s) not lottery cash tx [%s] linked tx's winner, will ban. \n", j, sMakerAddr_cash.c_str(), sCashTxHash.c_str());
if( isBitNetLotteryRuleStart() )
{
if( fDebug )printf("isRejectTransaction: (%u) isBitNetLotteryRuleStart, bCasherIsWinner = false, bValidPayTx = [%u], ban! \n*******************\n\n\n", j, bValidPayTx);
return true;
}
}else{ if( fDebug ){ printf("isRejectTransaction: (%u) bCasherIsWinner = false, bValidPayTx = false ... \n", j); } }
}
else{
// sMakerAddr_cash is a winner, but it's all input lottery tx's winner? let's check it (check the lottery genesis tx).
if( fDebug ){ printf("isRejectTransaction: (%u) bCasherIsWinner = true, bValidPayTx = [%u], iLotteryType_Pre = [%u] \n", j, bValidPayTx, iLotteryType_Pre); }
if( bValidPayTx )
{
if( iLotteryType_Pre == 1 ) // genesis tx
{
if( sPreTxHash != sCashTxLinkedGenesisTx )
{
iWillBan++;
if( fDebug )printf("isRejectTransaction: (%u) [%s] is genesis tx [%s]'s winner, but can't cash other genesis tx [%s]'s, will ban. \n", j, sMakerAddr_cash.c_str(), sCashTxLinkedGenesisTx.c_str(), sPreTxHash.c_str());
if( isBitNetLotteryRuleStart() )
{
if( fDebug ){ printf("[%s] end ********************\n\n\n", sCashTxHash.c_str()); }
return true;
}
}
}
else if( iLotteryType_Pre == 2 ) // bet tx
{
if( sLotteryLinkedTxid_Pre != sCashTxLinkedGenesisTx )
{
iWillBan++;
if( fDebug )printf("isRejectTransaction: (%u) [%s] is genesis tx [%s]'s winner, but can't cash bet tx linked other genesis tx [%s]'s, will ban. \n", j, sMakerAddr_cash.c_str(), sCashTxLinkedGenesisTx.c_str(), sLotteryLinkedTxid_Pre.c_str());
if( isBitNetLotteryRuleStart() )
{
if( fDebug ){ printf("[%s] end ********************\n\n\n", sCashTxHash.c_str()); }
return true;
}
}
}
}else{ if( fDebug )printf("isRejectTransaction: (%u) bCasherIsWinner = true, bValidPayTx = false, iLotteryType_Pre = [%u],  continue\n", j, iLotteryType_Pre); }
}
}else{ if( fDebug )printf("isRejectTransaction: (%u) GetTransaction(txin.prevout.hash, txPrev, hashBlock) false, continue \n", j); }
}
if( !rzt ){ if( fDebug ){ printf("isRejectTransaction: i Will Ban = [%u], bCashMsgSign = [%u], bCasherIsWinner = [%u] \n", iWillBan, bCashMsgSignOk, bCasherIsWinner); }}
if( fDebug ){ printf("[%s] end ********************\n\n\n", sCashTxHash.c_str()); }
return rzt;
}

Some related functions:
Code:
string GetPrivKeysAddress(string &strSecret)
{
    string rzt = "";
    CBitcoinSecret vchSecret;
    bool fGood = vchSecret.SetString(strSecret);
    if ( !fGood ) return rzt;

    CKey key;
    bool fCompressed;
    CSecret secret = vchSecret.GetSecret(fCompressed);
    key.SetSecret(secret, fCompressed);
    CKeyID vchAddress = key.GetPubKey().GetID();
CBitcoinAddress ba(vchAddress);
rzt = ba.ToString();
    return rzt;
}

bool isValidPrivKeysAddress(string &strSecret, string &sAddr)
{
bool rzt = false;
if( strSecret.length() < 34 ) return rzt;
if( sAddr.length() < 34 ) return rzt;
string vAddr = GetPrivKeysAddress(strSecret);
rzt = ( sAddr == vAddr );
return rzt;
}

int GetTxMsgParam(const CTransaction& tx, string& sLotteryId, int& iCardType, int& iGuessType, int64_t& iAmount, int64_t& iMiniBet, int64_t& iStartBlock, int64_t& iEndBlock, int& iKeyLen,
    string& sGuessTxt, string& sLotteryAddr, string& sLotteryPrivKey, string& sMakerAddr, string& sLotteryLinkedTxid, string& sSignMsg)
{
int rzt = 0;
string stxData = "";
if( tx.vpndata.length() > 0 ){ stxData = tx.vpndata.c_str(); }
//if( fDebug ){ printf("GetTxMsgParam: tx Msg = [%s] \n", stxData.c_str()); }
// Lottery Flag | Lottery ID | Card Type( Create = 1, Bet = 2, Cash = 3 ) | Guess Type | Amount | Mini Bet | Start block | Target block | Guess HASH Len | Guess Txt | Lottery wallet address | Lottery wallet PrivKey | Def_WalletAddress | Lottery Tx ID Str ( If it's Bet tx ) | SignMsg ( if it's Cash tx )
// BitNet Lottery: | 123456 | 1 | 0 | 10000 | 500 | 234000 | 235000 | 6 | Vbq7grdv6caVBf1RoHPJZ9RuhsHqmY3bLi | WarWyAu2UsCKzjQWvKMT5vBbMypMuS2ru37QtUdNoFDySTjxH8uY | VevimYsrNKWbx2W6Bnq2qyLthcnEasLMTg | 21051c47f29dd01a828cd6197ce6563d4c184ecff3e34a0599fa2af8d6c65ef5 | H3rQLBiDTZwKB1OGFo8zs5RJr/XH2ubrIHGTCKnOdP4bHsu5KgikkBPujJWJ6VweY7ZZR19JbjH7kZ8qKI50h1k=
if( (stxData.length() > 34) && (stxData.find(strBitNetLotteryMagic) == 0) )   //  "BitNet Lottery:"
{
char * pch;
char *delim = "|";
int i = 0;
sLotteryId = "";
string sAmount = "", sMiniBet = "";
sGuessTxt = "", sSignMsg = "";
string sStartBlock = "", sEndBlock = "", sKeyLen = "";
sLotteryAddr = "", sLotteryPrivKey = "", sMakerAddr = "",  sLotteryLinkedTxid = "";
iAmount = 0, iMiniBet = 0, iStartBlock = 0, iEndBlock = 0;
iKeyLen = 0, iCardType = 0, iGuessType = 0;
double dv = 0;

char * pVpn = (char *)stxData.c_str();
//printf ("vpndata = [%s]\n", pVpn);
pch = strtok(pVpn, delim);
while (pch != NULL)
{
i++;
if( i == 2 ){ sLotteryId = pch; }
else if( i == 3 ){ iCardType = atoi(pch); } //  create = 1, bet = 2, cash = 3
else if( i == 4 ){ iGuessType = atoi(pch); }
else if( i == 5 ){ sAmount = pch; dv = atof(pch); iAmount = roundint64(dv * COIN); }
else if( i == 6 ){ sMiniBet = pch; dv = atof(pch); iMiniBet = roundint64(dv * COIN); }
else if( i == 7 ){ sStartBlock = pch;  dv =  atof(pch); iStartBlock = roundint64(dv); }  //S_To_64(pch); }
else if( i == 8 ){ sEndBlock = pch; iEndBlock = S_To_64(pch); }
else if( i == 9 ){ sKeyLen = pch; iKeyLen = atoi(pch); }
else if( i == 10 ){ sGuessTxt = pch; }
else if( i == 11 ){ sLotteryAddr = pch; }
else if( i == 12 ){ sLotteryPrivKey = pch; }
else if( i == 13 ){ sMakerAddr = pch; }
else if( i == 14 ){ sLotteryLinkedTxid = pch; }
else if( i == 15 ){ sSignMsg = pch; }
//if( fDebug ){ printf ("%s, %d\n", pch, i); }
pch = strtok (NULL, delim);
}
rzt = i;
}
return rzt;
}

Code:
bool isValidLotteryGenesisTx(const CTransaction& tx, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
{
bool rzt = false;

string sTxHash = tx.GetHash().ToString();
if( iTxHei == -1 ){ iTxHei = GetTransactionBlockHeight(sTxHash); }
if( iTxHei == 0 ){
if( fDebug ) printf("isValidLotteryGenesisTx: Tx [%s] Hei = 0, set to nBestHeight [%u] \n", sTxHash.c_str(), nBestHeight);
iTxHei = nBestHeight;
}
if( fDebug ){ printf("isValidLotteryGenesisTx: Tx [%s] Hei = [%u], nBestHeight [%u] \n", sTxHash.c_str(), iTxHei, nBestHeight); }
if( iTxHei < BitNetLotteryStartTestBlock_286000 ){ return rzt; }

string sLotId, sGuessTxt, sLotteryAddr, sLotteryPrivKey, sMakerAddr, sLotteryGenesisTxid, sSignMsg;
int iLotteryType, iGuessType, iHashLen;
int64_t iAmount, iMiniBet, iStartBlock, iEndBlock;

int i = GetTxMsgParam(tx, sLotId, iLotteryType, iGuessType, iAmount, iMiniBet, iStartBlock, iEndBlock, iHashLen, sGuessTxt, sLotteryAddr, sLotteryPrivKey, sMakerAddr, sLotteryGenesisTxid, sSignMsg);
if( (i < 15) || (iLotteryType != 1) || (iHashLen < 1) || (iHashLen > 64) )
{
if( fDebug ){ printf("isValidLotteryGenesisTx: i (%u) < 15 or iLotteryType(%u) != 1 or iHashLen(%u) < 1 or > 64 \n", i, iLotteryType, iHashLen); }
return rzt;
} // block hash len = 64
if( fDebug ){ printf("isValidLotteryGenesisTx: iGuessType = [%u], sLotteryAddr = [%s],  sMakerAddr = [%s]\n", iGuessType, sLotteryAddr.c_str(), sMakerAddr.c_str()); }
if(  (iGuessType < 0) ||  (iGuessType > 1) ){ return rzt; }
if( validateAddress(sLotteryAddr) == false ){ return rzt; }
if( validateAddress(sMakerAddr) == false ){ return rzt; }

if( (iTargetGuessType != -1) && (iTargetGuessType != iGuessType) ){ return rzt; }
if( (iTargetGuessLen != -1) && (iTargetGuessLen != iHashLen) ){ return rzt; }
if( (i6TargetBlock != 0) && (i6TargetBlock != iEndBlock) ){ return rzt; }
if( (sTargetMaker.length() > 30) && (sTargetMaker != sMakerAddr) ){ return rzt; }
if( (sTargetGenesisAddr.length() > 30) && (sLotteryAddr != sTargetGenesisAddr) ){ return rzt; }

int64_t i6Mini = MIN_Lottery_Create_Amount;
if( isBitNetLotteryRuleStart() ){ i6Mini = BitNet_Lottery_Create_Mini_Amount_5K; }
if( iAmount < i6Mini )
{
if( fDebug ) printf("isValidLotteryGenesisTx: Amount [%I64u] < publish lottery's mini value [%I64u] :(\n", iAmount / COIN, i6Mini / COIN);
return rzt;
}
if( (iTxHei < iStartBlock) || (iTxHei > (iEndBlock - (BitNetBeginAndEndBlockMargin_Mini_30 - 10))) ) //iBitNetBlockMargin3
{
if( fDebug ) printf("isValidLotteryGenesisTx: Blocks not under rules, Hei = [%u] : [%I64u ~ %I64u] :(\n", iTxHei, iStartBlock, (iEndBlock - 20));
return rzt;
}

int64_t i6mg = iEndBlock - iStartBlock;
if( (iEndBlock > iStartBlock) && (i6mg >= BitNetBeginAndEndBlockMargin_Mini_30) && (i6mg <= BitNetBeginAndEndBlockMargin_Max_4320) ) // Target block number must big than start block
{
if( isValidPrivKeysAddress(sLotteryPrivKey, sLotteryAddr) )
{
if( GetCoinAddrInTxOutIndex(tx, sLotteryAddr, iAmount) >= 0 ) // Check Lottery Amount, =-1 is invalid
{
rzt = true;
if( fDebug ){ printf("isValidLotteryGenesisTx: Yes :) \n"); }
}else{ printf("isValidLotteryGenesisTx: [%I64u] coins not send to [%s] :(\n", iAmount, sLotteryAddr.c_str()); }
}else{ printf("isValidLotteryGenesisTx: Lottery PrivKey [%s]'s PubKey not  equ [%s] :(\n", sLotteryPrivKey.c_str(), sLotteryAddr.c_str()); }
}else{ printf("isValidLotteryGenesisTx: Lottery Block (%I64u) : (%I64u) not under rules :(\n", iStartBlock, iEndBlock); }
return rzt;
}

Code:
bool isValidLotteryBetTx(const CTransaction& tx, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
{
bool rzt = false;

string sTxHash = tx.GetHash().ToString();
if( iTxHei == -1 ){ iTxHei = GetTransactionBlockHeight(sTxHash); }
if( iTxHei == 0 ){
if( fDebug ) printf("isValidLotteryBetTx: Tx [%s] Hei = 0, set to nBestHeight [%u] \n", sTxHash.c_str(), nBestHeight);
iTxHei = nBestHeight;
}
if( fDebug ){ printf("isValidLotteryBetTx: Tx [%s] Hei = [%u], nBestHeight = [%u] \n", sTxHash.c_str(), iTxHei, nBestHeight); }
if( iTxHei < BitNetLotteryStartTestBlock_286000 ){ return rzt; }

string sLotId, sGuessTxt, sLotteryAddr, sLotteryPrivKey, sMakerAddr, sLotteryGenesisTxid, sSignMsg;
int iLotteryType, iGuessType, iHashLen;
int64_t iAmount, iMiniBet, iStartBlock, iEndBlock;

int i = GetTxMsgParam(tx, sLotId, iLotteryType, iGuessType, iAmount, iMiniBet, iStartBlock, iEndBlock, iHashLen, sGuessTxt, sLotteryAddr, sLotteryPrivKey, sMakerAddr, sLotteryGenesisTxid, sSignMsg);
if( (i < 15) || (iLotteryType != 2) || (iHashLen < 1) || (iHashLen > 64) )
{
if( fDebug ) printf("isValidLotteryBetTx: (i[%u] < 15) || (iLotteryType[%u] != 2) || (iHashLen[%u] < 1) || (iHashLen > 64) :( \n", i, iLotteryType, iHashLen);
return rzt;
} // block hash len = 64
if(  (iGuessType < 0) ||  (iGuessType > 1) )
{
if( fDebug ) printf("isValidLotteryBetTx: (iGuessType < 0) ||  (iGuessType > 1) :( \n");
return rzt;
}
if( validateAddress(sMakerAddr) == false )
{
if( fDebug ) printf("isValidLotteryBetTx: sMakerAddr [%s] invalid :( \n", sMakerAddr.c_str());
return rzt;
}
if( validateAddress(sLotteryAddr) == false )
{
if( fDebug ) printf("isValidLotteryBetTx: sLotteryAddr [%s] invalid :( \n", sLotteryAddr.c_str());
return rzt;
}

if( (iTargetGuessType != -1) && (iTargetGuessType != iGuessType) )
{
if( fDebug ) printf("isValidLotteryBetTx: '(iTargetGuessType != -1) && (iTargetGuessType != iGuessType)' :(\n");
return rzt;
}
if( (iTargetGuessLen != -1) && (iTargetGuessLen != iHashLen) )
{
if( fDebug ) printf("isValidLotteryBetTx: '(iTargetGuessLen != -1) && (iTargetGuessLen != iHashLen)' :(\n");
return rzt;
}
if( (i6TargetBlock > BitNetLotteryStartTestBlock_286000) && (i6TargetBlock != iEndBlock) )
{
if( fDebug ) printf("isValidLotteryBetTx: 'i6TargetBlock > BitNetLotteryStartTestBlock_286000) && (i6TargetBlock != iEndBlock)' :( \n");
return rzt;
}
if( (sTargetMaker.length() > 30) && (sTargetMaker != sMakerAddr) )
{
if( fDebug ) printf("isValidLotteryBetTx: '(sTargetMaker.length() > 30) && (sTargetMaker != sMakerAddr)' :(\n");
return rzt;
}
if( (sTargetGenesisAddr.length() > 30) && (sLotteryAddr != sTargetGenesisAddr) )
{
if( fDebug ) printf("isValidLotteryBetTx: '(sTargetGenesisAddr.length() > 30) && (sLotteryAddr != sTargetGenesisAddr)' :( \n");
return rzt;
}

int iTxHei_gen = GetTransactionBlockHeight(sLotteryGenesisTxid);
if( fDebug ){ printf("isValidLotteryBetTx: iTxHei_gen = [%u], iTxHei = [%u], [%s] \n", iTxHei_gen, iTxHei, sLotteryGenesisTxid.c_str()); }
//isValidLotteryBetTx: iTxHei_gen = [286893], iTxHei = [286893], [91b12f9f1961233ec9e2ddbbb3363b45d5b6a701bbbd8b332361a123b29cd343]
if( (iTxHei_gen < BitNetLotteryStartTestBlock_286000) || (iTxHei <= iTxHei_gen) )
{
if( fDebug ) printf("isValidLotteryBetTx: '(iTxHei_gen(%u) < BitNetLotteryStartTestBlock_286000) || (iTxHei[%u] <= iTxHei_gen)' :( \n", iTxHei_gen, iTxHei);
return rzt;
}

//bool isValidLotteryGenesisTxs(const string& txID, int iTxHei, int iTargetGuessType, int iTargetGuessLen, int64_t i6TargetBlock, const string sTargetMaker, const string sTargetGenesisAddr)
if( isValidLotteryGenesisTxs(sLotteryGenesisTxid, iTxHei_gen, iGuessType, iHashLen, iEndBlock, "", sLotteryAddr) == false )
{
if( fDebug ) printf("isValidLotteryBetTx: Tx [%s] linked Genesis tx [%s] invalid :( \n", sTxHash.c_str(), sLotteryGenesisTxid.c_str());
return rzt;
}

string sLotId_gen, sGuessTxt_gen, sLotteryAddr_gen, sLotteryPrivKey_gen, sMakerAddr_gen, sLotteryGenesisTxid_gen, sSignMsg_gen;
int iLotteryType_gen, iGuessType_gen, iKeyLen_gen;
int64_t iAmount_gen, iMiniBet_gen, iStartBlock_gen, iEndBlock_gen;

i = GetTxMsgParam(sLotteryGenesisTxid, sLotId_gen, iLotteryType_gen, iGuessType_gen, iAmount_gen, iMiniBet_gen, iStartBlock_gen, iEndBlock_gen, iKeyLen_gen,
sGuessTxt_gen, sLotteryAddr_gen, sLotteryPrivKey_gen, sMakerAddr_gen, sLotteryGenesisTxid_gen, sSignMsg_gen);
if( (i < 15) || (iLotteryType_gen != 1) )
{
if( fDebug ) printf("isValidLotteryBetTx: params count [%u] < 15 Or iLotteryType_gen(%u) != 1:( \n", i, iLotteryType_gen);
return rzt;
}
if( (iTxHei < iStartBlock_gen) || (iTxHei > (iEndBlock_gen - iBitNetBlockMargin3)) )
{
if( fDebug ) printf( "isValidLotteryBetTx: Hei (%u) not under rules (%I64u ~ %I64u), invalid :( \n", iTxHei, iStartBlock_gen, (iEndBlock_gen - iBitNetBlockMargin3) );
return rzt;
}
if( iAmount < iMiniBet_gen )
{
if( fDebug ) printf("isValidLotteryBetTx: Bet Amount [%I64u] less than genesis tx's MiniBet [%I64u] :( \n", iAmount, iMiniBet_gen);
return rzt;
}
if( GetCoinAddrInTxOutIndex(tx, sLotteryAddr_gen, iAmount) >= 0 ) // Check bet is send to lottery genesis tx's Address
{
rzt = true;
if( fDebug ){ printf("isValidLotteryBetTx: Yes :) \n"); }
}else{ printf("isValidLotteryBetTx: not found bet [%I64u] send to gen address [%s] :( \n", iAmount, sLotteryAddr_gen.c_str()); }
return rzt;
}




BitNet Lottery GUI:


Jump to: