tx · HW7EKj5tzwSfhQxFx6SjcCjWwmcXz6Fd2aYug8gUnRuE

3NBEJLX6pD1tgWtK98RMfi6BdBWiWU5aZ9C:  -1.40000000 Waves

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

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