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+iHbiGoAAAAADFJhbmRvbWl6ZUtleQkAAlkAAAABAgAAACxCWlQ1Znp2OFplSFZuOHhBR1pWWFpIVXZvQWtkUk5DYnRFdUJuM3BDdVhFSAAAAAAKZGVwbG95SW5mbwIAAAAkYWRkZWQgZGF0YSBmdW5jdGlvbmFsaXR5ICh0ZXN0cGhhc2UpAQAAAAtlbmNyeXB0RGF0YQAAAAIAAAAHbWVzc2FnZQAAAARwS2V5BAAAAAZvdXRwdXQCAAAAJHJzYVZlcmlmeShTaGEyNTYgLG1lc3NhZ2UscEtleSxwS2V5KQUAAAAGb3V0cHV0AQAAAAlzZXNzaW9uSWQAAAAABAAAAANnaWQJAASxAAAAAQkAAfcAAAABCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0BQAAAANnaWQBAAAACXJhbmRvbWl6ZQAAAAEAAAAHcnNhU2lnbgQAAAAGZ2FtZUlkCQEAAAAJc2Vzc2lv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YQUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAALdG9rZW5BbW91bnQFAAAABWFzc2V0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAEElzc3VlVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABJSZWlzc3VlVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGBwaSclI=",
"chainId": 84,
"height": 705481,
"spentComplexity": 0
}
View: original | compacted
Prev: CfvuBDr5qBpKmQPB6oWskCer12tFgsJTXmu9qGLLfs3r
Next: 3Y61pD3A2KLV1vJA7MMu53hFE5xstD6iyNshVztvYg8e
Diff:
Old | New | | Differences |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let ownerPublicKey = base58'BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH' |
---|
5 | 5 | | |
---|
| 6 | + | let RandomizeKey = fromBase58String("BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH") |
---|
| 7 | + | |
---|
6 | 8 | | let deployInfo = "added data functionality (testphase)" |
---|
7 | 9 | | |
---|
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 |
---|
11 | 13 | | } |
---|
12 | 14 | | |
---|
13 | 15 | | |
---|
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 |
---|
22 | 19 | | } |
---|
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") |
---|
25 | 33 | | } |
---|
26 | 34 | | |
---|
27 | 35 | | |
---|
|
34 | 42 | | func listBuilder (receiver,amount,txid) = { |
---|
35 | 43 | | let compiledList = "placeholder" |
---|
36 | 44 | | compiledList |
---|
| 45 | + | } |
---|
| 46 | + | |
---|
| 47 | + | |
---|
| 48 | + | func getData (dataKey) = { |
---|
| 49 | + | let dataPackage = getStringValue(this, dataKey) |
---|
| 50 | + | dataPackage |
---|
37 | 51 | | } |
---|
38 | 52 | | |
---|
39 | 53 | | |
---|
|
52 | 66 | | else if ((paid.amount == 400000000)) |
---|
53 | 67 | | then "L" |
---|
54 | 68 | | 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) |
---|
56 | 70 | | if ((sizing == "error")) |
---|
57 | 71 | | then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract") |
---|
58 | 72 | | else { |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let ownerPublicKey = base58'BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH' |
---|
5 | 5 | | |
---|
| 6 | + | let RandomizeKey = fromBase58String("BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH") |
---|
| 7 | + | |
---|
6 | 8 | | let deployInfo = "added data functionality (testphase)" |
---|
7 | 9 | | |
---|
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 |
---|
11 | 13 | | } |
---|
12 | 14 | | |
---|
13 | 15 | | |
---|
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 |
---|
22 | 19 | | } |
---|
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") |
---|
25 | 33 | | } |
---|
26 | 34 | | |
---|
27 | 35 | | |
---|
28 | 36 | | func listParser (dataString,separator) = { |
---|
29 | 37 | | let choppedlist = "x" |
---|
30 | 38 | | choppedlist |
---|
31 | 39 | | } |
---|
32 | 40 | | |
---|
33 | 41 | | |
---|
34 | 42 | | func listBuilder (receiver,amount,txid) = { |
---|
35 | 43 | | let compiledList = "placeholder" |
---|
36 | 44 | | compiledList |
---|
| 45 | + | } |
---|
| 46 | + | |
---|
| 47 | + | |
---|
| 48 | + | func getData (dataKey) = { |
---|
| 49 | + | let dataPackage = getStringValue(this, dataKey) |
---|
| 50 | + | dataPackage |
---|
37 | 51 | | } |
---|
38 | 52 | | |
---|
39 | 53 | | |
---|
40 | 54 | | @Callable(i) |
---|
41 | 55 | | func dispense () = { |
---|
42 | 56 | | let paid = extract(i.payment) |
---|
43 | 57 | | let message = "default message for now" |
---|
44 | 58 | | let callerAccount = toBase58String(extract(i.callerPublicKey)) |
---|
45 | 59 | | let callerAddress = toBase58String(extract(i.caller.bytes)) |
---|
46 | 60 | | let callerTxId = i.transactionId |
---|
47 | 61 | | let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m' |
---|
48 | 62 | | let sizing = if ((paid.amount == 100000000)) |
---|
49 | 63 | | then "S" |
---|
50 | 64 | | else if ((paid.amount == 200000000)) |
---|
51 | 65 | | then "M" |
---|
52 | 66 | | else if ((paid.amount == 400000000)) |
---|
53 | 67 | | then "L" |
---|
54 | 68 | | 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) |
---|
56 | 70 | | if ((sizing == "error")) |
---|
57 | 71 | | then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract") |
---|
58 | 72 | | else { |
---|
59 | 73 | | let tokenAmount = (paid.amount * 3) |
---|
60 | 74 | | ScriptResult(WriteSet([DataEntry(callerAccount, messageData)]), TransferSet([ScriptTransfer(i.caller, tokenAmount, asset)])) |
---|
61 | 75 | | } |
---|
62 | 76 | | } |
---|
63 | 77 | | |
---|
64 | 78 | | |
---|
65 | 79 | | @Verifier(tx) |
---|
66 | 80 | | func verify () = match tx { |
---|
67 | 81 | | case d: SetScriptTransaction => |
---|
68 | 82 | | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) |
---|
69 | 83 | | case d: DataTransaction => |
---|
70 | 84 | | true |
---|
71 | 85 | | case d: TransferTransaction => |
---|
72 | 86 | | true |
---|
73 | 87 | | case d: IssueTransaction => |
---|
74 | 88 | | true |
---|
75 | 89 | | case d: ReissueTransaction => |
---|
76 | 90 | | true |
---|
77 | 91 | | case _ => |
---|
78 | 92 | | false |
---|
79 | 93 | | } |
---|
80 | 94 | | |
---|