tx · 6Z7e6LeD4QaAb5TiX2kPpRE8EuBAY6c7yJCsPwxPeH6b

3Muqj7roekDvvDCu7g1fXrCAR6vyj23cDEV:  -1.40000000 Waves

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

{ "type": 13, "id": "6Z7e6LeD4QaAb5TiX2kPpRE8EuBAY6c7yJCsPwxPeH6b", "fee": 140000000, "feeAssetId": null, "timestamp": 1566291009988, "version": 1, "sender": "3Muqj7roekDvvDCu7g1fXrCAR6vyj23cDEV", "senderPublicKey": "29zBpFcK3DCUxxyrzXr8kNrKexpiFC1Hrf35H2a6SCe7", "proofs": [ "4f2yVW9pckh5iPnjTmX3A4h3na5Rmagt9F1G8MjRjVVbeGGA4KSATnvgTiyPRos2uvJcM8476Cvsu9MPENnuaaN" ], "script": "base64:AwQAAAAHUHViS2V5MQEAAAAgaQxxSAhSITOlMYdvwKcfK7u/x0yzOg/68EH0ax0QlWUEAAAAB1B1YktleTIBAAAAILb58FcZXTIbjEshMW6ayDB2XcNop87YatlbtNE8j6N0BAAAAARzaWcxAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAB1B1YktleTEAAAAAAAAAAAEAAAAAAAAAAAAEAAAABHNpZzIDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAHUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAkAAGYAAAACCQAAZAAAAAIFAAAABHNpZzEFAAAABHNpZzIAAAAAAAAAAADO+UOI", "chainId": 84, "height": 639232, "spentComplexity": 0 } View: original | compacted Prev: 3hB4grovrS7M4JgobMhLgRJL5rvpFwW3L8jxRAScUbx7 Next: 2G2sQMDVx5xAM73Zy3AqLwmmzsLov7WTviTK1SE5xYpx 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 SESSIONIDFIXSIZE = 50
9-
10-let STATEINIT = "INIT"
11-
12-let STATEREADY = "READY"
13-
14-let STATEFINISHED = "FINISHED"
15-
16-func abs (val) = if ((0 > val))
17- then -(val)
18- else val
19-
20-
21-func formatStateDataParam (p) = {
22- let s = size(p)
23- if ((s == 0))
24- then throw("Parameter size must be greater then 0")
25- else if ((s > 99))
26- then throw("Parameter size must be less then 100")
27- else if ((10 > s))
28- then (("0" + toString(s)) + p)
29- else (toString(s) + p)
30- }
31-
32-
33-func formatStateDataStr (drawState,organizerPubKey58,randOrEmpty) = {
34- let fullStateStr = ((formatStateDataParam(drawState) + "_") + formatStateDataParam(organizerPubKey58))
35- if ((randOrEmpty == ""))
36- then fullStateStr
37- else ((fullStateStr + "_") + formatStateDataParam(randOrEmpty))
38- }
39-
40-
41-func removeUnderscoreIfPresent (remaining) = if ((size(remaining) > 0))
42- then drop(remaining, 1)
43- else remaining
44-
45-
46-func parseNextAttribute (remaining) = {
47- let s = size(remaining)
48- if ((s > 0))
49- then {
50- let nn = parseIntValue(take(remaining, 2))
51- let v = take(drop(remaining, 2), nn)
52- let tmpRemaining = drop(remaining, (nn + 2))
53- let remainingState = removeUnderscoreIfPresent(tmpRemaining)
54-[v, remainingState]
55- }
56- else throw("Empty string was passed into parseNextAttribute func")
57- }
58-
59-
60-func parseGameRawDataStr (rawStateStr) = {
61- let gameState = parseNextAttribute(rawStateStr)
62- let organizerPubKey58 = parseNextAttribute(gameState[1])
63- let randsOrEmpty = parseNextAttribute(organizerPubKey58[1])
64-[gameState[0], organizerPubKey58[0], organizerPubKey58[0], randsOrEmpty[0]]
65- }
66-
67-
68-func extractGameDataList (sessionId) = {
69- let rawDataStr = match getString(this, sessionId) {
70- case str: String =>
71- str
72- case _ =>
73- throw(("Couldn't find game by " + sessionId))
74- }
75- parseGameRawDataStr(rawDataStr)
76- }
77-
78-
79-func nextRand (currRandsVect,remainingHash) = {
80- let nextRandInt = abs(toInt(remainingHash))
81- let nextRandVect = toBytes(nextRandInt)
82- let s = (size(currRandsVect) / 8)
83- if ((0 == s))
84- then [nextRandVect, drop(remainingHash, 1)]
85- else {
86- let duplicate = if (if (if (if (if (if (if (if ((s >= 1))
87- then (take(currRandsVect, 8) == nextRandVect)
88- else false)
89- then true
90- else if ((s >= 2))
91- then (take(drop(currRandsVect, (1 * 8)), 8) == nextRandVect)
92- else false)
93- then true
94- else if ((s >= 3))
95- then (take(drop(currRandsVect, (2 * 8)), 8) == nextRandVect)
96- else false)
97- then true
98- else if ((s >= 4))
99- then (take(drop(currRandsVect, (3 * 8)), 8) == nextRandVect)
100- else false)
101- then true
102- else if ((s >= 5))
103- then (take(drop(currRandsVect, (4 * 8)), 8) == nextRandVect)
104- else false)
105- then true
106- else if ((s >= 6))
107- then (take(drop(currRandsVect, (5 * 8)), 8) == nextRandVect)
108- else false)
109- then true
110- else if ((s >= 7))
111- then (take(drop(currRandsVect, (6 * 8)), 8) == nextRandVect)
112- else false)
113- then true
114- else if ((s >= 8))
115- then (take(drop(currRandsVect, (7 * 8)), 8) == nextRandVect)
116- else false
117- if (duplicate)
118- then [currRandsVect, drop(remainingHash, 1)]
119- else [(currRandsVect + nextRandVect), drop(remainingHash, 1)]
120- }
121- }
122-
123-
124-func generateRandsVector (sessionId,from,to,rsaSign) = {
125- let emptyVec = toBytes("")
126- let randHash = sha256(rsaSign)
127- let nextInfo1 = nextRand(emptyVec, randHash)
128- let nextInfo2 = nextRand(nextInfo1[0], nextInfo1[1])
129- let nextInfo3 = nextRand(nextInfo2[0], nextInfo2[1])
130- let nextInfo4 = nextRand(nextInfo3[0], nextInfo3[1])
131- let nextInfo5 = nextRand(nextInfo4[0], nextInfo4[1])
132- let nextInfo6 = nextRand(nextInfo5[0], nextInfo5[1])
133- let nextInfo7 = nextRand(nextInfo6[0], nextInfo6[1])
134- let nextInfo8 = nextRand(nextInfo7[0], nextInfo7[1])
135-nextInfo8[0]
136- }
137-
138-
139-func validateDtxKey (sessionId,data,dataEntriesCount,iteration) = {
140- let sessionIdFromKey = take(data.key, SESSIONIDFIXSIZE)
141- if ((iteration >= dataEntriesCount))
142- then true
143- else if (if (if ((sessionId == sessionIdFromKey))
144- then (size(data.key) > SESSIONIDFIXSIZE)
145- else false)
146- then !(isDefined(getString(this, data.key)))
147- else false)
148- then match data.value {
149- case str: String =>
150- true
151- case _ =>
152- throw((sessionId + " draw: only String type is accepted for data transactions"))
153- }
154- else false
155- }
156-
157-
158-@Callable(i)
159-func initDraw (sessionId) = {
160- let base58Valid = (size(fromBase58String(sessionId)) > 0)
161- if ((size(sessionId) != SESSIONIDFIXSIZE))
162- then throw("Draw Id must be exactly 50 simbols")
163- else if (!(base58Valid))
164- then throw("Draw id must be in Base58 format")
165- else {
166- let organizerPubKey58 = toBase58String(i.callerPublicKey)
167- let initState = formatStateDataStr(STATEINIT, organizerPubKey58, "")
168- WriteSet([DataEntry(sessionId, initState)])
169- }
170- }
171-
172-
173-
174-@Callable(i)
175-func ready (sessionId) = {
176- let drawParamsList = extractGameDataList(sessionId)
177- let drawState = drawParamsList[0]
178- let organizerPubKey58 = drawParamsList[1]
179- let organizerPubKey = fromBase58String(organizerPubKey58)
180- if ((drawState != STATEINIT))
181- then throw((sessionId + " draw: moving into READY state is allowed only from INIT state"))
182- else if ((organizerPubKey != i.callerPublicKey))
183- then throw((sessionId + "draw: moving into READY state is allowed for organizer only"))
184- else {
185- let readyState = formatStateDataStr(STATEINIT, organizerPubKey58, "")
186- WriteSet([DataEntry(sessionId, readyState)])
187- }
188- }
189-
190-
191-
192-@Callable(i)
193-func random (sessionId,rsaSign) = {
194- let from = 1
195- let to = 100
196- let drawParamsList = extractGameDataList(sessionId)
197- let drawState = drawParamsList[0]
198- let organizerPubKey58 = drawParamsList[1]
199- let organizerPubKey = fromBase58String(organizerPubKey58)
200- if ((drawState != STATEREADY))
201- then throw((sessionId + " draw: it must be in READY state to generate random numbers"))
202- else if (!(rsaVerify(SHA256, toBytes(sessionId), rsaSign, RSAPUBLIC)))
203- then throw("Invalid RSA signature")
204- else {
205- let currVect = generateRandsVector(sessionId, from, to, rsaSign)
206- let s = size(currVect)
207- let rand1 = if ((s >= 1))
208- then toString(toInt(take(drop(currVect, 0), 8)))
209- else ""
210- let rand2 = if ((s >= 2))
211- then ((rand1 + "_") + toString(toInt(take(drop(currVect, (1 * 8)), 8))))
212- else rand1
213- let rand3 = if ((s >= 3))
214- then ((rand2 + "_") + toString(toInt(take(drop(currVect, (2 * 8)), 8))))
215- else rand2
216- let rand4 = if ((s >= 4))
217- then ((rand3 + "_") + toString(toInt(take(drop(currVect, (3 * 8)), 8))))
218- else rand3
219- let rand5 = if ((s >= 5))
220- then ((rand4 + "_") + toString(toInt(take(drop(currVect, (4 * 8)), 8))))
221- else rand4
222- let rand6 = if ((s >= 6))
223- then ((rand5 + "_") + toString(toInt(take(drop(currVect, (5 * 8)), 8))))
224- else rand5
225- let rand7 = if ((s >= 7))
226- then ((rand6 + "_") + toString(toInt(take(drop(currVect, (6 * 8)), 8))))
227- else rand6
228- let rand8 = if ((s >= 8))
229- then ((rand7 + "_") + toString(toInt(take(drop(currVect, (7 * 8)), 8))))
230- else rand7
231- WriteSet([DataEntry(sessionId, formatStateDataStr(STATEFINISHED, organizerPubKey58, rand8))])
232- }
233- }
234-
235-
236-@Verifier(tx)
237-func verify () = match tx {
238- case dtx: DataTransaction =>
239- let data0 = dtx.data[0]
240- let sessionId = take(data0.key, SESSIONIDFIXSIZE)
241- let drawParamsList = extractGameDataList(sessionId)
242- let drawState = drawParamsList[0]
243- let organizerPubKey58 = drawParamsList[1]
244- let organizerPubKey = fromBase58String(organizerPubKey58)
245- let dataEntriesCount = size(dtx.data)
246- if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((drawState == STATEINIT))
247- then sigVerify(tx.bodyBytes, tx.proofs[0], organizerPubKey)
248- else false)
249- then (dataEntriesCount > 0)
250- else false)
251- then (15 >= dataEntriesCount)
252- else false)
253- then validateDtxKey(sessionId, data0, dataEntriesCount, 0)
254- else false)
255- then validateDtxKey(sessionId, dtx.data[1], dataEntriesCount, 1)
256- else false)
257- then validateDtxKey(sessionId, dtx.data[2], dataEntriesCount, 2)
258- else false)
259- then validateDtxKey(sessionId, dtx.data[3], dataEntriesCount, 3)
260- else false)
261- then validateDtxKey(sessionId, dtx.data[4], dataEntriesCount, 4)
262- else false)
263- then validateDtxKey(sessionId, dtx.data[5], dataEntriesCount, 5)
264- else false)
265- then validateDtxKey(sessionId, dtx.data[6], dataEntriesCount, 6)
266- else false)
267- then validateDtxKey(sessionId, dtx.data[7], dataEntriesCount, 7)
268- else false)
269- then validateDtxKey(sessionId, dtx.data[8], dataEntriesCount, 8)
270- else false)
271- then validateDtxKey(sessionId, dtx.data[9], dataEntriesCount, 9)
272- else false)
273- then validateDtxKey(sessionId, dtx.data[10], dataEntriesCount, 10)
274- else false)
275- then validateDtxKey(sessionId, dtx.data[11], dataEntriesCount, 11)
276- else false)
277- then validateDtxKey(sessionId, dtx.data[12], dataEntriesCount, 12)
278- else false)
279- then validateDtxKey(sessionId, dtx.data[13], dataEntriesCount, 13)
280- else false)
281- then validateDtxKey(sessionId, dtx.data[14], dataEntriesCount, 14)
282- else false
283- case sstx: SetScriptTransaction =>
284- true
285- case _ =>
286- false
287-}
288-
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 
44.68 ms