tx · 2DnrS96vgKjqCWTEvLHL6QZTJSszcKZCZewozravCtif

3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi:  -0.01400000 Waves

2019.10.04 23:27 [705481] smart account 3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi > SELF 0.00000000 Waves

{ "type": 13, "id": "2DnrS96vgKjqCWTEvLHL6QZTJSszcKZCZewozravCtif", "fee": 1400000, "feeAssetId": null, "timestamp": 1570220992233, "version": 1, "sender": "3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi", "senderPublicKey": "BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH", "proofs": [ "2CBizQ7Anc2TaFZgbG5Gtoe43CfMhtXMYXKNDUmH4JfbsyHnWGrjY3Qqrw1KxNA5iST1Y86K5oUGF7Juq7Y5oQXq" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAA5vd25lclB1YmxpY0tleQEAAAAgnOTxzRGlQL/gVO1uf4r6ecWijHA9iBu9xK1V+iHbiGoAAAAADFJhbmRvbWl6ZUtleQkAAlkAAAABAgAAACxCWlQ1Znp2OFplSFZuOHhBR1pWWFpIVXZvQWtkUk5DYnRFdUJuM3BDdVhFSAAAAAAKZGVwbG95SW5mbwIAAAAkYWRkZWQgZGF0YSBmdW5jdGlvbmFsaXR5ICh0ZXN0cGhhc2UpAQAAAAtlbmNyeXB0RGF0YQAAAAIAAAAHbWVzc2FnZQAAAARwS2V5BAAAAAZvdXRwdXQCAAAAJHJzYVZlcmlmeShTaGEyNTYgLG1lc3NhZ2UscEtleSxwS2V5KQUAAAAGb3V0cHV0AQAAAAlzZXNzaW9uSWQAAAAABAAAAANnaWQJAASxAAAAAQkAAfcAAAABCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0BQAAAANnaWQBAAAACXJhbmRvbWl6ZQAAAAEAAAAHcnNhU2lnbgQAAAAGZ2FtZUlkCQEAAAAJc2Vzc2lvbklkAAAAA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mlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAALdG9rZW5BbW91bnQFAAAABWFzc2V0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAEElzc3VlVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABJSZWlzc3VlVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGBwaSclI=", "chainId": 84, "height": 705481, "spentComplexity": 0 } View: original | compacted Prev: CfvuBDr5qBpKmQPB6oWskCer12tFgsJTXmu9qGLLfs3r Next: 3Y61pD3A2KLV1vJA7MMu53hFE5xstD6iyNshVztvYg8e Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH'
55
6+let RandomizeKey = fromBase58String("BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH")
7+
68 let deployInfo = "added data functionality (testphase)"
79
8-func getData (dataKey) = {
9- let dataPackage = getStringValue(this, dataKey)
10- dataPackage
10+func encryptData (message,pKey) = {
11+ let output = "rsaVerify(Sha256 ,message,pKey,pKey)"
12+ output
1113 }
1214
1315
14-func randomizer (inv) = {
15- let lastPlay = match getBinary(this, "lastPlay") {
16- case s: ByteVector =>
17- s
18- case a: Unit =>
19- base58'2ee4oFDYriWJ9EMeR'
20- case _ =>
21- throw()
16+func sessionId () = {
17+ let gid = toInt(sha256(toBytes(lastBlock.height)))
18+ gid
2219 }
23- let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
24- sha256(rand)
20+
21+
22+func randomize (rsaSign) = {
23+ let gameId = sessionId()
24+ let rsaSigValid = sigVerify(toBytes(gameId), toBytes(rsaSign), RandomizeKey)
25+ if (rsaSigValid)
26+ then {
27+ let rand = (toInt(sha256(toBytes(rsaSign))) % 6)
28+ if ((0 > rand))
29+ then ((-1 * rand) + 1)
30+ else (rand + 1)
31+ }
32+ else throw("Invalid RSA signature")
2533 }
2634
2735
3442 func listBuilder (receiver,amount,txid) = {
3543 let compiledList = "placeholder"
3644 compiledList
45+ }
46+
47+
48+func getData (dataKey) = {
49+ let dataPackage = getStringValue(this, dataKey)
50+ dataPackage
3751 }
3852
3953
5266 else if ((paid.amount == 400000000))
5367 then "L"
5468 else "error"
55- let messageData = ((((((toBase58String(extract(i.callerPublicKey)) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + sizing)
69+ let messageData = ((((((((toBase58String(extract(i.callerPublicKey)) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + toString(randomize(toString(sessionId())))) + ";") + sizing)
5670 if ((sizing == "error"))
5771 then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract")
5872 else {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerPublicKey = base58'BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH'
55
6+let RandomizeKey = fromBase58String("BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH")
7+
68 let deployInfo = "added data functionality (testphase)"
79
8-func getData (dataKey) = {
9- let dataPackage = getStringValue(this, dataKey)
10- dataPackage
10+func encryptData (message,pKey) = {
11+ let output = "rsaVerify(Sha256 ,message,pKey,pKey)"
12+ output
1113 }
1214
1315
14-func randomizer (inv) = {
15- let lastPlay = match getBinary(this, "lastPlay") {
16- case s: ByteVector =>
17- s
18- case a: Unit =>
19- base58'2ee4oFDYriWJ9EMeR'
20- case _ =>
21- throw()
16+func sessionId () = {
17+ let gid = toInt(sha256(toBytes(lastBlock.height)))
18+ gid
2219 }
23- let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
24- sha256(rand)
20+
21+
22+func randomize (rsaSign) = {
23+ let gameId = sessionId()
24+ let rsaSigValid = sigVerify(toBytes(gameId), toBytes(rsaSign), RandomizeKey)
25+ if (rsaSigValid)
26+ then {
27+ let rand = (toInt(sha256(toBytes(rsaSign))) % 6)
28+ if ((0 > rand))
29+ then ((-1 * rand) + 1)
30+ else (rand + 1)
31+ }
32+ else throw("Invalid RSA signature")
2533 }
2634
2735
2836 func listParser (dataString,separator) = {
2937 let choppedlist = "x"
3038 choppedlist
3139 }
3240
3341
3442 func listBuilder (receiver,amount,txid) = {
3543 let compiledList = "placeholder"
3644 compiledList
45+ }
46+
47+
48+func getData (dataKey) = {
49+ let dataPackage = getStringValue(this, dataKey)
50+ dataPackage
3751 }
3852
3953
4054 @Callable(i)
4155 func dispense () = {
4256 let paid = extract(i.payment)
4357 let message = "default message for now"
4458 let callerAccount = toBase58String(extract(i.callerPublicKey))
4559 let callerAddress = toBase58String(extract(i.caller.bytes))
4660 let callerTxId = i.transactionId
4761 let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m'
4862 let sizing = if ((paid.amount == 100000000))
4963 then "S"
5064 else if ((paid.amount == 200000000))
5165 then "M"
5266 else if ((paid.amount == 400000000))
5367 then "L"
5468 else "error"
55- let messageData = ((((((toBase58String(extract(i.callerPublicKey)) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + sizing)
69+ let messageData = ((((((((toBase58String(extract(i.callerPublicKey)) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + toString(randomize(toString(sessionId())))) + ";") + sizing)
5670 if ((sizing == "error"))
5771 then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract")
5872 else {
5973 let tokenAmount = (paid.amount * 3)
6074 ScriptResult(WriteSet([DataEntry(callerAccount, messageData)]), TransferSet([ScriptTransfer(i.caller, tokenAmount, asset)]))
6175 }
6276 }
6377
6478
6579 @Verifier(tx)
6680 func verify () = match tx {
6781 case d: SetScriptTransaction =>
6882 sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey)
6983 case d: DataTransaction =>
7084 true
7185 case d: TransferTransaction =>
7286 true
7387 case d: IssueTransaction =>
7488 true
7589 case d: ReissueTransaction =>
7690 true
7791 case _ =>
7892 false
7993 }
8094

github/deemru/w8io/169f3d6 
30.68 ms