|
Title: 16bit padded to 256 question Post by: MikeJ_NpC on October 22, 2025, 02:16:44 AM Is the following true...
I have a 16bit key... i can pad it to 256bit and if it meets the following is valid... Yes, the private key (16bit) 1234c56789d (padded to 256 bits) ex 000000000 ... IT can sign a transaction for address: ABCD, as IT/IF matches the public key and verifies existing signatures. To sign the provided transaction, ensure the output is unspent, compute the correct sighash, and generate a new signature. ... Never really heard of it but it seems to check all the boxes .. just wondering if there is anything else im missing on this or if the crux of the validation is correct. ( yes it comes back to the address, does X with G .. and validates existing sigs) Yes this would be a fluke or something.. Thanks. Title: Re: 16bit padded to 256 question Post by: LoyceV on October 22, 2025, 06:04:23 AM Never really heard of it but it seems to check all the boxes .. just wondering if there is anything else im missing on this or if the crux of the validation is correct. Try it, and let us know the results.Title: Re: 16bit padded to 256 question Post by: pooya87 on October 22, 2025, 11:47:47 AM Bitcoin private keys are just numbers, there is no need to pad anything. And the only "boxes to check" is to see if the value is between 1 and a little less than 2256 (I leave googling to find max value for secp256k1 curve to you).
That means you can choose any number in that gigantic range and use that as your private key (it will give you a public key, you can use it to sign transactions, etc.) but if you choose a number manually (instead of using a strong random) or something in low ranges, that key is going to be considered weak and you could lose any coins send to that key. Title: Re: 16bit padded to 256 question Post by: MikeJ_NpC on October 22, 2025, 01:49:16 PM Never really heard of it but it seems to check all the boxes .. just wondering if there is anything else im missing on this or if the crux of the validation is correct. Try it, and let us know the results.i am but im stuck... it all shows as valid but then throws Failed to broadcast transaction, reason: bad-txns-inputs-missingorspent. other than that.. it all checks out as a valid key. Comes back to the XY, pubkey, gets by all the correctness .. What to verify (correctness) Integer range (must be non-zero and < curve order). The padded integer d must satisfy 1 ≤ d < n, where n is the secp256k1 group order (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141). If your padded value equals 0 or ≥ n it is invalid. Padding / endianness. Bitcoin/private-key formats use big-endian integer representation. When you “pad to 256 bits” you must place the small hex as the least-significant bytes and pad on the left with zeros to reach 32 bytes. Example: 0x1234c56789d → 0x0000...0001234c56789d (32 bytes total). Public key derivation matches address. Derive the public key by scalar multiply Q = d * G (G = curve base point). Then derive the address exactly the same way the blockchain expects (P2PKH: HASH160(pubkey) → Base58Check; P2WPKH: sha256/ripemd160 → bech32). Confirm the resulting address equals the address you said. If that holds, signatures from d should verify. Signature construction / sighash specifics. To sign a Bitcoin transaction you must: Ensure the input UTXO is unspent and you have its scriptPubKey (and amount for segwit). Compute the correct sighash (pre-SegWit vs SegWit v0 differ; sighash type appended to the signature). Create a valid DER signature (include low-S normalization if expected by the network/wallet). Put the signature + sighash byte in the correct scriptSig/witness format for the output type. DER/low-S and canonical checks. Many wallets/nodes expect canonical DER and low-S (s <= n/2). If you produce a non-canonical signature some software may reject it. WIF / import considerations. If you encode the key as WIF, you must include the 32-byte big-endian payload; prepend 0x80, append 0x01 if you want the compressed pubkey flag; then Base58Check. Leading zeros are preserved in the 32-byte payload. im past all of the pitfalls and is valid.. just i think im having issues with the seg-wit stuffs.... i hate txns not my strong point.... anyone want to lend a hand :) ive ran it thru and not much more i can do .. i think its something trival and bleh.. Title: Re: 16bit padded to 256 question Post by: LoyceV on October 22, 2025, 01:55:40 PM it all checks out as a valid key. A valid key to an empty address?Title: Re: 16bit padded to 256 question Post by: MikeJ_NpC on October 22, 2025, 01:56:48 PM it all checks out as a valid key. A valid key to an empty address?would i be doing this to a empty address :D ... nope far from it. it is dormant .. well more like lost... Title: Re: 16bit padded to 256 question Post by: LoyceV on October 22, 2025, 02:04:36 PM would i be doing this to a empty address :D So you have the wrong key. That's no surprise if you think a random small 16 bit key is going to work.Title: Re: 16bit padded to 256 question Post by: MikeJ_NpC on October 22, 2025, 02:08:08 PM i would normally doubt it and such but it validates the existing sigs.
How can it be wrong.. if it validates existing sigs.. I also have a full 256 which validates... no padding there. Observations / caveats Two S values have a leading zero byte in hex (they're larger than 32 bytes when naïvely hex-encoded with leading zero). That doesn't change correctness — the integer values were parsed correctly and verification succeeds. Successful verification means those (R,S,Z) triples are consistent with the public key (i.e., they were produced by the private key corresponding to that public key, or by someone with knowledge of an appropriate ephemeral k). It does not prove possession of the private key beyond the mathematical relation (but in practice valid ECDSA sigs imply the corresponding private key produced them). To sign the provided transaction, ensure the output is unspent, compute the correct sighash, and generate a new signature -- generate NEW sig and validates... Where the line in the sand is... not too sure. you can sign the signature data itself as a new message. i guess it would be more applicable for nesting .. Title: Re: 16bit padded to 256 question Post by: whanau on October 22, 2025, 08:20:59 PM would i be doing this to a empty address :D ... nope far from it. it is dormant .. well more like lost... If it is a 16 bit key you should be able to recover with one of the kangaroo programs but don't make your public key or address public or funds may be stolen by mempool bots. I am no mathematician, but as you seem to be working in the scalar world, deriving key 8 or 008 - or anything with padded leading zeros, will give the same result. Obviously, trailing zero's will be an entirely different number. Or maybe I am missing the point? Good luck Title: Re: 16bit padded to 256 question Post by: nc50lc on October 24, 2025, 03:38:41 AM i am but im stuck... it all shows as valid but then throws Failed to broadcast transaction, reason: bad-txns-inputs-missingorspent. Regardless of the key and signature, you seem to have pointed the wrong UTXO based from the error: "bad-txns-inputs-missingorspent".other than that.. it all checks out as a valid key. Comes back to the XY, pubkey, gets by all the correctness .. First, double-check the TXID and VOUT of the UTXO that you tried to spend, then try to add your signature. Title: Re: 16bit padded to 256 question Post by: Cricktor on October 25, 2025, 08:06:15 AM ... What tools do you use to construct your transaction?If you're not very familiar with assembling transactions kinda "by hand", it's very likely to make errors. From what I read and understand in this thread, you have a small range, very low entropy private key, 16 bits on either side of 256 bits is basically nothing, entropy-wise. I wonder, why potential funds controlled by such keys haven't been swiped by bots already. Assuming you're familiar to operate a secure environment to handle unprotected private keys. If I had such private keys and to make a quick'n'dirty check and test, I'd simply import such private keys in Electrum (pointed to my own Electrum server so I don't expose my wallet's addresses to foreign Electrum servers), check if there are funds (you know already that a private key can derive to multiple public address types?) on common public address types like uncompressed and compressed legacy P2PKH, P2WPKH-P2SH and P2WPKH. If there are actually funds to spend, craft a spending transaction in Electrum, but don't broadcast it to public mempools for low entropy private key controlled funds. Export signed transaction (not yet broadcasted!) as hex and throw it into a hidden non-public mempool like available at https://slipstream.mara.com (https://slipstream.mara.com). I might have missed something, just giving course steps off the top of my head. |