Bitcoin Forum
May 07, 2024, 03:00:03 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 3 »
1  Bitcoin / Development & Technical Discussion / c++ problem on: February 27, 2023, 12:56:56 PM
Code:
#include <cstdint>
#include <iostream>
#include <cuda_runtime.h>
#include <iomanip>
#include <openssl/ripemd.h>
#include <openssl/sha.h>

#define BLOCK_SIZE 1024

__global__ void hash160(char *pattern, unsigned char *out, uint32_t *nonce)
{
uint32_t index = blockIdx.x * blockDim.x + threadIdx.x;

unsigned char hash[SHA256_DIGEST_LENGTH];
char str[64];

for (int i = 0; i < 9; i++) {
str[i] = pattern[i];
}

for (uint32_t i = *nonce; i < UINT32_MAX; i += gridDim.x * blockDim.x) {
sprintf(&str[9], "%08x", i);
SHA256((const unsigned char*)str, strlen(str), hash);
RIPEMD160(hash, SHA256_DIGEST_LENGTH, &out[index * 20]);
if (out[index * 20] == 0x00 && out[index * 20 + 1] == 0x00) {
// Found a match!
*nonce = i;
break;
}
}
}

int main()
{
char pattern[10] = "1abcdefg"; // 9 characters pattern

  // Allocate memory on the host
unsigned char *out = new unsigned char[3 * 20];
uint32_t *nonce = new uint32_t;
*nonce = 0;

// Allocate memory on the device
char *dev_pattern;
unsigned char *dev_out;
uint32_t *dev_nonce;

cudaMalloc((void**)&dev_pattern, 10);
cudaMalloc((void**)&dev_out, 3 * 20);
cudaMalloc((void**)&dev_nonce, sizeof(uint32_t));

// Copy input data to the device
cudaMemcpy(dev_pattern, pattern, 10, cudaMemcpyHostToDevice);
cudaMemcpy(dev_out, out, 3 * 20, cudaMemcpyHostToDevice);
cudaMemcpy(dev_nonce, nonce, sizeof(uint32_t), cudaMemcpyHostToDevice);

// Launch the kernel
hash160 << < 3, BLOCK_SIZE >> >(dev_pattern, dev_out, dev_nonce);

// Copy output data from the device
cudaMemcpy(out, dev_out, 3 * 20, cudaMemcpyDeviceToHost);
cudaMemcpy(nonce, dev_nonce, sizeof(uint32_t), cudaMemcpyDeviceToHost);

// Print the results
for (int i = 0; i < 3; i++) {
std::cout << "Address " << i + 1 << ": " << std::setbase(16);
for (int j = 0; j < 20; j++) {
std::cout << std::setw(2) << std::setfill('0') << (int)out[i * 20 + j];
}
std::cout << std::endl;
}
std::cout << "Nonce: " << *nonce << std::endl;

// Free memory
delete[] out;
delete nonce;
cudaFree(dev_pattern);
cudaFree(dev_out);
cudaFree(dev_nonce);

return 0;
}

blockIdx.x * blockDim.x + threadIdx.x undefinited why Huh

2  Bitcoin / Development & Technical Discussion / How many operation on: February 24, 2023, 02:37:54 PM
liste = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

while x == 97:


how many operation "+" can we have to obtain 97 knowing that only 17 numbers are allowed.

start with 3 + 5 + 15 numbers
3  Bitcoin / Development & Technical Discussion / list range in hex not possible on: February 19, 2023, 04:56:45 PM
hi

Code:
from ecdsa import SigningKey, SECP256k1
from random import shuffle
import datetime
import time
import mysql.connector
import sys, os
from binascii import unhexlify
import hashlib
from base58 import b58encode

t0 = datetime.datetime.now()

script_dir = os.path.dirname( __file__ )
mymodule_dir = os.path.join( script_dir, '..' )
sys.path.append( mymodule_dir )

def CompressedPublicKeyComputation(x, y):
    if int(y, 16) % 2 == 0:
        publicKey = '02' + str(x)
    else:
        publicKey = '03' + str(x)

    return publicKey

with open("Luck.txt", "a") as f:
    print(t0, file=f)

def BitcoinClassicAddressComputation(publicKey):
    public_key_bytes = unhexlify(publicKey)

    sha256 = hashlib.sha256()
    sha256.update(public_key_bytes)
    hash_temp = sha256.digest()

    ripemd160 = hashlib.new('Ripemd160')
    ripemd160.update(hash_temp)
    hash2_temp = ripemd160.hexdigest()

    hash3_temp = '00' + hash2_temp

    checksum = checksum_computation(hash3_temp)

    hash_final = hash3_temp + str(checksum)
    hash_final_bytes = unhexlify(hash_final)
    address = b58encode(hash_final_bytes).decode("utf-8")
    return address

def checksum_computation(string: str) -> hex:
    cs = hashlib.sha256(hashlib.sha256(unhexlify(string)).digest()).hexdigest()
    checksum = cs[:8]
    return checksum
    
mydb = mysql.connector.connect(
    host="localhost",
    user="root",
    password="",
    database="bitcoin"
)

g = 0
priv = list(range(1,10000))
shuffle(priv)

while priv:
    private1 = priv.pop()
    k = int(str(private1), 16).to_bytes(32, "big")
    k = SigningKey.from_string(k, curve=SECP256k1)
    K = k.get_verifying_key().to_string()
    h = (str(g) + ')\t' + str(private1) + '\t' + K.hex()[0:64] + '\t' + K.hex()[64:128] + '\n')
    chunks = h.split('\t')
    public_key = CompressedPublicKeyComputation(chunks[2], chunks[3])
    public_key = public_key.split('\n')
    private_key = chunks[1]
    pub = BitcoinClassicAddressComputation(public_key[0])
    print(private_key,pub)
    mycursor = mydb.cursor()

    sql = "SELECT * FROM btc WHERE address='" + pub + "';"

    mycursor.execute(sql)
    myresult = mycursor.fetchone()

    
    if myresult:
        body = 'Private key= {pkwif}  \r\n Address = {address} \r\n -----------------------'
        Message = body.format(pkwif=private_key, address=pub)
        fichier =  open("Luck.txt", "a")
        fichier.write(private_key + '   ' + pub + '\n')

result :

Code:
6108 1Ls1B3xCBFPRogcCVNSd9UT5LnorLutXhf

6108 is secret exponent but I would like my results in hex
priv = list(range(1,10000)) to hex not possible
4  Bitcoin / Development & Technical Discussion / Calculation Overlay on: February 18, 2023, 12:16:29 PM
hi here my code :

Code:
import time
import random

elements = []

def fib(n):
    while len(elements) < 10000:
        priv = random.randint(10000, 20000)
        if priv not in elements:
            elements.append(priv)
start = time.time()
fib(1)
end = time.time()
elapsed = end - start

          
print(f'Temps d\'exécution : {elapsed:.2}s')

result :

Code:
exécution : 5.4s

Is it possible to do this while keeping the same execution time ?

Code:
import time
import random

elements = []
elements2 = []

def fib(n):
    while len(elements) < 10000:
        priv = random.randint(10000, 20000)
        priv2 = random.randint(20000, 30000)
        if priv not in elements:
            elements.append(priv)
        if priv2 not in elements2:
            elements.append(priv2)

start = time.time()
fib(1)
end = time.time()
elapsed = end - start

print(f'Temps d\'exécution : {elapsed:.2}s')


Code:
exécution : 12.26s

yet elements have 10000 entries as at the beginning
5  Bitcoin / Development & Technical Discussion / generate random number on: February 17, 2023, 12:43:28 PM
hi possible to generate a number by deleting what has already been generated in python without list

try :

Code:
import random                                       

elements = str(random.randint(1, 100))

i = 0
while i != 100:
        selection = elements
        
        print(elements)
        print(selection)
        i = i + 1
        elements.remove(selection)

result File "1.py", line 12, in <module>
    elements.remove(selection)
AttributeError: 'str' object has no attribute 'remove'
6  Bitcoin / Development & Technical Discussion / lattice attack on: February 16, 2023, 11:59:44 AM
hello someone knows this https://cryptodeeptech.ru/lattice-attack/

because it is impossible to get the program without paying a fortune
7  Bitcoin / Development & Technical Discussion / Bitcoin generation on: February 15, 2023, 01:59:27 PM
Hello, is it possible to generate bitcoin addresses very very quickly in this form?

PRIVKEY                                             X                                                                                                                     Y
0x80687e340c49f738b5db81d3dc6f8b      e84402e4b5677ca6a833073abb5ff75d5a5905a048f6dcb075c97230e81c8b0a                  c6f37535f8acf7e8ae56006c851ed6f94f4ff30d3f4df28f56af871a48f8600f
8  Bitcoin / Development & Technical Discussion / A Small Subgroup Attack bitcoin on: February 05, 2023, 01:49:26 PM
Could someone enlighten me on this subject because I can't figure out how these 18051648 addresses are generated.
Thank you.



Subgroup Detection
Since private keys are elements of Zq∗
, a straight brute force attack to the Bitcoin system seems infeasible, as inverting the map
ϕ:Zq∗⟶,k⟶k⋅P
would imply solving an ECDLP instance.
However, there are few small subgroups H≤Zq∗
that may be inspected, for which an exhaustive computation of all the possible keys and corresponding addresses may be carried out. This way one may compute the inverse of the restricted map
ϕ|H:⟶G.
Since the keys are supposed to be uniformly distributed, there is no probabilistic argument suggesting their presence in specific small subgroups. However, assuming that this is the case, we need to choose a suitable subgroup. In this view, by considering the factorization of q−1
into prime integers
q−1=26×3×149×631×107361793816595537p1×174723607534414371449p2×341948486974166000522343609283189p3,,
it is not difficult to test that the maximal subgroup of moderate size (i.e. that can today be checked with an average computer) contains N elements, where
N=26×3×149×631=18051648.
Such a group may be easily produced by considering any primitive element t of Zq
, such as t=7, and considering the element g=tp1×p2×p3, which generates the subgroup
H=<g>={gi∣∣1≤i≤18051648}.
Indeed, we summarize in the following theorem two well-known results.
Theorem 1. Let F
be a field. Then, any finite subgroup G≤F∗ is cyclic. Moreover, for every positive integer M dividing |G|, there is a unique subgroup H≤G such that |H|=M
.
Subgroup Inspection
The group H as previously defined has less than 20 millions elements; therefore, we were able to straightforwardly construct, in a few days, the BTC addresses originated by all private keys k∈H
and to check whether they have appeared in the BTC blockchain since its creation until 2018.
We recall that an address appears in the blockchain whenever it receives any amount of bitcoin. Note that the number of addresses in the BTC blockchain does not correspond to the number of actual BTC users, as modern wallets handle many different addresses for each user.
With this procedure, we found 4 BTC addresses, in which private keys belong to H:

    1PSRcasBNEwPC2TWUB68wvQZHwXy4yqPQ3,
    1B5USZh6fc2hvw2yW9YaVF75sJLcLQ4wCt,
    1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm,
    1JPbzbsAx1HyaDQoLMapWGoqf9pD5uha5m.

Two of them, (3) and (4), came from the trivial keys 1 and −1
, and they might have been generated on purpose, but the remaining two addresses appear to be legit. In particular, a blockchain inspection (Reference [21], 2018) suggests that one of them (2) has been used as temporary address for moving a small amount of bitcoins, while the other (1) has probably been used as a personal address, since its owner has stored some bitcoins there for 4 years.
To show that the private key of address (1) was really recovered, we used three of our addresses

A. 1FCuka8PYyfMULbZ7fWu5GWVYiU88KAU9W,
B. 1NChjA8s5cwPgjWZjD9uu12A5sNfoRHhbA,
C. 1695755gMv3fJxYVCDitMGaxGu7naSXYmv,

and we performed tiny transactions from each of them, as shown in Figure 3.
These operations may be easily verified through any blockchain explorer, such as Reference [21], by searching for their transaction IDs:

T1. 69ad7033376cea2bbea01e7ef76cc8d7bc028325e9179b2231ca1076468c1a1e,
T2. 1dd5c256a1acc81ea4808a405fd83586ea03d8b58e29a081ebf3d0d95e77bf63,
T3. b722c77dcdd13c3616bf0c4437f2eb63d96346f74f4eeb7a1e24c1a9711fc101.

9  Bitcoin / Development & Technical Discussion / BtcCollider question on: January 26, 2023, 10:26:52 AM
Hello would it be possible to modify this code: https://github.com/JeanLucPons/BTCCollider
to not make the generation random ?
thanks
10  Bitcoin / Project Development / BtcCollider questions on: January 22, 2023, 01:07:57 PM
Hello would it be possible to modify this code: https://github.com/JeanLucPons/BTCCollider
to not make the generation random ?
thanks
11  Economy / Gambling / New casino BTC game development on: January 09, 2023, 11:54:36 AM
Hello

Lately, I have created an absolutely sublime crypto casino.
Small demo available right here: https://demoscript.online/



18 games available, a crispy admin panel and hundreds of options like the biggest online casinos.
The source is custom ~50% to have something nice and clean and unique.

It is made in PHP with Laravel and for the db it is MongoDB.

I will set a quota of 0.01 BTC which seems reasonable to avoid the leeching of such a beautiful project.
12  Bitcoin / Development & Technical Discussion / How to decrypt hex rawtx on: August 27, 2022, 02:02:45 PM
Hello, I would like to know how to decipher this

and what values would change for the next block ?

01000000010000000000000000000000000000000000000000000000000000000000000000fffff fff0704ffff001d0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec1 1600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf6 21e73a82cbf2342c858eeac00000000

01 version ect......

thanks
13  Bitcoin / Development & Technical Discussion / Ecctools division max on: August 07, 2022, 07:30:55 PM
Good evening everyone first of all I would like to know with ecctools, the maximum division is how much?

I take an example

there are 150 public keys so the maximum division will be 150
14  Bitcoin / Development & Technical Discussion / another way to generate bitcoin addresses on: August 05, 2022, 10:50:51 AM
Good morning,

I would like to know if it is possible to redesign the bitcoins addresses like this:

base58 = 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz


creation of the private key base58(privkey)


base57 = 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxy 'z' removed

base57(address(privkey))

1st) is this possible?
2nd) if the generated private key gives a bitcoin address that must contain a 'z' how will this be interpreted?
3rd) for a generated private key would it be possible to scan only the bitcoin addresses that do not contain the 'z'?
15  Bitcoin / Development & Technical Discussion / Strange pubkey (real existing or not) on: June 12, 2022, 06:49:20 PM
Hello, I would like to have more information about the public key:

By choosing half of 2^256 private keys:

7fffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0 has for public key: 03000000000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63

the public key is a little strange but let us say that it is simply the symmetry which makes that and thus if I increase of 1 the private key: 7fffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1 it has for public key:
0300000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63

what is normal is the symmetry.

the strange thing is that if I add 1 to the public key :
0300000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c64

apparently it exists because it is connected to this bitcoin address:
13vSJ5pXUcUqiKoFN1gm7ffHVpK45G7b3e.

My question is this:
Does this public key really exist or not ?
And would they be positioned at strategic points ?

because if I continue it works

0200000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c68  1LQiRWwELhChkpuAaC6tFpSDqpdjR3fYiC
0200000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c6a  172N3FM1uEjzSx28Tg1aoSzDqgmd9yqqCa
...........
16  Bitcoin / Development & Technical Discussion / The mirror effect of public keys on: October 21, 2021, 10:11:38 AM
Does anyone know the public key mirror ?
17  Bitcoin / Development & Technical Discussion / All outputs bitcoins on: October 15, 2021, 09:53:17 AM
hi would anyone know how to get all the bitcoin outputs listed ?
18  Bitcoin / Development & Technical Discussion / All addresses with one private key on: October 14, 2021, 03:55:41 PM
Hello I would like to know if from a private key we could know all the addresses of type "1" "3" "bc" ....... if yes how?
19  Bitcoin / Development & Technical Discussion / Public key prefix on: October 07, 2021, 12:33:05 PM
Hello, would it be possible to modify this code : https://github.com/albertobsd/keyhunt to search only on public key prefix ?
20  Bitcoin / Development & Technical Discussion / 2^96 same bitcoin address on: October 05, 2021, 03:46:39 AM
Hello we know that there are 2^96 identical bitcoin addresses in the 2^256 private key.
Is it the same for the public keys?
Pages: [1] 2 3 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!