Bitcoin Forum
May 05, 2024, 10:54:01 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 [56] 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 ... 317 »
1101  Bitcoin / Development & Technical Discussion / Re: Vanity Address Generator in Java on: September 18, 2023, 05:36:28 PM
Can we run it on android phones? I have tried to run  jar files on my android before but I couldn't find a compatible runtime for my phone.
Nowadays everyone should develop apps/tools for both desktop and phone devices. So I wonder if you have any benchmark to share with us, though I think java is very slow when it comes to key generation process.
I will try it later on my laptop and will report back, if I can manage to successfully run it, I have no experience with java.
1102  Bitcoin / Bitcoin Discussion / Re: Paxos recovers its $500,000 'fat finger' Bitcoin transaction fee on: September 18, 2023, 05:24:52 PM
So it was a big company mistakenly sending 20 bitcoins as fee and then a large mining pool who happened to mine that block, and at the end they returned the coins with no problem? Why does that sound very generic and usual? Lol.


If I refund those coins 7.2 I would need quite a lot of assurance from PayPal and paxos that 194k of taxable income goes on their books not mine. I would need to create a legal agreement to refund them.

Legally speaking, you could deny paying them those 7.2 coins back, right? Or is there a way to take them back legally if for example all other recipients agreed to give their coins back and only you were left alone refusing?

I have no updated information about new crypto laws, but I'd assume once you mine a block, no matter what, all the coins are yours. In legal terms of course.
1103  Other / Beginners & Help / Re: Admin BTC Wallet Special Protection - Development - Admin Wake Up on: September 18, 2023, 11:29:31 AM
Unfortunately you are a few months late, I don't know about theymos but & co aka Luke.jr could have used this wakeup call.
Anyways, I'm wondering, are you providing a new wallet, antivirus or anything related? This board is for the development and technical discussions about bitcoin, not for suggestions regarding admin's wallet.
One other thing, can you explain how can someone "hack" an offline/air gapped electrum? It seems interesting.
1104  Other / Archival / 🖤 on: September 18, 2023, 07:13:39 AM
🖤
1105  Bitcoin / Bitcoin Discussion / Re: Not banned, yet not accepted on: September 17, 2023, 11:43:53 PM
There are several scenarios, a country could forbid the banks to process fiat transactions related to the trades of cryptocurrency because they don't have the needed infrastructure to combat money laundry, market manipulation etc, but they wouldn't put their citizens in jail if they are just "holding/owning bitcoin" or if they are getting paid in bitcoin.

Another scenario is when a country forbids, mining, trading, accepting, paying and owning crypto in general because they are simply idiots.

So when you are unable to easily buy and sell crypto by using your bank account is because idiots rule over you.
1106  Bitcoin / Bitcoin Discussion / Re: Owner of 8K bitcoin lost in landfill threatens to bankrupt local council on: September 17, 2023, 07:15:46 PM
I wonder if he has the public key for the address?, or were they stored on one address or more?

Knowing the public key, he could at least have some hope, not that knowing public key could do magic, but at least we have some ideas which could be used to solve for private key. Of course if he is willing to spend money to hire a professional programmer to code the said ideas into an application/ tool.
Doing this is more practical than searching garbage, the hard drive is damaged by now due to humidity
1107  Bitcoin / Project Development / Re: Sypheon Online on: September 17, 2023, 06:42:02 PM
This is so cool, I love such games, though if this is indeed a game? I couldn't find a link to the site/ app.
It would be nice if  you could share more details about this project other than cinematic scenario narration.

What is the relevance of this project with bitcoin?
I can only see telegram and twitter links, no sypheon dot com dot something?
1108  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: September 17, 2023, 06:26:03 PM

Can you please explain in details for us noobs how this works and what we need to change when searching for our desired keys?
Also what do you mean by solving 65 without needing a public key, do you search for address or something?

Do you happen to have a python code for it, even if it's slow. Or isn't it better to ask ai to convert the code into python? Is that even possible?


Edit:

Here is a working script which divides 2 points by start/end range and then subtracts the results of division from each other.
No external module/ library needed, just run the script.

Code:
# Define the EllipticCurve class
class EllipticCurve:
    def __init__(self, a, b, p):
        self.a = a
        self.b = b
        self.p = p

    def contains(self, point):
        x, y = point.x, point.y
        return (y * y) % self.p == (x * x * x + self.a * x + self.b) % self.p

    def __str__(self):
        return f"y^2 = x^3 + {self.a}x + {self.b} mod {self.p}"

# Define the Point class
class Point:
    def __init__(self, x, y, curve):
        self.x = x
        self.y = y
        self.curve = curve

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y and self.curve == other.curve

    def __ne__(self, other):
        return not self == other

    def __add__(self, other):
        if self.curve != other.curve:
            raise ValueError("Cannot add points on different curves")

        # Case when one point is zero
        if self == Point.infinity(self.curve):
            return other
        if other == Point.infinity(self.curve):
            return self

        if self.x == other.x and self.y != other.y:
            return Point.infinity(self.curve)

        p = self.curve.p
        s = 0
        if self == other:
            s = ((3 * self.x * self.x + self.curve.a) * pow(2 * self.y, -1, p)) % p
        else:
            s = ((other.y - self.y) * pow(other.x - self.x, -1, p)) % p

        x = (s * s - self.x - other.x) % p
        y = (s * (self.x - x) - self.y) % p

        return Point(x, y, self.curve)

    def __sub__(self, other):
        if self.curve != other.curve:
            raise ValueError("Cannot subtract points on different curves")

        # Case when one point is zero
        if self == Point.infinity(self.curve):
            return other
        if other == Point.infinity(self.curve):
            return self

        return self + Point(other.x, (-other.y) % self.curve.p, self.curve)

    def __mul__(self, n):
        if not isinstance(n, int):
            raise ValueError("Multiplication is defined for integers only")

        n = n % (self.curve.p - 1)
        res = Point.infinity(self.curve)
        addend = self

        while n:
            if n & 1:
                res += addend

            addend += addend
            n >>= 1

        return res

    def __str__(self):
        return f"({self.x}, {self.y}) on {self.curve}"

    @staticmethod
    def from_hex(s, curve):
        if len(s) == 66 and s.startswith("02") or s.startswith("03"):
            compressed = True
        elif len(s) == 130 and s.startswith("04"):
            compressed = False
        else:
            raise ValueError("Hex string is not a valid compressed or uncompressed point")

        if compressed:
            is_odd = s.startswith("03")
            x = int(s[2:], 16)

            # Calculate y-coordinate from x and parity bit
            y_square = (x * x * x + curve.a * x + curve.b) % curve.p
            y = pow(y_square, (curve.p + 1) // 4, curve.p)
            if is_odd != (y & 1):
                y = -y % curve.p

            return Point(x, y, curve)
        else:
            s_bytes = bytes.fromhex(s)
            uncompressed = s_bytes[0] == 4
            if not uncompressed:
                raise ValueError("Only uncompressed or compressed points are supported")

            num_bytes = len(s_bytes) // 2
            x_bytes = s_bytes[1 : num_bytes + 1]
            y_bytes = s_bytes[num_bytes + 1 :]

            x = int.from_bytes(x_bytes, byteorder="big")
            y = int.from_bytes(y_bytes, byteorder="big")

            return Point(x, y, curve)

    def to_hex(self, compressed=True):
        if self.x is None and self.y is None:
            return "00"
        elif compressed:
            prefix = "03" if self.y & 1 else "02"
            return prefix + hex(self.x)[2:].zfill(64)
        else:
            x_hex = hex(self.x)[2:].zfill(64)
            y_hex = hex(self.y)[2:].zfill(64)
            return "04" + x_hex + y_hex

    @staticmethod
    def infinity(curve):
        return Point(None, None, curve)

# Define the ec_mul function
def ec_mul(point, scalar, base_point):
    result = Point.infinity(point.curve)
    addend = point

    while scalar:
        if scalar & 1:
            result += addend

        addend += addend
        scalar >>= 1

    return result

# Define the ec_operations function
def ec_operations(start_range, end_range, target_1, target_2, curve):
    # Define parameters for secp256k1 curve
    n = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
    G = Point(
        0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,
        0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8,
        curve
    )

    # Open the files for writing
    with open("target1_division_results.txt", "a") as file1, \
            open("target2_division_results.txt", "a") as file2, \
            open("subtract_results.txt", "a") as file3:

        for i in range(start_range, end_range + 1):
            try:
                # Compute the inverse of i modulo n
                i_inv = pow(i, n-2, n)

                # Divide the targets by i modulo n
                result_1 = ec_mul(target_1, i_inv, G)
                result_2 = ec_mul(target_2, i_inv, G)

                # Subtract the results
                sub_result = result_2 - result_1

                # Write the results to separate files
                file1.write(f"{result_1.to_hex()}\n")
                file2.write(f"{result_2.to_hex()}\n")
                file3.write(f"Subtracting results for {i}:\n")
                file3.write(f"Target 1 / {i}: {result_1.to_hex()}\n")
                file3.write(f"Target 2 / {i}: {result_2.to_hex()}\n")
                file3.write(f"Subtraction: {sub_result.to_hex()}\n")
                file3.write("="*50 + "\n")

                print(f"Completed calculation for divisor {i}")
            except ZeroDivisionError:
                print(f"Error: division by zero for {i}")

    print("Calculation completed. Results saved in separate files.")

if __name__ == "__main__":
    # Set the targets and range for the operations
    curve = EllipticCurve(0, 7, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F)
    target_1 = Point.from_hex("0230210C23B1A047BC9BDBB13448E67DEDDC108946DE6DE639BCC75D47C0216B1B", curve)
    target_2 = Point.from_hex("02F6B787195159544330085C6014DBA627FF5B14F3203FF05D12482F76261F4FC3", curve)
    start_range = 2
    end_range = 200

    ec_operations(start_range, end_range, target_1, target_2, curve)

Note that on previous page there is one similar script but operating over scalar not points.
Also the credit for the division by a range part goes to @mcdouglasx, the rest goes to anyone here helping and of course the biggest idiot AI made by mankind ( all of them are for now ) aka deep.ai chatbot.

As a test sample I have used puzzle 65 in target1 and target 2 is an offset after subtracting the following scalar from puzzle 65.
0x0000000000000000000000000000000000000000000000020000000000000000

The script is really slow because I had problem using multiprocessing  in the code, so I decided to remove it, it also first calculates everything and then writes them to the files, since I'm not a coder, I don't know whether doing that requires more RAM or not.

Feel free to optimize, improve and add other functions/operations as you see fit and please do share.
Thanks.
1109  Bitcoin / Bitcoin Discussion / Re: == Bitcoin challenge transaction: ~1000 BTC total bounty to solvers! ==UPDATED== on: September 17, 2023, 05:46:34 PM
i wonder about privatekeys website

when i check for any addresss , i get the same addresses from different networks bitcoin gold , bitcoin cash ,,,etc
that has the same private key Huh?

and i wonder how is that possible without knowing the private key from the beginning ??
Never use such websites to search for your address/private keys, they will log and then will take any coin deposited to your address in the future.
Whoever holds the private key for puzzle 66, can spend all those garbage coins as well. You can even fork bitcoin and send millions of useless and worthless coins to that address.

Anyways, as long as a crypto coin is using secp256k1 curve to generate their private keys, all keys can spend from other coins which are using the same curve.

Ps, welcome Dr.😉
1110  Economy / Services / Re: [OPEN] Mixero ADVANCED MODE Bitcoin Mixer Signature Campaign | Sr+ up-to $250/w on: September 17, 2023, 05:15:30 PM
Code:
Rank: Hero member
Alternative choice (optional): don't know what that is, so I skip it.
Merit earned in the last 120 days: 27? That's what my profile says.

Bech32 address: 

bc1q9mfdla32fuut57hnwgev2e7f9c8zpvsadzmhtm

Thanks for consideration, I haven't been in a campaign for more than 5 years.
1111  Bitcoin / Project Development / Re: WifSolverCuda - new project for solving WIFs on GPU on: September 16, 2023, 07:35:29 PM
Hi, need to find private key for bitcoin wallet. Part of this key is 35 characters, I know how to find other characters, is there a program for sorting characters with an indication of mandatory ones.
I would appreciate a tip on the bitcoin part
So you have a private key missing 35 characters while you have the other 29 characters? Are the missing chars at the end, middle or beginning?
1112  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: September 16, 2023, 04:00:55 AM
Oh, look another useless and extremely slow python script which can only be used to test and then solve puzzle keys.😉,
Idea was mine, I had to make a few changes, but the code is generated by the use of deep.ai chat bot. And I have no other way than copy paste it here, so don't take offence for it.

Code:
from sympy import mod_inverse

N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141

def ters(scalar, target):
    k = mod_inverse(2, N)
    scalar_bin = bin(scalar)[2:]
    for i in range(len(scalar_bin)):
        if scalar_bin[i] == '0':
            result = (target * k) % N
        else:
            result = ((target * k) % N + N - 1) % N
        target = result
    return result

target1 = 508467739815150526153708316710194877073
target2 = 73909945130129581315154379935980065

print("Target results:")
for x in range(1, 10):
    result1 = ters(x, target1)
    print(f"{x}-T1: {result1:x}")
for x in range(1, 10):
    result2 = ters(x, target2)
    print(f"{x}-T2: {result2:x}")
for x in range(1, 10):
    result1 = ters(x, target1)
    result2 = ters(x, target2)
    subtraction = (result1 - result2) % N
    print(f"{x}-Sub: {subtraction:x}")

Think of target 1 as a puzzle key, and target 2 is known, if we subtract target2 from target1 ( puzzle key) before using the script, we would have this third ( also unknown ) key :
508393829870020396572393162330258897008

And yeah, that's it, I'm not gonna keep talking to actually reach the real puzzle key.😅



I hope nobody takes any offence because I talk too much, if they do, IDRC. 😘

Ps, I'm wearing it as avatar @MisterZz
1113  Bitcoin / Development & Technical Discussion / Re: weird secquence on: September 16, 2023, 01:01:10 AM
hmm. those value are constatnts. this can be suggest that some curve can have...hidden layer:)
I failed to see the constants, all your values are dynamic.
Can you clarify about this hidden/back door, on which curves have you found such layers?
1114  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: September 15, 2023, 01:00:44 PM
Hello, I would like to know if it is possible to divide 2 public keys between them.
ex: 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 / 02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5 with "secp256k1 as ice" or even something else?
I can give you the result for your example, here it is :
Pub =
0200000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63
Private =
7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1

But if we don't know the private key of at least one of the points, we can never directly reach any meaningful result.
If we don't know k for one of the points, how can an algorithm/library know it?

There are ways to indirectly divide 2 points by using a k greater than 1 and smaller than the other. It would be nonsense/off topic if I try to explain it, so I just save everybody the headache and cut the nonsense.😉




He is learning maths and programming, so I think is not a waste of time..

Hello to everyone

Agreed, we should never stop learning, for example learning how to quote someone properly, lol I mean OMG, look the mess you posted.
Jokes aside, welcome to the jungle.🤝
1115  Other / Meta / Re: Merits in WO on: September 15, 2023, 06:06:30 AM
Wow, really nice, is there a map for global merit transactions, I think we could form a planet and identify third world, rich and poor countries ( forums, boards ) and of course finding the infamous 1% rich having 99% of resources.😂
1116  Bitcoin / Bitcoin Discussion / Re: == Bitcoin challenge transaction: ~1000 BTC total bounty to solvers! ==UPDATED== on: September 14, 2023, 06:49:18 PM
You can look here for what you seek : https://bitcointalk.org/index.php?topic=5214021.0
And here :
https://bitcointalk.org/index.php?topic=5382190.0
1117  Bitcoin / Bitcoin Discussion / Re: Interesting behaivor of TESTNET difficulty on: September 14, 2023, 06:44:58 PM
If someone wants test net coins for development purposes, why do they use the same test coins? They can fork and mine trillions of such coins.

Wait a minute, don't we already have thousands of such useless coins out there and some people even pay for them in hopes of profit?  It's a sad story really.
1118  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: September 12, 2023, 10:20:10 PM
Code:
from sympy import mod_inverse
import secp256k1 as ice
pub=ice.pub2upub('Here Compressed Public Key')
N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

k=mod_inverse(2,N)
neg1=ice.point_negation(ice.scalar_multiplication(1))


def ters(Qx,Scalar):
     ScalarBin = str(bin(Scalar))[2:]
     le=len(ScalarBin)
     for i in range (1,le+1):
        if ScalarBin[le-i] == "0":
            Qx=ice.point_multiplication(k,Qx)
        else:
            Qx=ice.point_addition(Qx,neg1)
            Qx=ice.point_multiplication(k,Qx)
     return ice.point_to_cpub(Qx)


for x in range(1,65536):
         f= (ters(pub,x))
         data= open(“halfpub.txt”,”a”)
         data.write(f+”\n”)
         data.close()

Note this is where you decide how many bits should be reduced  
for x in range(1,65536):
For example reducing 26 bits requires 67108864 to be generated, 1 of them is the correct 26 bit reduced key.

Will you release for public to use?


Yes this is my code, I can write bit reduction code in another way if you want. If you want, you can reduce bits by subtraction.


I'm developing a new algorithm for downgrading from a known bit range to the bit range I want. When I complete it by giving only 1 correct pubkey, I will share it here.

@lordfrs, I was thinking, why do we need to keep all the 65556 keys if we are reducing 16 bits?  One other thing, if we multiply one of the keys from the end of the output file by 65556 we should see our target, correct? I haven't thought about on how to calculate, since we are subtracting one dividing by 2, one result if multiplied by 2^16 should reach the target or close to target, so why not discarding 90% of the generated keys and start multiplying the remaining 10% by 2^16? Could you add such operation to your script?

I guess if we could operate on private keys instead of public keys using your script, we could reach some results, ( as a test of course )

To test with scalar only, I use this script :

Code:
from sympy import mod_inverse
N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

def ters(scalar):
    k = mod_inverse(2, N)
    scalar_bin = bin(scalar)[2:]
    result = 2
    for i in range(len(scalar_bin)):
        if scalar_bin[i] == '0':
            result = (result * k) % N
        else:
            result = ((result * k) % N + N - 1) % N
    return hex(result)[2:].zfill(64)

for x in range(1, 20):
    f = ters(x)
    print(f)

It was a lucky shot at AI generated code and it worked.😅
Btw, the first "result" in the script above, represents your target, I couldn't risk the AI to mess one thing she has done right. So result = 2, replace 2 with your own scalar in decimal.
1119  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: September 12, 2023, 05:07:05 PM

Code:
import multiprocessing

# Define the EllipticCurve class
class EllipticCurve:
    def __init__(self, a, b, p):
        self.a = a
        self.b = b
        self.p = p

    def contains(self, point):
        x, y = point.x, point.y
        return (y * y) % self.p == (x * x * x + self.a * x + self.b) % self.p

    def __str__(self):
        return f"y^2 = x^3 + {self.a}x + {self.b} mod {self.p}"

# Define the Point class
class Point:
    def __init__(self, x, y, curve):
        self.x = x
        self.y = y
        self.curve = curve

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y and self.curve == other.curve

    def __ne__(self, other):
        return not self == other

    def __add__(self, other):
        if self.curve != other.curve:
            raise ValueError("Cannot add points on different curves")

        # Case when one point is zero
        if self == Point.infinity(self.curve):
            return other
        if other == Point.infinity(self.curve):
            return self

        if self.x == other.x and self.y != other.y:
            return Point.infinity(self.curve)

        p = self.curve.p
        s = 0
        if self == other:
            s = ((3 * self.x * self.x + self.curve.a) * pow(2 * self.y, -1, p)) % p
        else:
            s = ((other.y - self.y) * pow(other.x - self.x, -1, p)) % p

        x = (s * s - self.x - other.x) % p
        y = (s * (self.x - x) - self.y) % p

        return Point(x, y, self.curve)

    def __sub__(self, other):
        if self.curve != other.curve:
            raise ValueError("Cannot subtract points on different curves")

        # Case when one point is zero
        if self == Point.infinity(self.curve):
            return other
        if other == Point.infinity(self.curve):
            return self

        return self + Point(other.x, (-other.y) % self.curve.p, self.curve)

    def __mul__(self, n):
        if not isinstance(n, int):
            raise ValueError("Multiplication is defined for integers only")

        n = n % (self.curve.p - 1)
        res = Point.infinity(self.curve)
        addend = self

        while n:
            if n & 1:
                res += addend

            addend += addend
            n >>= 1

        return res

    def __str__(self):
        return f"({self.x}, {self.y}) on {self.curve}"

    @staticmethod
    def from_hex(s, curve):
        if len(s) == 66 and s.startswith("02") or s.startswith("03"):
            compressed = True
        elif len(s) == 130 and s.startswith("04"):
            compressed = False
        else:
            raise ValueError("Hex string is not a valid compressed or uncompressed point")

        if compressed:
            is_odd = s.startswith("03")
            x = int(s[2:], 16)

            # Calculate y-coordinate from x and parity bit
            y_square = (x * x * x + curve.a * x + curve.b) % curve.p
            y = pow(y_square, (curve.p + 1) // 4, curve.p)
            if is_odd != (y & 1):
                y = -y % curve.p

            return Point(x, y, curve)
        else:
            s_bytes = bytes.fromhex(s)
            uncompressed = s_bytes[0] == 4
            if not uncompressed:
                raise ValueError("Only uncompressed or compressed points are supported")

            num_bytes = len(s_bytes) // 2
            x_bytes = s_bytes[1 : num_bytes + 1]
            y_bytes = s_bytes[num_bytes + 1 :]

            x = int.from_bytes(x_bytes, byteorder="big")
            y = int.from_bytes(y_bytes, byteorder="big")

            return Point(x, y, curve)

    def to_hex(self, compressed=True):
        if compressed:
            prefix = "03" if self.y & 1 else "02"
            return prefix + hex(self.x)[2:].zfill(64)
        else:
            x_hex = hex(self.x)[2:].zfill(64)
            y_hex = hex(self.y)[2:].zfill(64)
            return "04" + x_hex + y_hex

    @staticmethod
    def infinity(curve):
        return Point(None, None, curve)

# Define the ec_operations function
def ec_operations(i, target_1, target_2, start_range, end_range):
    P = EllipticCurve(0, 7, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F)
    G = Point(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8, P)

    div_1 = Point.from_hex(target_1, P)
    div_2 = Point.from_hex(target_2, P)
    scalar_1 = i
    scalar_2 = 2 * i
    result_1 = div_2 * scalar_1
    result_2 = div_2 * scalar_2
    sub_result = result_1 - (div_1 * (scalar_1 // 5)) - (result_2 - (div_2 * (scalar_2 // 5)))

    # Write the results to separate files
    with open(f"sub_result_{i}.txt", "a") as file:
        file.write(f"{sub_result.to_hex(compressed=True)}\n")

    print(f"Completed calculation {i}")

if __name__ == "__main__":
    # Set the targets and range for EC operations
    target_1 = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
    target_2 = "02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
    start_range = 20
    end_range = 40

    # Define the range of values to calculate on with multiprocessing
    with multiprocessing.Pool() as pool:
        pool.starmap(ec_operations, [(i, target_1, target_2, start_range, end_range) for i in range(start_range, end_range + 1)])

    print("Calculation completed. Results saved in separate files.")

My man, I think I explained incorrectly, what we want is this :
Example :
T1 = 20
T2 = 40
Start range = 2
End range = 8
Divide t1 by 2 = 10
Divide t2 by 2 = 20
Subtract 10 from 20 = 10.

T1 20/3 = 6.666666667
T2 40/3 = 13.33333333
Subtract 6.666666667 from 13.33333333 = 6.666666663

T1 20/4 = 5
T2 40/4 = 10
Subtract 5 from 10 = 5

And so on, in my example 20 is half of 40, but in reality we can set any target we want, do you think you can modify the code to do that please? Thank you for your time and effort.
1120  Bitcoin / Bitcoin Discussion / Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it on: September 11, 2023, 09:14:13 PM
So, after citb0in's typo, I went down a dangerous path by talking to an idiot AI for hours, I was about to jump off the roof head on, lol anyways I couldn't get this new script working after trying at least 50 versions, but the most complete one with no error was this one

Code:
  
import multiprocessing

# Define the EllipticCurve class
class EllipticCurve:
    def __init__(self, a, b, p):
        self.a = a
        self.b = b
        self.p = p

    def contains(self, point):
        x, y = point.x, point.y
        return (y * y) % self.p == (x * x * x + self.a * x + self.b) % self.p

    def __str__(self):
        return f"y^2 = x^3 + {self.a}x + {self.b} mod {self.p}"

# Define the Point class
class Point:
    def __init__(self, x, y, curve):
        self.x = x
        self.y = y
        self.curve = curve

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y and self.curve == other.curve

    def __ne__(self, other):
        return not self == other

    def __add__(self, other):
        if self.curve != other.curve:
            raise ValueError("Cannot add points on different curves")

        # Case when one point is zero
        if self == Point.infinity(self.curve):
            return other
        if other == Point.infinity(self.curve):
            return self

        if self.x == other.x and self.y != other.y:
            return Point.infinity(self.curve)

        p = self.curve.p
        s = 0
        if self == other:
            s = ((3 * self.x * self.x + self.curve.a) * pow(2 * self.y, -1, p)) % p
        else:
            s = ((other.y - self.y) * pow(other.x - self.x, -1, p)) % p

        x = (s * s - self.x - other.x) % p
        y = (s * (self.x - x) - self.y) % p

        return Point(x, y, self.curve)

    def __sub__(self, other):
        if self.curve != other.curve:
            raise ValueError("Cannot subtract points on different curves")

        # Case when one point is zero
        if self == Point.infinity(self.curve):
            return other
        if other == Point.infinity(self.curve):
            return self

        return self + Point(other.x, (-other.y) % self.curve.p, self.curve)

    def __mul__(self, n):
        if not isinstance(n, int):
            raise ValueError("Multiplication is defined for integers only")

        n = n % (self.curve.p - 1)
        res = Point.infinity(self.curve)
        addend = self

        while n:
            if n & 1:
                res += addend

            addend += addend
            n >>= 1

        return res

    def __str__(self):
        return f"({self.x}, {self.y}) on {self.curve}"

    @staticmethod
    def from_hex(s, curve):
        if len(s) == 66 and s.startswith("02") or s.startswith("03"):
            compressed = True
        elif len(s) == 130 and s.startswith("04"):
            compressed = False
        else:
            raise ValueError("Hex string is not a valid compressed or uncompressed point")

        if compressed:
            is_odd = s.startswith("03")
            x = int(s[2:], 16)

            # Calculate y-coordinate from x and parity bit
            y_square = (x * x * x + curve.a * x + curve.b) % curve.p
            y = pow(y_square, (curve.p + 1) // 4, curve.p)
            if is_odd != (y & 1):
                y = -y % curve.p

            return Point(x, y, curve)
        else:
            s_bytes = bytes.fromhex(s)
            uncompressed = s_bytes[0] == 4
            if not uncompressed:
                raise ValueError("Only uncompressed or compressed points are supported")

            num_bytes = len(s_bytes) // 2
            x_bytes = s_bytes[1 : num_bytes + 1]
            y_bytes = s_bytes[num_bytes + 1 :]

            x = int.from_bytes(x_bytes, byteorder="big")
            y = int.from_bytes(y_bytes, byteorder="big")

            return Point(x, y, curve)

    def to_hex(self, compressed=True):
        if compressed:
            prefix = "03" if self.y & 1 else "02"
            return prefix + hex(self.x)[2:].zfill(64)
        else:
            x_hex = hex(self.x)[2:].zfill(64)
            y_hex = hex(self.y)[2:].zfill(64)
            return "04" + x_hex + y_hex

    @staticmethod
    def infinity(curve):
        return Point(None, None, curve)

# Define the ec_operations function
def ec_operations(i, target_1, target_2):
    P = EllipticCurve(0, 7, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F)
    G = Point(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8, P)

    div_1 = Point.from_hex(target_1, P)
    div_2 = Point.from_hex(target_2, P)
    scalar_1 = i
    scalar_2 = 2 * i
    result_1 = div_2 * scalar_1
    result_2 = div_2 * scalar_2
    sub_result = result_2 - div_1

    # Write the results to separate files
    with open(f"target_1_result.txt", "a") as file_1, open(f"target_2_result.txt", "a") as file_2, open(f"sub_result.txt", "a") as file_3:
        if i > 1:
            file_1.write(f"{result_1.to_hex(compressed=True)}\n")
            file_2.write(f"{result_2.to_hex(compressed=True)}\n")
            file_3.write(f"{sub_result.to_hex(compressed=True)}\n")

    print(f"Completed calculation {i}")

if __name__ == "__main__":
    # Set the targets and range for EC operations
    target_1 = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
    target_2 = "02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
    start_range = 20
    end_range = 40

    # Define the range of values to calculate on with multiprocessing
    with multiprocessing.Pool() as pool:
        pool.starmap(ec_operations, [(i, target_1, target_2) for i in range(start_range, end_range + 1)])

    print("Calculation completed. Results saved in separate files.")

This idiot just adds the points, doesn't divide/subtract.
Basically we want to in mass generate divisions of 2 target keys and subtract the results from each other, like this :

We divide both targets by a range, start:end, then subtract t1/5 from t2/5 to have a new key, this is to learn new things about the behaviour of the curve under different circumstances.

If anyone could fix this code and run it with success, please do share it.  Thanks.
Pages: « 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 [56] 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 ... 317 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!