tx · 13oCjiTfUYR3nDXPGe4qEhz5NF9HqsxwtqW92u8CUgG6 3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ: -0.01000000 Waves 2023.05.31 00:41 [2601263] smart account 3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ > SELF 0.00000000 Waves
{ "type": 13, "id": "13oCjiTfUYR3nDXPGe4qEhz5NF9HqsxwtqW92u8CUgG6", "fee": 1000000, "feeAssetId": null, "timestamp": 1685482905050, "version": 2, "chainId": 84, "sender": "3N8GKGgDPGGUaAhPMNtsxTJWafHDRnwL7GQ", "senderPublicKey": "y5twTW93XMmi75S5bati2cok9QLLFivsrwJedxJeUkX", "proofs": [ "26fPynnr8Mjrf5K9twx1oCq1RDNR4eheYjLg9YNHgsUox7diZK2ntW1XuWKw6VYTfbYWcAZ1ExaNBZn2q74MQZi7" ], "script": "base64:BgIECAISAAQBD2dldFJhbmRvbU51bWJlcgAED3JhbmRvbVNlZWRCbG9jawkBBXZhbHVlAQkA7QcBCQBlAgUGaGVpZ2h0AAEECnJhbmRvbUhhc2gJANQWAQkBBXZhbHVlAQgFD3JhbmRvbVNlZWRCbG9jawN2cmYEA3N0cgkA2AQBBQpyYW5kb21IYXNoBAhsYXN0Q2hhcgkAsgICBQNzdHIAAgUIbGFzdENoYXIBEGdldFJhbmRvbU51bWJlcjIABA9yYW5kb21TZWVkQmxvY2sJAQV2YWx1ZQEJAO0HAQkAZQIFBmhlaWdodAABBApyYW5kb21IYXNoCQDUFgEJAQV2YWx1ZQEIBQ9yYW5kb21TZWVkQmxvY2sDdnJmCQCyAgIJAKQDAQkAsQkBBQpyYW5kb21IYXNoAAEBEGdldFJhbmRvbU51bWJlcjMABA9yYW5kb21TZWVkQmxvY2sJAQV2YWx1ZQEJAO0HAQkAZQIFBmhlaWdodAABBApyYW5kb21IYXNoCQDUFgEJAQV2YWx1ZQEIBQ9yYW5kb21TZWVkQmxvY2sDdnJmCQCkAwEJALEJAQUKcmFuZG9tSGFzaAEQZ2V0UmFuZG9tTnVtYmVyNAEBaQQKcmFuZG9tU2VlZAkAsQkBCQD1AwEIBQFpDXRyYW5zYWN0aW9uSWQEDHJhbmRvbU51bWJlcgkAZAIJAGoCBQpyYW5kb21TZWVkCQBkAgkAZQIA5wcA5wcAAQDnBwQPcmFuZG9tU2VlZEJsb2NrCQEFdmFsdWUBCQDtBwEJAGUCBQZoZWlnaHQFDHJhbmRvbU51bWJlcgQKcmFuZG9tSGFzaAkA1BYBCQEFdmFsdWUBCAUPcmFuZG9tU2VlZEJsb2NrA3ZyZgkApAMBCQCxCQEFCnJhbmRvbUhhc2gBAWkBBXRlc3Q3AAQHYWRkcmVzcwkA2AQBCAgFAWkGY2FsbGVyBWJ5dGVzBAFyCQEPZ2V0UmFuZG9tTnVtYmVyAAQCcjIJARBnZXRSYW5kb21OdW1iZXIyAAQCcjMJARBnZXRSYW5kb21OdW1iZXIzAAkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQICA1hYWAUBcgkAzAgCCQELU3RyaW5nRW50cnkCAgRYWFgyBQJyMgkAzAgCCQELU3RyaW5nRW50cnkCAgRYWFgzBQJyMwUDbmlsAAEA+ZiUDw==", "height": 2601263, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CzeQdqxeCqL9fh64rYqXf8kP9uSew4pfnAefF145x52 Next: 413QbaB38s6QNNH4LCLm6VvtLpX9sTaP68nsJQEeshKT Diff:
Old | New | Differences | |
---|---|---|---|
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | + | func getRandomNumber4 (i) = { | |
28 | + | let randomSeed = toInt(keccak256(i.transactionId)) | |
29 | + | let randomNumber = ((randomSeed % ((999 - 999) + 1)) + 999) | |
30 | + | let randomSeedBlock = value(blockInfoByHeight((height - randomNumber))) | |
31 | + | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
32 | + | toString(toInt(randomHash)) | |
33 | + | } | |
34 | + | ||
35 | + | ||
27 | 36 | @Callable(i) | |
28 | 37 | func test7 () = { | |
29 | 38 | let address = toBase58String(i.caller.bytes) | |
30 | 39 | let r = getRandomNumber() | |
31 | 40 | let r2 = getRandomNumber2() | |
32 | - | $Tuple2([StringEntry("XXX", r), StringEntry("XXX2", r2)], 1) | |
41 | + | let r3 = getRandomNumber3() | |
42 | + | $Tuple2([StringEntry("XXX", r), StringEntry("XXX2", r2), StringEntry("XXX3", r3)], 1) | |
33 | 43 | } | |
34 | 44 | ||
35 | 45 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getRandomNumber () = { | |
5 | 5 | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
6 | 6 | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
7 | 7 | let str = toBase58String(randomHash) | |
8 | 8 | let lastChar = takeRight(str, 2) | |
9 | 9 | lastChar | |
10 | 10 | } | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func getRandomNumber2 () = { | |
14 | 14 | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
15 | 15 | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
16 | 16 | takeRight(toString(toInt(randomHash)), 1) | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getRandomNumber3 () = { | |
21 | 21 | let randomSeedBlock = value(blockInfoByHeight((height - 1))) | |
22 | 22 | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
23 | 23 | toString(toInt(randomHash)) | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | + | func getRandomNumber4 (i) = { | |
28 | + | let randomSeed = toInt(keccak256(i.transactionId)) | |
29 | + | let randomNumber = ((randomSeed % ((999 - 999) + 1)) + 999) | |
30 | + | let randomSeedBlock = value(blockInfoByHeight((height - randomNumber))) | |
31 | + | let randomHash = sha256_16Kb(value(randomSeedBlock.vrf)) | |
32 | + | toString(toInt(randomHash)) | |
33 | + | } | |
34 | + | ||
35 | + | ||
27 | 36 | @Callable(i) | |
28 | 37 | func test7 () = { | |
29 | 38 | let address = toBase58String(i.caller.bytes) | |
30 | 39 | let r = getRandomNumber() | |
31 | 40 | let r2 = getRandomNumber2() | |
32 | - | $Tuple2([StringEntry("XXX", r), StringEntry("XXX2", r2)], 1) | |
41 | + | let r3 = getRandomNumber3() | |
42 | + | $Tuple2([StringEntry("XXX", r), StringEntry("XXX2", r2), StringEntry("XXX3", r3)], 1) | |
33 | 43 | } | |
34 | 44 | ||
35 | 45 |
github/deemru/w8io/169f3d6 38.79 ms ◑