tx · 7j19M9bF1pkG6zz5xihwnD9KGozLgyGb85rz732D8muX

3N15nAdj9qrHvDH1DgLbmepCntjN99so5jc:  -0.01400000 Waves

2019.08.28 12:59 [650904] smart account 3N15nAdj9qrHvDH1DgLbmepCntjN99so5jc > SELF 0.00000000 Waves

{ "type": 13, "id": "7j19M9bF1pkG6zz5xihwnD9KGozLgyGb85rz732D8muX", "fee": 1400000, "feeAssetId": null, "timestamp": 1566986368367, "version": 1, "sender": "3N15nAdj9qrHvDH1DgLbmepCntjN99so5jc", "senderPublicKey": "D68JmfUWTpU1LBah5jzrSJyBnewyue1stMqKSEFAq8po", "proofs": [ "22sqSDaUwddKKQZUtQexqnzxVUmPC6F14Nq4JyQFpMKk2QvkhMPyVXAEriuBptkVhGEjRmU7iTDT3uWhQLvRf7kg" ], "script": "base64:AwQAAAAHUHViS2V5MQEAAAAgaQxxSAhSITOlMYdvwKcfK7u/x0yzOg/68EH0ax0QlWUEAAAAB1B1YktleTIBAAAAILb58FcZXTIbjEshMW6ayDB2XcNop87YatlbtNE8j6N0BAAAAARzaWcxAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAB1B1YktleTEAAAAAAAAAAAEAAAAAAAAAAAAEAAAABHNpZzIDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAHUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAkAAGYAAAACCQAAZAAAAAIFAAAABHNpZzEFAAAABHNpZzIAAAAAAAAAAADO+UOI", "chainId": 84, "height": 650904, "spentComplexity": 0 } View: original | compacted Prev: 5J8S3pu2XeqHcGPjTxR4sY7P7TCgBQviM4FPbLrPWbqW Next: 6ERjmeP5WCn8pwvEQetpSCH9FbJSg4ugGViiuZHBLfsC 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 rand15 = nextRand(currRandsStr, drop(randHash, (lastOffset + 15)))
78- let unq1 = if ((rand1[1] != EMPTYSTRING))
79- then 1
80- else 0
81- let unq2 = if ((rand2[1] != EMPTYSTRING))
82- then 1
83- else 0
84- let unq3 = if ((rand3[1] != EMPTYSTRING))
85- then 1
86- else 0
87- let unq4 = if ((rand4[1] != EMPTYSTRING))
88- then 1
89- else 0
90- let unq5 = if ((rand5[1] != EMPTYSTRING))
91- then 1
92- else 0
93- let unq6 = if ((rand6[1] != EMPTYSTRING))
94- then 1
95- else 0
96- let unq7 = if ((rand7[1] != EMPTYSTRING))
97- then 1
98- else 0
99- let unq8 = if ((rand8[1] != EMPTYSTRING))
100- then 1
101- else 0
102- let unq9 = if ((rand9[1] != EMPTYSTRING))
103- then 1
104- else 0
105- let unq10 = if ((rand10[1] != EMPTYSTRING))
106- then 1
107- else 0
108- let unq11 = if ((rand11[1] != EMPTYSTRING))
109- then 1
110- else 0
111- let unq12 = if ((rand12[1] != EMPTYSTRING))
112- then 1
113- else 0
114- let unq13 = if ((rand13[1] != EMPTYSTRING))
115- then 1
116- else 0
117- let unq14 = if ((rand14[1] != EMPTYSTRING))
118- then 1
119- else 0
120- let unq15 = if ((rand15[1] != EMPTYSTRING))
121- then 1
122- else 0
123- let unqCount = ((((((((((((((unq1 + unq2) + unq3) + unq4) + unq5) + unq6) + unq7) + unq8) + unq9) + unq10) + unq11) + unq12) + unq13) + unq14) + unq15)
124-[rand15[0], toString(unqCount)]
125- }
126-
127-
128-func validateDtxKey (sessionId,data,dataEntriesCount,iteration) = {
129- let sessionIdFromKey = take(data.key, SESSIONIDFIXSIZE)
130- if ((iteration >= dataEntriesCount))
131- then true
132- else if (if (if ((sessionId == sessionIdFromKey))
133- then (size(data.key) > SESSIONIDFIXSIZE)
134- else false)
135- then !(isDefined(getString(this, data.key)))
136- else false)
137- then match data.value {
138- case str: String =>
139- true
140- case _ =>
141- throw((sessionId + " draw: only String type is accepted for data transactions"))
142- }
143- else false
144- }
145-
146-
147-@Callable(i)
148-func initDraw (sessionId,randFrom,randTo,randsCount,uniqueOnly) = {
149- let base58Valid = (size(fromBase58String(sessionId)) > 0)
150- if ((size(sessionId) != SESSIONIDFIXSIZE))
151- then throw("Draw Id must be exactly 50 simbols")
152- else if (!(base58Valid))
153- then throw("Draw id must be in Base58 format")
154- else if (if ((0 >= randFrom))
155- then true
156- else (0 >= randTo))
157- then throw("randFrom and randTo must be greater than 0")
158- else if ((randFrom >= randTo))
159- then throw("randFrom must be strict less then randTo")
160- else if (if (uniqueOnly)
161- then (randsCount > ((randTo - randFrom) + 1))
162- else false)
163- then throw(((((("Impossible to generate " + toString(randsCount)) + " for provided random range - from ") + toString(randFrom)) + " to ") + toString(randTo)))
164- else {
165- let organizerPubKey58 = toBase58String(i.callerPublicKey)
166- let initState = formatStateDataStr(STATEINIT, organizerPubKey58, EMPTYSTRING)
167- ScriptResult(WriteSet([DataEntry(sessionId, initState)]), TransferSet([ScriptTransfer(SERVER, 1000, unit)]))
168- }
169- }
170-
171-
172-
173-@Callable(i)
174-func ready (sessionId) = {
175- let drawParamsList = extractGameDataList(sessionId)
176- let drawState = drawParamsList[0]
177- let organizerPubKey58 = drawParamsList[1]
178- let organizerPubKey = fromBase58String(organizerPubKey58)
179- if ((drawState != STATEINIT))
180- then throw((sessionId + " draw: moving into READY state is allowed only from INIT state"))
181- else if ((organizerPubKey != i.callerPublicKey))
182- then throw((sessionId + "draw: moving into READY state is allowed for organizer only"))
183- else {
184- let readyState = formatStateDataStr(DATADONE, organizerPubKey58, EMPTYSTRING)
185- WriteSet([DataEntry(sessionId, readyState)])
186- }
187- }
188-
189-
190-
191-@Callable(i)
192-func random (sessionId,rsaSign) = {
193- let from = 1
194- let to = 100
195- let drawParamsList = extractGameDataList(sessionId)
196- let drawState = drawParamsList[0]
197- let organizerPubKey58 = drawParamsList[1]
198- let organizerPubKey = fromBase58String(organizerPubKey58)
199- if ((drawState != DATADONE))
200- then throw((sessionId + " draw: it must be in READY state to generate random numbers"))
201- else if (!(rsaVerify(SHA256, toBytes(sessionId), rsaSign, RSAPUBLIC)))
202- then throw("Invalid RSA signature")
203- else {
204- let randGenInfo = generateRand(sessionId, from, to, rsaSign)
205- let rand = randGenInfo[0]
206- if ((rand != EMPTYSTRING))
207- then ScriptResult(WriteSet([DataEntry(sessionId, formatStateDataStr(STATEFINISHED, organizerPubKey58, "-1")), DataEntry((sessionId + "A"), randGenInfo[1])]), TransferSet([ScriptTransfer(SERVER, 1000, unit)]))
208- else ScriptResult(WriteSet([DataEntry(sessionId, formatStateDataStr(STATEFINISHED, organizerPubKey58, rand)), DataEntry((sessionId + "A"), randGenInfo[1])]), TransferSet([ScriptTransfer(SERVER, 1000, unit)]))
209- }
210- }
211-
212-
213-@Verifier(tx)
214-func verify () = match tx {
215- case dtx: DataTransaction =>
216- let data0 = dtx.data[0]
217- let sessionId = take(data0.key, SESSIONIDFIXSIZE)
218- let drawParamsList = extractGameDataList(sessionId)
219- let drawState = drawParamsList[0]
220- let organizerPubKey58 = drawParamsList[1]
221- let organizerPubKey = fromBase58String(organizerPubKey58)
222- let dataEntriesCount = size(dtx.data)
223- if (if (if (if (if (if (if (if (if ((drawState == STATEINIT))
224- then sigVerify(tx.bodyBytes, tx.proofs[0], organizerPubKey)
225- else false)
226- then (dataEntriesCount > 0)
227- else false)
228- then (5 >= dataEntriesCount)
229- else false)
230- then validateDtxKey(sessionId, data0, dataEntriesCount, 0)
231- else false)
232- then validateDtxKey(sessionId, dtx.data[1], dataEntriesCount, 1)
233- else false)
234- then validateDtxKey(sessionId, dtx.data[2], dataEntriesCount, 2)
235- else false)
236- then validateDtxKey(sessionId, dtx.data[3], dataEntriesCount, 3)
237- else false)
238- then validateDtxKey(sessionId, dtx.data[4], dataEntriesCount, 4)
239- else false)
240- then validateDtxKey(sessionId, dtx.data[5], dataEntriesCount, 5)
241- else false
242- case sstx: SetScriptTransaction =>
243- true
244- case ttx: TransferTransaction =>
245- true
246- case _ =>
247- false
248-}
249-
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/3ef1775 
51.04 ms