﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">How to Solve the World Pi Day OKX Private Key Puzzle Award (with complete code)</title>
  <id>~/topic/25695/how-to-solve-the-world-pi-day-okx-private-key-puzzle-award-(with-complete-code)/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-04-12T00:25:38Z</updated>
  <logo>https://stocksharp.com/images/logo.png</logo>
  <link href="https://stocksharp.com/handlers/atom.ashx?category=topic&amp;id=25695" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.com/posts/m/80285/</id>
    <title type="text">I saw some Tycoons in the group saying that OKX was holding a World Pi Day Mystery Event, with the t...</title>
    <published>2024-04-16T09:22:15Z</published>
    <updated>2024-04-16T09:22:15Z</updated>
    <author>
      <name>FMZ</name>
      <uri>https://stocksharp.com/users/186354/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">I saw some Tycoons in the group saying that OKX was holding a World Pi Day Mystery Event, with the theme of &amp;quot;Exploration, Never Ending&amp;quot;.&lt;br /&gt;&lt;br /&gt;As a veteran programmer, when I saw the news, I smiled and opened my MacBook Pro, and without further ado, let&amp;#39;s get started!&lt;br /&gt;&lt;br /&gt;&amp;gt; Analysis&lt;br /&gt;&lt;br /&gt;Officially, there are 61 bits of key in the picture and the part of the circumference overlap, as we all know, the length of private key is 32 byte, converted to hex is 64 bits plus 0x prefix, a total of 66 bits, there are already 61 bits, for the first look, the &amp;quot;0X&amp;quot; at the first line in the chart is obviously not Pi, it is the start of the private key prefix, then there are about 5 bits (0123456789ABCDEF). The characters are arranged randomly, so there&amp;#39;s nothing wrong with running them directly, so let&amp;#39;s get started~&lt;br /&gt;&lt;br /&gt;Let&amp;#39;s use a Mac tool to sharpen the color simply:&lt;br /&gt;&lt;a href="https://stocksharp.com/file/150303
" title="https://stocksharp.com/file/150303
"&gt;https://stocksharp.com/file/150303
&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In this way, the Mac can recognize the characters on the picture automatically. Let&amp;#39;s copy them directly:&lt;br /&gt;```&lt;br /&gt;3.141592653589793230X1D64338&lt;br /&gt;А694502884197169399375105820&lt;br /&gt;974925E123078164062862089986&lt;br /&gt;28033DB034211706409914808651&lt;br /&gt;32823066470ED424609550582231&lt;br /&gt;8B3&lt;br /&gt;81284&lt;br /&gt;• Exploration, &lt;br /&gt;038&lt;br /&gt;Never Ending&lt;br /&gt;027&lt;br /&gt;493&lt;br /&gt;05%&lt;br /&gt;0128&lt;br /&gt;4756482337867831731712019091&lt;br /&gt;47D9E56692346034861045432664&lt;br /&gt;8213393607743749141273724587&lt;br /&gt;006606315588174881BEEA209628&lt;br /&gt;2925409192744436789259036001&lt;br /&gt;```&lt;br /&gt;It cannot be used directly. Let&amp;#39;s correct it manually. The unconfirmed ones covered by the picture are marked with *. Not sure. Let&amp;#39;s talk about it later.&lt;br /&gt;The others blocked by the figure can be judged by observing the stroke shape of other fonts. At this time, we use Python to calculate the difference between the two, and use &amp;#39;_&amp;#39; for the same ones and only showing the different ones.&lt;br /&gt;```&lt;br /&gt;img = &amp;#39;&amp;#39;&amp;#39;&lt;br /&gt;3.141592653589793230X1D64338&lt;br /&gt;A694502884197169399375105820&lt;br /&gt;974925E123078164062862089986&lt;br /&gt;28033DB034211706409914808651&lt;br /&gt;32823066470ED424609550582231&lt;br /&gt;8B32594081284811174502841027&lt;br /&gt;0193**2*D2299964462294895493&lt;br /&gt;0381960EFC8103F9365933446128&lt;br /&gt;4756482337867831731712019091&lt;br /&gt;47D9E56692346034861045432664&lt;br /&gt;82133936077A3749141273724587&lt;br /&gt;006606315588174881BEEA209628&lt;br /&gt;2925409192744436789259036001&lt;br /&gt;&amp;#39;&amp;#39;&amp;#39;&lt;br /&gt;# True Pi&lt;br /&gt;real=&amp;#39;&amp;#39;&amp;#39;&lt;br /&gt;3.14159265358979323846264338&lt;br /&gt;3279502884197169399375105820&lt;br /&gt;9749445923078164062862089986&lt;br /&gt;2803482534211706798214808651&lt;br /&gt;3282306647093844609550582231&lt;br /&gt;7253594081284811174502841027&lt;br /&gt;0193852110555964462294895493&lt;br /&gt;0381964428810975665933446128&lt;br /&gt;4756482337867831652712019091&lt;br /&gt;4564856692346034861045432664&lt;br /&gt;8213393607260249141273724587&lt;br /&gt;0066063155881748815209209628&lt;br /&gt;2925409171536436789259036001&lt;br /&gt;&amp;#39;&amp;#39;&amp;#39;&lt;br /&gt;&lt;br /&gt;items = img.strip().split(&amp;#39;\n&amp;#39;)&lt;br /&gt;diffStr = &amp;#39;&amp;#39;&lt;br /&gt;for pos, line in enumerate(real.strip().split(&amp;#39;\n&amp;#39;)):&lt;br /&gt;    for i, c in enumerate(line):&lt;br /&gt;        imgLine = list(items[pos])&lt;br /&gt;        if line[i] == imgLine[i]:&lt;br /&gt;            imgLine[i] = &amp;#39;_&amp;#39;&lt;br /&gt;        else:&lt;br /&gt;            diffStr += imgLine[i]&lt;br /&gt;        items[pos] = &amp;#39;&amp;#39;.join(imgLine)&lt;br /&gt;print(&amp;#39;\n&amp;#39;.join(items))&lt;br /&gt;print(diffStr, &amp;#39;Len:&amp;#39;, len(diffStr))&lt;br /&gt;```&lt;br /&gt;The implementation results are as follows:&lt;br /&gt;```&lt;br /&gt;___________________0X1D_____&lt;br /&gt;A694________________________&lt;br /&gt;____25E1____________________&lt;br /&gt;____3DB0________4099________&lt;br /&gt;___________ED42_____________&lt;br /&gt;8B32________________________&lt;br /&gt;____**_*D2299_______________&lt;br /&gt;______0EFC___3F93___________&lt;br /&gt;________________731_________&lt;br /&gt;_7D9E_______________________&lt;br /&gt;__________7A37______________&lt;br /&gt;__________________BEEA______&lt;br /&gt;________92744_______________&lt;br /&gt;0X1DA69425E13DB04099ED428B32***D22990EFC3F937317D9E7A37BEEA92744 Len: 64&lt;br /&gt;```&lt;br /&gt;There are three more, and there are just three uncertain ones. Try to remove them, because the other 61 bits are all right after exclusion, leaving only the most definite difference. Finally, the prefix is as follows:&lt;br /&gt;```&lt;br /&gt;0X1DA69425E13DB04099ED428B32D22990EFC3F937317D9E7A37BEEA92744&lt;br /&gt;```&lt;br /&gt;Next, we shall use Python and use force to crawl the balance on the OK chain. We can compare which private key has the balance. In fact, we can also select the public key with 314 USDT transfer first, which is faster. Seeing information on the official website said that we can check the balance directly if there is gas, the code is a little messy.&lt;br /&gt;```&lt;br /&gt;import sys&lt;br /&gt;import web3,time,logging&lt;br /&gt;from eth_account import Account&lt;br /&gt;from web3 import Web3&lt;br /&gt;logging.basicConfig(level=logging.INFO, format=&amp;#39;%(asctime)s %(message)s&amp;#39;)&lt;br /&gt;w3 = Web3(Web3.HTTPProvider(&amp;quot;https://exchainrpc.okex.org&amp;quot;))&lt;br /&gt;logging.info(w3.clientVersion)&lt;br /&gt;found = None&lt;br /&gt;&lt;br /&gt;def get_balance_gas(key):&lt;br /&gt;    global found&lt;br /&gt;    _counter += 1&lt;br /&gt;    address = Account.from_key(key).address&lt;br /&gt;    logging.info(&amp;#39;fetch address %s %s&amp;#39; % (found, address))&lt;br /&gt;    while True:&lt;br /&gt;        try:&lt;br /&gt;            balance = w3.eth.get_balance(address)&lt;br /&gt;            break&lt;br /&gt;        except:&lt;br /&gt;            logging.warning(traceback.format_exc())&lt;br /&gt;            time.sleep(1)&lt;br /&gt;            continue&lt;br /&gt;    if balance != 0:&lt;br /&gt;        found = key&lt;br /&gt;        raise BaseException(&amp;#39;Found balance: %s %s&amp;#39; % (address, balance))&lt;br /&gt;    return balance&lt;br /&gt;&lt;br /&gt;from concurrent.futures import ThreadPoolExecutor&lt;br /&gt;executor = ThreadPoolExecutor(max_workers=50)&lt;br /&gt;keys = []&lt;br /&gt;prefix = &amp;#39;1DA69425E13DB04099ED428B32D22990EFC3F937317D9E7A37BEEA92744&amp;#39;&lt;br /&gt;# It doesn&amp;#39;t matter how to optimize the algorithm. Run the secret key against the clock.&lt;br /&gt;ch = &amp;#39;0123456789ABCDEF&amp;#39;&lt;br /&gt;for a in range(0, 16):&lt;br /&gt;    for b in range(0, 16):&lt;br /&gt;        for c in range(0, 16):&lt;br /&gt;            for d in range(0, 16):&lt;br /&gt;                for e in range(0, 16):&lt;br /&gt;                    keys.append(&amp;quot;0x&amp;quot;+prefix+ch[a]+ch[b]+ch[c]+ch[d]+ch[e])&lt;br /&gt;print(&amp;#39;all keys:&amp;#39;, len(keys))&lt;br /&gt;tasks = [None for t in keys]&lt;br /&gt;for idx, key in enumerate(keys):&lt;br /&gt;    tasks[idx] = executor.submit(get_balance_gas, key)&lt;br /&gt;for t in tasks:&lt;br /&gt;    t.result()&lt;br /&gt;    &lt;br /&gt;```&lt;br /&gt;We can see that it takes 1048576 iterations, but it&amp;#39;s much faster with multi-threading, running it on one of my servers.&lt;br /&gt;```&lt;br /&gt;2023-03-15 00:20:19,491 exchain-v1.6.8.5&lt;br /&gt;all keys: 1048576&lt;br /&gt;2023-03-15 00:20:20,372 fetch address None 0xc20C41f06F2428a0FD84ef03Ec6960992F5f8016&lt;br /&gt;2023-03-15 00:20:20,473 fetch address None 0xcFa87ee54bc1c14c09a3AB3f41640bBab5C5480a&lt;br /&gt;2023-03-15 00:20:20,483 fetch address None 0x126E922652f8B276F231D0eCA94d98685a26a45D&lt;br /&gt;The following is omitted...&lt;br /&gt;```&lt;br /&gt;Anxious waiting~~~, bad news came, and there was no result before the strategy exited. All of them were displayed as None.&lt;br /&gt;&lt;br /&gt;&amp;gt; The path winds along mountain ridges&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t think so, I can&amp;#39;t figure it out, I started to look at the discussion on twitter, and I found that everyone and I arrived at the same steps, but the strange thing is that no one has said that the decryption is successful, and the official has not announced the correct first 61 bits, then a strange reply caught my attention, because there is a difference ```D2299``` in the middle, I am very sure, but he looks terribly confident.&lt;br /&gt;&lt;a href="https://stocksharp.com/file/150300
" title="https://stocksharp.com/file/150300
"&gt;https://stocksharp.com/file/150300
&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, he posted a 61-bit D2290. He also said that he had been checked carefully. It doesn&amp;#39;t matter. Take a chance. Anyway, it&amp;#39;s a waste of electricity.&lt;br /&gt;With the attitude of trying, I found a few other people who said that they had found 61-bit. They were all very confident.&lt;br /&gt;The prefixes found in the comments section are collected, with the code just traversed, the basic code has not changed, and it will not be pasted repeatedly.&lt;br /&gt;```&lt;br /&gt;prefixs =[&lt;br /&gt;&amp;#39;1DA69425E13DB04099ED428B3202290EFC3F9317317D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;&amp;#39;1DA69425E13DB04099ED428B32D2290EFC3F9373177D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;&amp;#39;1DA69425E13DB04099ED428B320D2290EFC3F937317D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;&amp;#39;1DA694255E3DB040990ED428B3208890EFC3F937317D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;&amp;#39;1DA69425E13DB04099ED428B3202299EFC3F9317317D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;&amp;#39;1DA69425E13DB01099ED428B3202290EFC3F9317317D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;&amp;#39;1DA69425E13DB04099ED428B32D2290EFC3F9317317D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;&amp;#39;1DA69425E13DB04099ED428B32D22990EFC3F937317D9E7A37BEEA92744&amp;#39;,&lt;br /&gt;]&lt;br /&gt;```&lt;br /&gt;In fact, there are more new messages later, one brother&amp;#39;s PI value is different from mine, it&amp;#39;s amazing!&lt;br /&gt;Let&amp;#39;s run with these first, I can&amp;#39;t believe my eyes, but it came out, it means that one of the prefixes above is correct, which is very unscientific, the private key is:&lt;br /&gt;```&lt;br /&gt;1DA69425E13DB04099ED428B32D2290EFC3F9373177D9E7A37BEEA92744C8155&lt;br /&gt;```&lt;br /&gt;Here is D229, but the picture is clearly D2299, and 731 is followed by 7, here is two, but actually, this is the correct 61 bits, how he calculated it himself is unknown, incredibly curious, but I do not doubt my own operation, I saw one of the comments said that the official customer service said Pi has another version, it was me who were ignorant, with what I have learned and the current human understanding of the universe understanding, the circumference of this irrational number can represent the infinity of the universe, its fractional part never repeats or terminates, you can interpret it as the UUID of the universe you are in, if there are other versions, probably from parallel worlds.&lt;br /&gt;&lt;br /&gt;&amp;gt; Web3 currency conversion code&lt;br /&gt;&lt;br /&gt;Finally, it&amp;#39;s the code to transfer the bonus away, for this time, I use the FMZ platform Web3 directly, set the chain address to OKC, the private key added to the exchange at random, and then two lines will be done, execute it in the debug tool mode directly.&lt;br /&gt;&lt;a href="https://stocksharp.com/file/150302
" title="https://stocksharp.com/file/150302
"&gt;https://stocksharp.com/file/150302
&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&amp;gt; Proof&lt;br /&gt;&lt;br /&gt;Address of the decrypted public key&lt;br /&gt;```&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; from eth_account import Account&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; Account.from_key(&amp;#39;0x1DA69425E13DB04099ED428B32D2290EFC3F9373177D9E7A37BEEA92744C8155&amp;#39;).address&lt;br /&gt;&amp;#39;0x0bd08825e05e540C9508961a32E58D14da47275A&amp;#39;&lt;br /&gt;```&lt;br /&gt;Check out the link: &lt;a target="_blank" rel="nofollow" href="https://stocksharp.com/away/?u=AQAAAAAAAAAX6jgKcm1O1gelyLxYvVdIbt9cn3p71T5OwEE4vsaq2PnkVSpqpu-oQhh8CumLz_gqis0OY5p8TC18yoMVoV04IYV7292ckz8vvWeoOH5AxVdgH8L1PV3WluBEmbWiD9o" title="https://www.okx.com/cn/explorer/okc/address/0x0bd08825e05e540c9508961a32e58d14da47275a
"&gt;https://www.okx.com/cn/e...508961a32e58d14da47275a
&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;TX after being led by me: &lt;a target="_blank" rel="nofollow" href="https://stocksharp.com/away/?u=AQAAAAAAAAAX6jgKcm1O1gelyLxYvVdIbt9cn3p71T5OwEE4vsaq2Kqar9GSI2Gwkni8-ofmoZZU_9RiTQLik4m-zCTbv7uPhaPJODeyf6PrqNPAS4PWWU4J8kGOKRqcaoAj9xkyOP9kVuIKijntLHM6yGTa5MP1" title="https://www.okx.com/cn/explorer/okc/tx/0x4211418b09571011417257201aaf10fc3c5d638809a9456eb5aba5fe8c5d4e2c
"&gt;https://www.okx.com/cn/e...9a9456eb5aba5fe8c5d4e2c
&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We can see that the recipient address is:&lt;br /&gt;```&lt;br /&gt;0x25f0a126be95f437ee71d7c4de725567c5f6c731&lt;br /&gt;```&lt;br /&gt;&lt;a href="https://stocksharp.com/file/150301
" title="https://stocksharp.com/file/150301
"&gt;https://stocksharp.com/file/150301
&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To prove that this address is mine, I used this recipient&amp;#39;s address to make a transfer to a black hole address.&lt;br /&gt;&lt;br /&gt;&lt;a target="_blank" rel="nofollow" href="https://stocksharp.com/away/?u=AQAAAAAAAAAX6jgKcm1O1gelyLxYvVdIbt9cn3p71T5OwEE4vsaq2JfecK_mM0ziqS3rtK4yva_XtlXA14ijburUf0nWLhR3qJFddj44qUGbM1_ScygDnGvHK4k4qLXI9TIXCHMts_rZyrv_YgKu5ngk_xERoaqZ" title="https://www.okx.com/cn/explorer/okc/tx/0xc32b5e299064456af3eb67c34a3b153f74a1bd18a31429052e3e3c5614bcdb6e
"&gt;https://www.okx.com/cn/e...31429052e3e3c5614bcdb6e
&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The black hole address is:&lt;br /&gt;```&lt;br /&gt;0x0000000000000000005757572e464d5a2e434f4d&lt;br /&gt;```&lt;br /&gt;This black hole address contains a URL decoded as:&lt;br /&gt;&lt;br /&gt;```&lt;br /&gt;~ % python -c &amp;#39;print(bytes.fromhex(&amp;quot;0000000000000000005757572e464d5a2e434f4d&amp;quot;))&amp;#39;&lt;br /&gt;b&amp;#39;\x00\x00\x00\x00\x00\x00\x00\x00\x00WWW.FMZ.COM&amp;#39;&lt;br /&gt;```&lt;br /&gt;&amp;gt; Postscript&lt;br /&gt;&lt;br /&gt;This is the end of the story, and in retrospect, I&amp;#39;m grateful for the knowledge I&amp;#39;ve accumulated over the years, otherwise I wouldn&amp;#39;t have been able to crack it so fast and I would have been beaten by others.&lt;br /&gt;I&amp;#39;m sure there was a mistake in the official diagram, but in any case, I was lucky enough to crack the answer before it was made public, and I hope OKX will be more rigorous next time they hold a similar activity.&lt;br /&gt;&lt;br /&gt;From: &lt;a target="_blank" rel="nofollow" href="https://stocksharp.com/away/?u=AQAAAAAAAAAezbpL9G-wNBo0jpp0vfUOQlbPNxIPafGj0KHUDS3Y66WhudhNiHGehLOUFMNcNd9N4Ud58G8AKhXly4dNcHYiX4uldZ3O2z_A6F-sMcnv_v1c_TmNSCoWn7z089Wavv2ECLpnqCVhbXE7tvbLFUAAqKT_9ccX06apS37JBhbiJw" title="https://blog.mathquant.com/2023/03/16/how-to-solve-the-world-pi-day-okx-private-key-puzzle-award-with-complete-code.html"&gt;https://blog.mathquant.c...-with-complete-code.html&lt;/a&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>