tx · 68D5CzJfgt6nZeNizbA9mWU9L4nvhL6oFDXcm6qxmFWD

3MpAi7C4NfVQs5Fkh4EMxoqpaUhfD5gxNJD:  -0.01400000 Waves

2019.08.28 13:53 [650960] smart account 3MpAi7C4NfVQs5Fkh4EMxoqpaUhfD5gxNJD > SELF 0.00000000 Waves

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