tx · 5LLYxBQjSzg8tCR3Lxa5thEfD9WxDeWmmET2BcZJGGJw

3NCV5EhSifEAkU6wJ21ao7Yfb5JstkX9Sit:  -0.01400000 Waves

2019.08.28 13:52 [650959] smart account 3NCV5EhSifEAkU6wJ21ao7Yfb5JstkX9Sit > SELF 0.00000000 Waves

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