smart contract list
-
Moved to Development
-
@luxe I'd like to know why you are not hosting a lottery since the code is already there? / You wrote it?
-
@msgAnton good question :-)
-
@msgAnton No, @luxe didn't wrote it... that lottery code was written by vcbs and the rest of the CIYAM Team. I know that code runned for some time and i think it was the first AT ever deployed in BURST... I'm not sure why the code is not running anymore but i remember i heared about some bug in there, so i think this code can be used as base but probably need some tweeks in there ;D
-
@gpedro yes theres a bug somewhere, the last lottery test ended up dumping all the funds in the original wallet that created it when the lottery was finished instead of picking a winner and going through the logic that was wrote.
i have the javascript hosted on my site and can host the lottery.html if you want
-
@Lexicon What is your site man? xD
I have been looking for that javascript for some time now xDEDIT: by your site you mean lexitoshi.uk or burst.lexitoshi.uk? I can't open any of these right now... Is it down or is my FF getting me pranked? xP
-
-
@Lexicon thanks, are sources for smartcontractor somewhere, to contribute and contain development?!
-
@luxe i have the java-script source for it however its been heavily obfuscated and was done in the beginning of burst which is unfortunate.
-
I get scared by obfuscated code. There's only two reasons to do it. 1) Your trying to lie steal and cheat from someone or 2) You don't want people to see what you did because it's either shitty or incomplete.
I have read the AT code values, it's a version ASM. I believe we might be better off starting our own from the ground and building up using GitHub and a combination of J/S and HTML.
-IceBurst
-
@IceBurst you forget thwre are diferent reasons as well :) but i guess thats different :)
Example, code minification and uglifying (web devs should know). And i think i personaly would pull obfuscation if someone would start blatantly stealing code :)
-
@IceBurst exactly. as soon as i saw the code for it i told crow that yeah i could reverse engineer it tracing through the code. however that would take an inordinate amount of time. i might as well just relearn assembly that i was taught in college and rewrite it would totally be faster.
@LithStud people generally dont like their code being stolen and im guessing that was the main reason for obfuscating it however i havnt a clue why someone would want to do it to something so bespoke
-
We don't exactly have a testnet... I'm afraid that once we start doing this, we're gonna be spending couple of dollars running and testing our AT's and you can't even profit off it.. Honestly i feel that we should adapt DASH's ecosystem to give the developers some motivation to work on the wallet / Interfaces.
Regarding http://burst.lexitoshi.uk/smartcontractor.html...
The webpage doesn't work? I tried to "Examine AT" but it didn't give be back anything.. ID used was 9192603983782913483Even the AT Assembler fails to compile 01 00000000 00000001 which is set value at address 0 to 1.
I have also compiled a few source codes on the ciyam.cpp file located at http://ciyam.org/at/_at.cpp.html. but yea.. How can i confirm that the opcodes at CIYAM and BURST are the exact same implementation?
-
@Lexicon Thanks for that... ;D
-
@msgAnton works for me
-
@Lexicon Oh. you're supposed to use the text instead of the hex. thats good. and here i was coding in hex..
-
@msgAnton ;) makes it much easier doesnt it lol
-
^declare currentTime ^declare ticketPrice ^declare minNumPlayers ^declare currentNumPlayers ^declare endTime ^declare buffer1 ^declare deadAT ^declare currentWinner ^declare currentTickets ^declare previousBalance ^declare currentBalance ^declare winnerPercent ^comment when the program starts for the next time, it will start from here. PCS ^comment This is the start of the program. if it is not the first run, skip to start. BNZ $currentTime :Update ^comment If this is the first time running, set some default variables. Start: FUN @currentTime get_Creation_Timestamp SET @ticketPrice #0000050000000000 SET @minNumPlayers #000000000000000f SET @winnerPercent #0000000000000050 FUN @previousBalance get_Current_Balance ^comment by default, the creator wins. INC @currentTickets FUN B_to_Address_of_Creator FUN @currentWinner get_B1 ^comment Normal AT runs here Update: FUN @currentTime get_Block_Timestamp ^comment if Lottery is over, just give me the BURST. BNZ $deadAT :ErrorHandle UpdateNewPlayer: ^comment check how much the PlayerPaid and convert to tickets FUN @currentBalance get_Current_Balance SET @newTicks $currentBalance SUB @newTicks $previousBalance DIV @newTicks $ticketPrice ^comment run internal lottery based on past tickets SET @totalTicks $currentTickets ADD @totalTicks $newTicks ^comment Random Number Generator FUN put_Last_Block_Hash_In_A SET @myRandomSeed #000000000c5d6215 ADD @myRandomSeed $currentTime FUN set_B1 $myRandomSeed FUN XOR_A_with_B FUN get_A1 $myRandomNumber ^comment based on random number, figure out who won. MOD @myRandomNumber $totalTicks SET @currentTickets $totalTicks BGT $myRandomNumber $currentTickets :ChangeWinner Update11: ^comment if the end time is set, jump to update2 BZR $endTime :Update2 ^comment if time is up, end the lottery BGT $currentTime $endTime :CloseAuction Update2: ^comment if there are enough players, set the end time. BGE $currentNumPlayers $minNumPlayers :SetEndTime Update3: ^comment finish this run. JMP :End ChangeWinner: FUN A_to_Tx_after_Timestamp FUN @currentWinner get_Ticket_Id_for_Tx_in_A JMP :Update11 SetEndTime: ^comment do not set endtime again if it has been set BNZ $endTime :Update3 ^comment set the end time to current time + 3 days. SET @buffer1 #00000000000010e0 FUN @endTime add_Minutes_to_Timestamp $currentTime $buffer1 JMP :Update3 ^comment we select a winner here and kill the AT CloseAuction: INC @deadAT FUN set_B1 $currentWinner ^comment calculate payout SET @buffer1 #000000000000000a DIV @currentBalance $buffer1 MUL @currentBalance $winnerPercent FUN send_to_Address_in_B $currentBalance ^comment die and give me money. ErrorHandle: FUN B_to_Address_of_Creator FUN send_All_to_Address_in_B ^comment reset the AT so that it give me all the money that people test with. End: FINShould work as a lottery.. Now i just need to find out how to test my code.
-
@msgAnton you could try the ATDebugger
I'm trying hard to wrap my head around all of this but damn its hard!-/
Also tried to run your code through the Debugger but it never came to an end! Not even after clicking through 1200 Blocks!-/
-
@msgAnton said in smart contract list:
^declare currentTime
^declare ticketPrice
^declare minNumPlayers
^declare currentNumPlayers
^declare endTime
^declare buffer1
^declare deadAT
^declare currentWinner
^declare currentTickets
^declare previousBalance
^declare currentBalance
^declare winnerPercent^comment when the program starts for the next time, it will start from here.
PCS^comment This is the start of the program. if it is not the first run, skip to start.
BNZ $currentTime :Update^comment If this is the first time running, set some default variables.
Start:
FUN @currentTime get_Creation_Timestamp
SET @ticketPrice #0000050000000000
SET @minNumPlayers #000000000000000f
SET @winnerPercent #0000000000000050
FUN @previousBalance get_Current_Balance
^comment by default, the creator wins.
INC @currentTickets
FUN B_to_Address_of_Creator
FUN @currentWinner get_B1^comment Normal AT runs here
Update:
FUN @currentTime get_Block_Timestamp
^comment if Lottery is over, just give me the BURST.
BNZ $deadAT :ErrorHandleUpdateNewPlayer:
^comment check how much the PlayerPaid and convert to tickets
FUN @currentBalance get_Current_Balance
SET @newTicks $currentBalance
SUB @newTicks $previousBalance
DIV @newTicks $ticketPrice
^comment run internal lottery based on past tickets
SET @totalTicks $currentTickets
ADD @totalTicks $newTicks
^comment Random Number Generator
FUN put_Last_Block_Hash_In_A
SET @myRandomSeed #000000000c5d6215
ADD @myRandomSeed $currentTime
FUN set_B1 $myRandomSeed
FUN XOR_A_with_B
FUN get_A1 $myRandomNumber
^comment based on random number, figure out who won.
MOD @myRandomNumber $totalTicks
SET @currentTickets $totalTicks
BGT $myRandomNumber $currentTickets :ChangeWinnerUpdate11:
^comment if the end time is set, jump to update2
BZR $endTime :Update2
^comment if time is up, end the lottery
BGT $currentTime $endTime :CloseAuctionUpdate2:
^comment if there are enough players, set the end time.
BGE $currentNumPlayers $minNumPlayers :SetEndTimeUpdate3:
^comment finish this run.
JMP :EndChangeWinner:
FUN A_to_Tx_after_Timestamp
FUN @currentWinner get_Ticket_Id_for_Tx_in_A
JMP :Update11SetEndTime:
^comment do not set endtime again if it has been set
BNZ $endTime :Update3
^comment set the end time to current time + 3 days.
SET @buffer1 #00000000000010e0
FUN @endTime add_Minutes_to_Timestamp $currentTime $buffer1
JMP :Update3^comment we select a winner here and kill the AT
CloseAuction:
INC @deadAT
FUN set_B1 $currentWinner
^comment calculate payout
SET @buffer1 #000000000000000a
DIV @currentBalance $buffer1
MUL @currentBalance $winnerPercent
FUN send_to_Address_in_B $currentBalance^comment die and give me money.
ErrorHandle:
FUN B_to_Address_of_Creator
FUN send_All_to_Address_in_B^comment reset the AT so that it give me all the money that people test with.
End:
FINill try it now. do a small local test to see if it works.





