Author

Topic: Bitcoin puzzle transaction ~32 BTC prize to who solves it - page 111. (Read 215611 times)

member
Activity: 462
Merit: 24
Python

Code:
def point_addition(p, q, a, p_curve):
    if p == "infinity":
        return q
    if q == "infinity":
        return p

    x_p, y_p = p
    x_q, y_q = q

    if p != q:
        m = ((y_q - y_p) * pow(x_q - x_p, -1, p_curve)) % p_curve
    else:
        m = ((3 * x_p**2 + a) * pow(2 * y_p, -1, p_curve)) % p_curve

    x_r = (m**2 - x_p - x_q) % p_curve
    y_r = (m * (x_p - x_r) - y_p) % p_curve

    return (x_r, y_r)

# Elliptic curve parameters
p_curve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1
a_curve = 0
g_basepoint = (
    55066263022277343669578718895168534326250603453777594175500187360389116729240,
    32670510020758816978083085130507043184471273380659243275938904335757337482424
)

# Alice's private and public keys
alice_private_key = 17436825491055586112755527818298542034755947930418580382030036978914692463183
alice_public_key = (
    105679268965026450260338478364512614840272341529552480851333141374575362812020,
    16626610969520910407950657067133267950619549449019363437330088722436240164467
)

# Bob's private and public keys
bob_private_key = 32291818723468099298317452759803795679231875044644200373977689553806184529332
bob_public_key = (
    91972152888645730114115627070016955368567223430226022010551427574648772204461,
    38446745167120461740412855329188667802416705205856357237503216472671667494148
)

# Calculate (Alice Private + Bob Private) mod p
combined_private_key = (alice_private_key + bob_private_key) % p_curve

# Calculate combined public key
combined_public_key = "infinity"
for i in range(combined_private_key.bit_length()):
    if (combined_private_key >> i) & 1:
        combined_public_key = point_addition(combined_public_key, g_basepoint, a_curve, p_curve)

print("(Alice Private + Bob Private) * G:", combined_public_key)
print("Alice Public + Bob Public:", point_addition(alice_public_key, bob_public_key, a_curve, p_curve))

Result:

(Alice Private + Bob Private) * G: (42781960159024299958163639356878453190501432691827926213851649420102986506453, 26209845635735715128050436215405957538148584136159453271268754283021438363749)
Alice Public + Bob Public: (101985652621362431772155823262934243650512147323486167826619770748482854554391, 55338466074231142921426831718703469030196983642662166495910251269532062902125)


This is off-topic and not directly related to brute-forcing Bitcoin (BTC).
The focus here is on brute-forcing (trial-and-error guessing) BTC puzzles.
And this code is demonstration of elliptic curve cryptography operations (a combined public key from the sum of two private keys)
rather than an attempt to crack or exploit BTC.
There doesn't appear to be any straightforward way to solve the presented challenge without resorting to years of brute force.
jr. member
Activity: 32
Merit: 1
Quote
I want to make sure from something about binary and public key. So I need a script to see what happens when we add 2 to the public key A and see the results of B . If what I think works I will share with everyone my idea, that's all
Ok, so again, still confusing, at least to me.

You want to take a known public key "A" and add decimal number 2, to it, and see what the results are, "B"?
Yes, something like this



Quote
I want to make sure from something about binary and public key. So I need a script to see what happens when we add 2 to the public key A and see the results of B . If what I think works I will share with everyone my idea, that's all
Ok, so again, still confusing, at least to me.

You want to take a known public key "A" and add decimal number 2, to it, and see what the results are, "B"?


Basepoint G:   (55066263022277343669578718895168534326250603453777594175500187360389116729240L, 32670510020758816978083085130507043184471273380659243275938904335757337482424L)

Alice's secret key:   17436825491055586112755527818298542034755947930418580382030036978914692463183
Alice's public key:   (105679268965026450260338478364512614840272341529552480851333141374575362812020L, 16626610969520910407950657067133267950619549449019363437330088722436240164467L)

Bob's secret key:   32291818723468099298317452759803795679231875044644200373977689553806184529332
Bob's public key:   (91972152888645730114115627070016955368567223430226022010551427574648772204461L, 38446745167120461740412855329188667802416705205856357237503216472671667494148L)

=========Now we compare if same =================
(Alice Private+Bob Private)*G (101985652621362431772155823262934243650512147323486167826619770748482854554391L, 55338466074231142921426831718703469030196983642662166495910251269532062902125L)
Alice Public+Bob Public (101985652621362431772155823262934243650512147323486167826619770748482854554391L, 55338466074231142921426831718703469030196983642662166495910251269532062902125L)
full member
Activity: 1162
Merit: 237
Shooters Shoot...
Quote
I want to make sure from something about binary and public key. So I need a script to see what happens when we add 2 to the public key A and see the results of B . If what I think works I will share with everyone my idea, that's all
Ok, so again, still confusing, at least to me.

You want to take a known public key "A" and add decimal number 2, to it, and see what the results are, "B"?
jr. member
Activity: 32
Merit: 1
Thank you, but that is not what I asked for, I asked about script for public key  

Public key ??  Grin

Here you go

puzzle 65

Code:
import sys, secrets, secp256k1 as ice
while True:
    A0 = secrets.SystemRandom().randrange(18446744073709551615, 36893488147419103231)
    A1 = ice.scalar_multiplication(A0);B0 = ice.to_cpub(A1.hex())
    message = "\r{}".format(B0);messages = []
    messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r"
    sys.stdout.write(output);sys.stdout.flush()
    if B0 == "0230210c23b1a047bc9bdbb13448e67deddc108946de6de639bcc75d47c0216b1b":
        HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX)
        with open("KEYFOUNDKEYFOUND.txt", "a") as f:
          f.write(f'Private key (wif) Compressed : {wifc}\n')
        break

It's the same idea, it generate public from private then compare. It's not public key addition
Maybe provide step by step of what you are wanting.

Sounds like you want to add public key a to public key b and look at the resulting hash160.

So you'd have to provide 2 public keys, if that's the case.
I want to make sure from something about binary and public key. So I need a script to see what happens when we add 2 to the public key A and see the results of B . If what I think works I will share with everyone my idea, that's all
full member
Activity: 1162
Merit: 237
Shooters Shoot...
Thank you, but that is not what I asked for, I asked about script for public key  

Public key ??  Grin

Here you go

puzzle 65

Code:
import sys, secrets, secp256k1 as ice
while True:
    A0 = secrets.SystemRandom().randrange(18446744073709551615, 36893488147419103231)
    A1 = ice.scalar_multiplication(A0);B0 = ice.to_cpub(A1.hex())
    message = "\r{}".format(B0);messages = []
    messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r"
    sys.stdout.write(output);sys.stdout.flush()
    if B0 == "0230210c23b1a047bc9bdbb13448e67deddc108946de6de639bcc75d47c0216b1b":
        HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX)
        with open("KEYFOUNDKEYFOUND.txt", "a") as f:
          f.write(f'Private key (wif) Compressed : {wifc}\n')
        break

It's the same idea, it generate public from private then compare. It's not public key addition
Maybe provide step by step of what you are wanting.

Sounds like you want to add public key a to public key b and look at the resulting hash160.

So you'd have to provide 2 public keys, if that's the case.
jr. member
Activity: 32
Merit: 1
It's the same idea, it generate public from private then compare. It's not public key addition

And how else do you imagine generating a public key for a range, with a glass ball by magic?
The problem is that we don't know any public keys. Except the Puzzle 130 and above...
I never talked about generating public key, I asked for public point addition with python script, that's all
member
Activity: 462
Merit: 24
It's the same idea, it generate public from private then compare. It's not public key addition

And how else do you imagine generating a public key for a specific range, with a glass ball by magic?
The problem is that we don't know any public keys. Except the Puzzle 130 and above...
jr. member
Activity: 32
Merit: 1
Thank you, but that is not what I asked for, I asked about script for public key 

Public key ??  Grin

Here you go

puzzle 65

Code:
import sys, secrets, secp256k1 as ice
while True:
    A0 = secrets.SystemRandom().randrange(18446744073709551615, 36893488147419103231)
    A1 = ice.scalar_multiplication(A0);B0 = ice.to_cpub(A1.hex())
    message = "\r{}".format(B0);messages = []
    messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r"
    sys.stdout.write(output);sys.stdout.flush()
    if B0 == "0230210c23b1a047bc9bdbb13448e67deddc108946de6de639bcc75d47c0216b1b":
        HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX)
        with open("KEYFOUNDKEYFOUND.txt", "a") as f:
          f.write(f'Private key (wif) Compressed : {wifc}\n')
        break

It's the same idea, it generate public from private then compare. It's not public key addition
member
Activity: 462
Merit: 24
Thank you, but that is not what I asked for, I asked about script for public key  

Public key ??  Grin

Here you go (but you must know the target public key)........

puzzle 65
Code:
import sys, secrets, secp256k1 as ice
while True:
    A0 = secrets.SystemRandom().randrange(18446744073709551615, 36893488147419103231)
    A1 = ice.scalar_multiplication(A0);B0 = ice.to_cpub(A1.hex())
    message = "\r{}".format(B0);messages = []
    messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r"
    sys.stdout.write(output);sys.stdout.flush()
    if B0 == "0230210c23b1a047bc9bdbb13448e67deddc108946de6de639bcc75d47c0216b1b":
        HEX = "%064x" % A0;wifc = ice.btc_pvk_to_wif(HEX)
        with open("KEYFOUNDKEYFOUND.txt", "a") as f:
          f.write(f'Private key (wif) Compressed : {wifc}\n')
        break
jr. member
Activity: 32
Merit: 1
Hello all, is there any python code for public key addition and checking it's hash ?
Yes, look at the iceland2k14/secp256k1 script and create your script to fit within his script.

Also, what do you mean by "checking it's hash"? H160?
Yes , hash160 . I saw his code , I am just good at math but very bad at programming so I couldn't understand the code honestly

Simplest

Code:
import sys, secrets, secp256k1 as ice
while True:
    dec = secrets.SystemRandom().randrange(36893488147419103231, 73786976294838206463)
    h160 = ice.privatekey_to_h160(1, True, dec).hex()
    message = "\r{}".format(h160);messages = []
    messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r"
    sys.stdout.write(output);sys.stdout.flush()
    if h160 == "20d45a6a762535700ce9e0b216e31994335db8a5":
        HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX)
        with open("KEYFOUNDKEYFOUND.txt", "a") as f:
          f.write(f'Private key (wif) Compressed : {wifc}\n')
        break

Thank you, but that is not what I asked for, I asked about script for public key addition, this script is for generating address from private
member
Activity: 462
Merit: 24
Hello all, is there any python code for public key addition and checking it's hash ?
Yes, look at the iceland2k14/secp256k1 script and create your script to fit within his script.

Also, what do you mean by "checking it's hash"? H160?
Yes , hash160 . I saw his code , I am just good at math but very bad at programming so I couldn't understand the code honestly

Simplest

Code:
import sys, secrets, secp256k1 as ice
while True:
    dec = secrets.SystemRandom().randrange(36893488147419103231, 73786976294838206463)
    h160 = ice.privatekey_to_h160(0, True, dec).hex()
    message = "\r{}".format(h160);messages = []
    messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r"
    sys.stdout.write(output);sys.stdout.flush()
    if h160 == "20d45a6a762535700ce9e0b216e31994335db8a5":
        HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX)
        with open("KEYFOUNDKEYFOUND.txt", "a") as f:
          f.write(f'Private key (wif) Compressed : {wifc}\n')
        break
jr. member
Activity: 32
Merit: 1
Hello all, is there any python code for public key addition and checking it's hash ?
Yes, look at the iceland2k14/secp256k1 script and create your script to fit within his script.

Also, what do you mean by "checking it's hash"? H160?
Yes , hash160 . I saw his code , I am just good at math but very bad at programming so I couldn't understand the code honestly
full member
Activity: 1162
Merit: 237
Shooters Shoot...
BSGS with binaries soon... Cool
It will be interesting to see your spin on BSGS with binaries, however, I doubt it can match the existing BSGS scripts/programs out there.

BSGS eats up some disk space (mine is about 4GB) but Once the binary file is built, it doesn't eat up any RAM during the search (Cuda).

And on a single mid-level GPU, I check a 2^66 range, each second.

Looking forward to your spin on it.

At the moment I have it in python, it is working, sequential. I haven't had time to add new options to upload it, work has me tied up.
Let me know when you upload it. I'll run some tests for you and find any bugs Smiley



Hello all, is there any python code for public key addition and checking it's hash ?
Yes, look at the iceland2k14/secp256k1 script and create your script to fit within his script.

Also, what do you mean by "checking it's hash"? H160?
member
Activity: 239
Merit: 53
New ideas will be criticized and then admired.
BSGS with binaries soon... Cool
It will be interesting to see your spin on BSGS with binaries, however, I doubt it can match the existing BSGS scripts/programs out there.

BSGS eats up some disk space (mine is about 4GB) but Once the binary file is built, it doesn't eat up any RAM during the search (Cuda).

And on a single mid-level GPU, I check a 2^66 range, each second.

Looking forward to your spin on it.

At the moment I have it in python, it is working, sequential. I haven't had time to add new options to upload it, work has me tied up.
newbie
Activity: 17
Merit: 0
Working on a script to run on a quantum computer, WE SHALL SEE THE RESULTS  Grin

Code:
.from qiskit import QuantumCircuit, execute, Aer
from qiskit.circuit.library import PhaseOracle

target_address_hex = "20d45a6a762535700ce9e0b216e31994335db8a5"
target_address_decimal = int(target_address_hex, 16)

def sha256_compression_function(qc, message_bits):
    # Implement SHA-256 compression using quantum gates
    # You need to add the actual logic here

    # For demonstration purposes, we'll just apply a simple quantum oracle
    oracle = PhaseOracle(message_bits, target=target_address_decimal)
    qc.append(oracle, range(qc.num_qubits))

# Define the range for iteration
start_range = 36893488147419103232
end_range = -73786976294838206464

# Main loop
for decimal_value in range(start_range, end_range+1):
    # Convert decimal value to bytes and binary string
    message_bytes = decimal_value.to_bytes(32, byteorder="big")
    binary_message = ''.join(format(byte, '08b') for byte in message_bytes)

    # Create quantum circuit
    qc = QuantumCircuit(256)

    # Apply bit operations to encode the initial state and message onto the qubits
    # Implement encoding logic based on your requirements

    # Implement the SHA-256 compression function using a quantum oracle
    sha256_compression_function(qc, binary_message)

    # Measure the final state of the qubits
    qc.measure_all()

    # Simulate the circuit
    job = execute(qc, backend=Aer.get_backend('qasm_simulator'), shots=1024)

    # Get the results and extract the final state
    counts = job.result().get_counts(qc)
    final_state = [int(bits, 2) for bits in counts.keys()][0]

    # Check if the generated hash matches the target address
    if final_state == target_address_decimal:
        print(f"Target address found!")
        print(f"Decimal Value: {decimal_value}")
        print(f"Simulated Bitcoin hash160: {hex(final_state)[2:].zfill(40)}")
        break
jr. member
Activity: 32
Merit: 1
Hello all, is there any python code for public key addition and checking it's hash ?
newbie
Activity: 3
Merit: 0
guys, it's 29 days in a row. My 4090 + i9 are working in random mode day & night... I feel that my 6.6 BTC is coming for Christmas for me Smiley

4090: 23972MB | 1 target 3452.78 MKey/s (8,836,475,512,684,544 total) [29d:03h:52m:46s]
i9: Total 377,340,264,155,136 keys in 2322490 seconds: ~162 Mkeys/s (162472287 keys/s)

My only question: shall I restart the scripts or keep going? Smiley
full member
Activity: 1162
Merit: 237
Shooters Shoot...
BSGS with binaries soon... Cool
It will be interesting to see your spin on BSGS with binaries, however, I doubt it can match the existing BSGS scripts/programs out there.

BSGS eats up some disk space (mine is about 4GB) but Once the binary file is built, it doesn't eat up any RAM during the search (Cuda).

And on a single mid-level GPU, I check a 2^66 range, each second.

Looking forward to your spin on it.
member
Activity: 239
Merit: 53
New ideas will be criticized and then admired.
BSGS with binaries soon... Cool
member
Activity: 93
Merit: 16
Which script did you use to get those keys?
This method does not work for the puzzle.
Jump to: