tx · D96hToBsFmEB6wnqQAiYT5c1KHvySUbDnbj5mf77vxxM

3MsFYLbwc3BAniUtr1QNLvQd85d79UC8ZcC:  -1.40000000 Waves

2019.08.20 11:49 [639232] smart account 3MsFYLbwc3BAniUtr1QNLvQd85d79UC8ZcC > SELF 0.00000000 Waves

{ "type": 13, "id": "D96hToBsFmEB6wnqQAiYT5c1KHvySUbDnbj5mf77vxxM", "fee": 140000000, "feeAssetId": null, "timestamp": 1566291007062, "version": 1, "sender": "3MsFYLbwc3BAniUtr1QNLvQd85d79UC8ZcC", "senderPublicKey": "GeD2RXjpmLW5kUCUsNuWccCK3LH25iEB3zGcnJYqZLMU", "proofs": [ "5eCvxcn9Qi9PBhoMKGAQ2fdW7W647FiV6mibWrMxjgY8E5bvCD5qtnDQ52QRyBHwvw7MYieKU4tAFQu1cg42tcir" ], "script": "base64:AwQAAAAHUHViS2V5MQEAAAAgaQxxSAhSITOlMYdvwKcfK7u/x0yzOg/68EH0ax0QlWUEAAAAB1B1YktleTIBAAAAILb58FcZXTIbjEshMW6ayDB2XcNop87YatlbtNE8j6N0BAAAAARzaWcxAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAB1B1YktleTEAAAAAAAAAAAEAAAAAAAAAAAAEAAAABHNpZzIDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAHUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAkAAGYAAAACCQAAZAAAAAIFAAAABHNpZzEFAAAABHNpZzIAAAAAAAAAAADO+UOI", "chainId": 84, "height": 639232, "spentComplexity": 0 } View: original | compacted Prev: B1ogbXuWRikmVn785pMuABmfZ9Hmn7Am9CDS1Nnvha4Q Next: DZ5mF1wYNKD3bhDizXoTnJ5xWCUQ9rELzsajxjn3NtJf Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqlAiANSmBpDHYKP9sKgeN/l1bAb28g/tGlgDkwT5FiMN4X3pwdvdxE7mvSR8/41dU9rx4jG+6tZpb1ULVDPs431tR2IRaTXw5Cj+Ac2vhL+5JamCerGD1UW+bh/EGQtxo8W3YLDrofXB5QHJx4Pkz2Kgf+oS/C8hHuB/U4krO76U0507GTjZPP9kRQ0uLSMeqQXt8wXS+nMp5wajqxPpDLMaSREgsKwv/AEkP4dzpTYbikLBYl4qtdJsD84HLFSkiwd3BhcOrPjoIYmLxQuBD5TIMKTKD3sdZgaY9rsyqx3A00innyxD6zp3b4gFpUOX8JxKZdEC2myEqleNgg7GzwIDAQAB")
5-
6-let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j")
7-
8-let WAVELET = ((100 * 1000) * 1000)
9-
10-let EMPTYSTRING = ""
11-
12-let EMPTYVECT = toBytes(EMPTYSTRING)
13-
14-let SEPARATOR = "_"
15-
16-let SESSIONIDFIXSIZE = 50
17-
18-let RANDCYCLEPRICE = ((5 * WAVELET) / 1000)
19-
20-let MAXRANDSPERCYCLE = 15
21-
22-let STATEINIT = "INIT"
23-
24-let DATADONE = "READY"
25-
26-let STATEFINISHED = "FINISHED"
27-
28-func abs (val) = if ((0 > val))
29- then -(val)
30- else val
31-
32-
33-func formatStateDataStr (drawState,organizerPubKey58,randOrEmpty) = {
34- let fullStateStr = ((drawState + SEPARATOR) + organizerPubKey58)
35- if ((randOrEmpty == EMPTYSTRING))
36- then fullStateStr
37- else ((fullStateStr + SEPARATOR) + randOrEmpty)
38- }
39-
40-
41-func extractGameDataList (sessionId) = {
42- let rawDataStr = getStringValue(this, sessionId)
43- split(rawDataStr, SEPARATOR)
44- }
45-
46-
47-func nextRand (currRandsStr,remainingHash) = {
48- let nextRandInt = abs(toInt(remainingHash))
49- let nextRandStr = toString(nextRandInt)
50- let duplicate = isDefined(indexOf(currRandsStr, nextRandStr))
51- if (if ((currRandsStr == EMPTYSTRING))
52- then true
53- else !(duplicate))
54- then [((currRandsStr + SEPARATOR) + nextRandStr), "yes"]
55- else [currRandsStr, EMPTYSTRING]
56- }
57-
58-
59-func generateRand (sessionId,from,to,rsaSign) = {
60- let randHash = sha256(rsaSign)
61- let currRandsStr = getStringValue(this, sessionId)
62- let lastOffset = getIntegerValue(this, sessionId)
63- let rand1 = nextRand(currRandsStr, drop(randHash, (lastOffset + 1)))
64- let rand2 = nextRand(currRandsStr, drop(randHash, (lastOffset + 2)))
65- let rand3 = nextRand(currRandsStr, drop(randHash, (lastOffset + 3)))
66- let rand4 = nextRand(currRandsStr, drop(randHash, (lastOffset + 4)))
67- let rand5 = nextRand(currRandsStr, drop(randHash, (lastOffset + 5)))
68- let rand6 = nextRand(currRandsStr, drop(randHash, (lastOffset + 6)))
69- let rand7 = nextRand(currRandsStr, drop(randHash, (lastOffset + 7)))
70- let rand8 = nextRand(currRandsStr, drop(randHash, (lastOffset + 8)))
71- let rand9 = nextRand(currRandsStr, drop(randHash, (lastOffset + 9)))
72- let rand10 = nextRand(currRandsStr, drop(randHash, (lastOffset + 10)))
73- let rand11 = nextRand(currRandsStr, drop(randHash, (lastOffset + 11)))
74- let rand12 = nextRand(currRandsStr, drop(randHash, (lastOffset + 12)))
75- let rand13 = nextRand(currRandsStr, drop(randHash, (lastOffset + 13)))
76- let rand14 = nextRand(currRandsStr, drop(randHash, (lastOffset + 14)))
77- let unq1 = if ((rand1[1] != EMPTYSTRING))
78- then 1
79- else 0
80- let unq2 = if ((rand2[1] != EMPTYSTRING))
81- then 1
82- else 0
83- let unq3 = if ((rand3[1] != EMPTYSTRING))
84- then 1
85- else 0
86- let unq4 = if ((rand4[1] != EMPTYSTRING))
87- then 1
88- else 0
89- let unq5 = if ((rand5[1] != EMPTYSTRING))
90- then 1
91- else 0
92- let unq6 = if ((rand6[1] != EMPTYSTRING))
93- then 1
94- else 0
95- let unq7 = if ((rand7[1] != EMPTYSTRING))
96- then 1
97- else 0
98- let unq8 = if ((rand8[1] != EMPTYSTRING))
99- then 1
100- else 0
101- let unq9 = if ((rand9[1] != EMPTYSTRING))
102- then 1
103- else 0
104- let unq10 = if ((rand10[1] != EMPTYSTRING))
105- then 1
106- else 0
107- let unq11 = if ((rand11[1] != EMPTYSTRING))
108- then 1
109- else 0
110- let unq12 = if ((rand12[1] != EMPTYSTRING))
111- then 1
112- else 0
113- let unq13 = if ((rand13[1] != EMPTYSTRING))
114- then 1
115- else 0
116- let unq14 = if ((rand14[1] != EMPTYSTRING))
117- then 1
118- else 0
119- let unqCount = (((((((((((((unq1 + unq2) + unq3) + unq4) + unq5) + unq6) + unq7) + unq8) + unq9) + unq10) + unq11) + unq12) + unq13) + unq14)
120-[rand14[0], toString(unqCount)]
121- }
122-
123-
124-func validateDtxKey (sessionId,data,dataEntriesCount,iteration) = {
125- let sessionIdFromKey = take(data.key, SESSIONIDFIXSIZE)
126- if ((iteration >= dataEntriesCount))
127- then true
128- else if (if (if ((sessionId == sessionIdFromKey))
129- then (size(data.key) > SESSIONIDFIXSIZE)
130- else false)
131- then !(isDefined(getString(this, data.key)))
132- else false)
133- then match data.value {
134- case str: String =>
135- true
136- case _ =>
137- throw((sessionId + " draw: only String type is accepted for data transactions"))
138- }
139- else false
140- }
141-
142-
143-@Callable(i)
144-func initDraw (sessionId,randFrom,randTo,randsCount,uniqueOnly) = {
145- let base58Valid = (size(fromBase58String(sessionId)) > 0)
146- if ((size(sessionId) != SESSIONIDFIXSIZE))
147- then throw("Draw Id must be exactly 50 simbols")
148- else if (!(base58Valid))
149- then throw("Draw id must be in Base58 format")
150- else if (if ((0 >= randFrom))
151- then true
152- else (0 >= randTo))
153- then throw("randFrom and randTo must be greater than 0")
154- else if ((randFrom >= randTo))
155- then throw("randFrom must be strict less then randTo")
156- else if (if (uniqueOnly)
157- then (randsCount > ((randTo - randFrom) + 1))
158- else false)
159- then throw(((((("Impossible to generate " + toString(randsCount)) + " for provided random range - from ") + toString(randFrom)) + " to ") + toString(randTo)))
160- else {
161- let organizerPubKey58 = toBase58String(i.callerPublicKey)
162- let initState = formatStateDataStr(STATEINIT, organizerPubKey58, EMPTYSTRING)
163- ScriptResult(WriteSet([DataEntry(sessionId, initState)]), TransferSet([ScriptTransfer(SERVER, 1000, unit)]))
164- }
165- }
166-
167-
168-
169-@Callable(i)
170-func ready (sessionId) = {
171- let drawParamsList = extractGameDataList(sessionId)
172- let drawState = drawParamsList[0]
173- let organizerPubKey58 = drawParamsList[1]
174- let organizerPubKey = fromBase58String(organizerPubKey58)
175- if ((drawState != STATEINIT))
176- then throw((sessionId + " draw: moving into READY state is allowed only from INIT state"))
177- else if ((organizerPubKey != i.callerPublicKey))
178- then throw((sessionId + "draw: moving into READY state is allowed for organizer only"))
179- else {
180- let readyState = formatStateDataStr(DATADONE, organizerPubKey58, EMPTYSTRING)
181- WriteSet([DataEntry(sessionId, readyState)])
182- }
183- }
184-
185-
186-
187-@Callable(i)
188-func random (sessionId,rsaSign) = {
189- let from = 1
190- let to = 100
191- let drawParamsList = extractGameDataList(sessionId)
192- let drawState = drawParamsList[0]
193- let organizerPubKey58 = drawParamsList[1]
194- let organizerPubKey = fromBase58String(organizerPubKey58)
195- if ((drawState != DATADONE))
196- then throw((sessionId + " draw: it must be in READY state to generate random numbers"))
197- else if (!(rsaVerify(SHA256, toBytes(sessionId), rsaSign, RSAPUBLIC)))
198- then throw("Invalid RSA signature")
199- else {
200- let randGenInfo = generateRand(sessionId, from, to, rsaSign)
201- let rand = randGenInfo[0]
202- if ((rand != EMPTYSTRING))
203- then ScriptResult(WriteSet([DataEntry(sessionId, formatStateDataStr(STATEFINISHED, organizerPubKey58, "-1")), DataEntry((sessionId + "A"), randGenInfo[1])]), TransferSet([ScriptTransfer(SERVER, 1000, unit)]))
204- else ScriptResult(WriteSet([DataEntry(sessionId, formatStateDataStr(STATEFINISHED, organizerPubKey58, rand)), DataEntry((sessionId + "A"), randGenInfo[1])]), TransferSet([ScriptTransfer(SERVER, 1000, unit)]))
205- }
206- }
207-
208-
209-@Verifier(tx)
210-func verify () = match tx {
211- case dtx: DataTransaction =>
212- let data0 = dtx.data[0]
213- let sessionId = take(data0.key, SESSIONIDFIXSIZE)
214- let drawParamsList = extractGameDataList(sessionId)
215- let drawState = drawParamsList[0]
216- let organizerPubKey58 = drawParamsList[1]
217- let organizerPubKey = fromBase58String(organizerPubKey58)
218- let dataEntriesCount = size(dtx.data)
219- if (if (if (if (if (if (if (if (if ((drawState == STATEINIT))
220- then sigVerify(tx.bodyBytes, tx.proofs[0], organizerPubKey)
221- else false)
222- then (dataEntriesCount > 0)
223- else false)
224- then (5 >= dataEntriesCount)
225- else false)
226- then validateDtxKey(sessionId, data0, dataEntriesCount, 0)
227- else false)
228- then validateDtxKey(sessionId, dtx.data[1], dataEntriesCount, 1)
229- else false)
230- then validateDtxKey(sessionId, dtx.data[2], dataEntriesCount, 2)
231- else false)
232- then validateDtxKey(sessionId, dtx.data[3], dataEntriesCount, 3)
233- else false)
234- then validateDtxKey(sessionId, dtx.data[4], dataEntriesCount, 4)
235- else false)
236- then validateDtxKey(sessionId, dtx.data[5], dataEntriesCount, 5)
237- else false
238- case sstx: SetScriptTransaction =>
239- true
240- case ttx: TransferTransaction =>
241- true
242- case _ =>
243- false
244-}
245-
2+{-# CONTENT_TYPE EXPRESSION #-}
3+let PubKey1 = base58'854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa'
4+let PubKey2 = base58'DKGFPozLrsiR8NM4NJzqQaBYC8NyGYjuw2hDYicQVjco'
5+let sig1 = if (sigVerify(tx.bodyBytes, tx.proofs[0], PubKey1))
6+ then 1
7+ else 0
8+let sig2 = if (sigVerify(tx.bodyBytes, tx.proofs[1], PubKey2))
9+ then 1
10+ else 0
11+((sig1 + sig2) > 0)

github/deemru/w8io/169f3d6 
65.30 ms