FAQ
Home
Support Center
FAQ
Other Topics
Binance Terms of Use
Award Selection Rules based on TON Blockchain Hash Value

Award Selection Rules based on TON Blockchain Hash Value

2024-10-29 02:11
Disclaimer: Products and services referred in here may not be available in your region.

1. How to determine the winning sequence?

Binance will select a specific date during the event and use the last 9 digits of the last TON Blockchain block hash at 23:59 (UTC) on that date as the winning sequence.
For example:
If the last TON Blockchain block hash on the reward calculation day is: 0hVwGb09xU6rhZhs9JMHU29KuqYATsVwd+96R8X6wF4=
  • Binance will remove the alphabets to get: 009692996864
  • After that, we will take the last 9 digits as the winning sequence: 692996864

2. How to apply multiplicative hashing to a user's address?

Binance will use multiplicative hash formula (similar to Java’s `hashCode()`) “h = 31 * h + value[i]” to determine the winning user(s)’ wallet address.
Calculation:
1. Convert the string “0x22eEC85ba6a5cD97eAd4728eA1c69e1D9c6fa778” to lowercase to get “0x22eec85ba6a5cd97ead4728ea1c69e1d9c6fa778”, then calculate the hash code.
2. Each character’s value is determined by its ASCII code:
  • '0' has a value of 48;
  • 'x' has a value of 120;
  • '2' has a value of 50;
  • 'e' has a value of 101;
  • 'c' has a value of 99;
  • '8' has a value of 56;
  • '5' has a value of 53;
  • 'b' has a value of 98;
  • 'a' has a value of 97;
  • '6' has a value of 54;
  • 'd' has a value of 100;
  • '9' has a value of 57;
  • '7' has a value of 55.
3. Initialize the hash value: h = 0
4. Process the first character '0':
  • h = 31 * h + 48
  • h = 31 * 0 + 48
  • h = 48
5. Process the second character 'x':
  • h = 31 * h + 120
  • h = 31 * 48 + 120
  • h = 1608
6. Process the third character '2':
  • h = 31 * h + 50
  • h = 31 * 1608 + 50
  • h = 49898
7. Process the fourth character '2':
  • h = 31 * h + 50
  • h = 31 * 49898 + 50
  • h = 1546888
8. Process the fifth character 'e':
  • h = 31 * h + 101
  • h = 31 * 1546888 + 101
  • h = 47953629
9. Process the sixth character 'e':
  • h = 31 * h + 101
  • h = 31 * 47953629 + 101
  • h = 1486562610
10. Process the seventh character 'c':
  • h = 31 * h + 99
  • h = 31 * 1486562610 + 99
  • h = 46083441008
11. Simplified processing of the remaining characters
Continue processing the remaining characters following the steps outlined above, until all characters are processed. The final hash value, h, will be an integer.
12. To ensure the hash value is non-negative, we apply a bitwise and with “0x7fffffff”: “h & 0x7fffffff”.
13. Using this algorithm, the TON address hash value will be a number between 0 and 2147483647.

3. How to generate a user’s lottery sequence?

Each user's wallet address is converted to a hash value to calculate their lottery sequence:
[Winning Sequence - Address Hash] = User’s Lottery Sequence

4. How to determine winners?

Binance will sort each user's lottery sequence in ascending order and select a certain number of sequences as winners depending on the campaign rules.
In case of a tie (e.g., two or more users have the same lottery sequence), Binance will use the task completion time to determine users’ rankings. The earlier a user completes the task, the higher their ranking.
  • For addresses with a hash equal to or longer than 10 digits, the 10th digit is removed.
  • If the hash is under 10 digits, no changes are made.
After that, the absolute difference between users’ address hash and the winning sequence is calculated. Binance will sort each user's lottery sequence in ascending order, and the smaller lottery sequence(s) will win.
For example:
  • User A’s address hash has 10 digits (1023456780). After removing the 10th digit, their lottery sequence is 102345678.
  • User B’s address hash has 9 digits (201154321). No changes are needed to adjust their lottery sequence.
How to determine the winner:
  • Winning sequence = 692996864
  • User A's lottery result = |692996864 − 102345678| = 590651186
  • User B's lottery result = |692996864 − 201154321| = 491842543
Since 491842543 is smaller, User B wins.