Bitcoin Forum
April 27, 2024, 03:01:28 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: P2PK - send to AND spend from a public address - will it work in 2023?  (Read 219 times)
BTCW (OP)
Copper Member
Full Member
***
Offline Offline

Activity: 193
Merit: 234

Click "+Merit" top-right corner


View Profile
September 04, 2023, 12:16:34 PM
Merited by pooya87 (4), ABCbits (4), BlackHatCoiner (4), vjudeu (1)
 #1

I don't think an introduction to P2PK is necessary in this forum. Briefly, it was popular in the early days of the blockchain and more or less abandoned for P2PHK ("Legacy", "1-addresses", or what you prefer to call them; several years later, Segwit and Taproot and yadda yadda.)

Here, consider this random 32-byte string as the starting point/private key. (I like "openssl rand -hex 32" but won't argue against other random number generation methods.)

Code:
91e1ff59d1c1452034ddcb38930176e5e3d4ab31b905eab73bf6843c149c4a67

(Never use it; the usual disclaimers.)

From it, we can derive the uncompressed public key, which will always be a 130-digit hexadecimal number (intentionally disregarding the compressed version for simplicity).

Code:
04038a7f3eb49c316d94e228ffb155113a0897e40f1f04f0878559fd8b7b37d8270ff752c2cd7e479c4c4844286fc6d924e578217d0354b97c42afe1f74c472e15

We can type out the private key in standard base58check WIF format and the corresponding public addresses on mainnet and testnet - but let's not use these for now.

Code:
Private key (uncompressed WIF): 5JvXxk75aku9ed11dMfDebgknrAYj2fk8gWHuLsqfMRkVtpWWTH
Public address (uncompressed testnet): mghXH5mxtsWPjqZtjEqJdg1qs7qJJTvTeL
Public address (uncompressed mainnet): 12BZz2gz5r58xj6H1frvokoX18EbPVkrsS

What I'm not after is a lecture on whether using P2PK today is a good idea; the only question is - can we?

More specifically, the question is two-fold:

1. How would I send to the public key (NOT the public address) - in practice?
2. How would I claim the unspent transition to "only" a public key - in practice?


I think, please chime in, that the answer to the first question is straightforward. A quick-and-dirty dry-run in Electrum, and sure, I can specify the public key as to where I want to send to. I can sign the transaction, but I haven't tried it online yet, i.e. broadcast it. Would it propagate and be picked up, or would the current p2p network consider it unusual or even invalid and drop it?

The proof is in the pudding, I guess - I could try with some tBTC and see what happens. In my experience, however, just because something works on testnet, it is not guaranteed to work on mainnet.

Would the transaction go through (i.e. be picked up and included in coming blocks) on the mainnet today?

Question number 2 is more interesting, in my opinion. Let's assume I indeed can spend to a public key on mainnet using old-school (2009) kung fu. What would be the most straightforward approach to claim it? I have assumed, without actual testing, that importing the private key in Bitcoin Core or Electrum (or other wallet software) will not allow me to spend from the associated public key, since P2PK barely been used in the past decade. And that I, in that case, would need to author (there are decent online tools) the transaction manually. Yes, no?

Looking forward to your thoughts and insights!

SendBTC.me <<< amazing imitative
"Governments are good at cutting off the heads of a centrally controlled networks like Napster, but pure P2P networks like Gnutella and Tor seem to be holding their own." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714230088
Hero Member
*
Offline Offline

Posts: 1714230088

View Profile Personal Message (Offline)

Ignore
1714230088
Reply with quote  #2

1714230088
Report to moderator
1714230088
Hero Member
*
Offline Offline

Posts: 1714230088

View Profile Personal Message (Offline)

Ignore
1714230088
Reply with quote  #2

1714230088
Report to moderator
Charles-Tim
Legendary
*
Offline Offline

Activity: 1526
Merit: 4815



View Profile
September 04, 2023, 12:32:20 PM
Merited by pooya87 (2), ABCbits (1)
 #2

If you paste the public key on Electrum, it will not be recognized. Only what can be recognized are bitcoin addresses, starting from 1, 3, and bc1 (both bc1q and bc1p).

You can still send to public key, but wallets are not supporting that.

I wanted to refer to some questions in the past about checking bitcoin address on explorers that are able to know the amount paid to public key and its address, but while Electrum is displaying only the coin sent to an address. I could not see any of the topics right now.

Paying to public key is now obsolete, you should not just try it.

.
HUGE
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 899

🖤😏


View Profile
September 04, 2023, 12:58:04 PM
 #3

Wallets might not support uncompressed public keys, but you can always send and spend by using public keys alone, that's the core function of bitcoin and  can never change. Upub will require more fees though.

🖤😏
BTCW (OP)
Copper Member
Full Member
***
Offline Offline

Activity: 193
Merit: 234

Click "+Merit" top-right corner


View Profile
September 04, 2023, 02:10:17 PM
 #4

Wallets might not support uncompressed public keys, but you can always send and spend by using public keys alone, that's the core function of bitcoin and  can never change. Upub will require more fees though.

Where would you recommend I start testing in practice? Using a service like Cointoolkit to semi-manually create transactions?

SendBTC.me <<< amazing imitative
BlackHatCoiner
Legendary
*
Online Online

Activity: 1498
Merit: 7292


Farewell, Leo


View Profile
September 04, 2023, 02:33:28 PM
Merited by BTCW (3), ABCbits (1)
 #5

1. How would I send to the public key (NOT the public address) - in practice?
By using the software bech32p2pkaddress, which takes as input a public key and builds a raw transaction wherein you spend UTXOs and create new P2PK UTXOs. You can read how it works in this medium article, asides from the Github repo.

2. How would I claim the unspent transition to "only" a public key - in practice?
As you can see from the software above, there is no script needed to spend the P2PK output. Bitcoin Core will normally allow you to spend the P2PK output if you give the private key in WIF and the TXID.

And that I, in that case, would need to author (there are decent online tools) the transaction manually. Yes, no?
There are definitely more software to try out. According to this SE post, python-bitcoinlib does provide the utilities to create and spend P2PK.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
vjudeu
Hero Member
*****
Offline Offline

Activity: 663
Merit: 1527



View Profile
September 04, 2023, 03:12:54 PM
Merited by ABCbits (9), BlackHatCoiner (8), pooya87 (4), BTCW (3), DdmrDdmr (1), Despairo (1), Knight Hider (1)
 #6

Quote
will it work in 2023?
Of course. In testnet, mainnet, signet, and regtest. It works in all official networks, supported by Bitcoin Core.

Quote
1. How would I send to the public key (NOT the public address) - in practice?
I will show you that on testnet coins, you can use the same method in all other networks.

First, we can get some testnet address, to get some coins from some faucet.

Code:
getnewaddress
tb1qy0vla3d5d2dnex5lpk9ssrjsurr28k42tm68rr

Then, we generate some new address to send to, exactly in the same way:

Code:
getnewaddress
tb1qyqlpe9huxzpn9x42ztjdat7u6cslljzkpukqtp

Now, we can ask Bitcoin Core for the public key for our address, as well as many more useful information:

Code:
getaddressinfo tb1qyqlpe9huxzpn9x42ztjdat7u6cslljzkpukqtp
{
  "address": "tb1qyqlpe9huxzpn9x42ztjdat7u6cslljzkpukqtp",
  "scriptPubKey": "0014203e1c96fc3083329aaa12e4deafdcd621ffc856",
  "ismine": true,
  "solvable": true,
  "desc": "wpkh([e4a5a30b/0'/0'/1']023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e)#6sfazyvz",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": true,
  "witness_version": 0,
  "witness_program": "203e1c96fc3083329aaa12e4deafdcd621ffc856",
  "pubkey": "023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e",
  "ischange": false,
  "timestamp": 1693838034,
  "hdkeypath": "m/0'/0'/1'",
  "hdseedid": "9c39324ff585908865a69b8f916cbfdf7afb3477",
  "hdmasterfingerprint": "e4a5a30b",
  "labels": [
    ""
  ]
}

Then, we can copy the most interesting part: our public key. It is compressed by default, because we can get Segwit addresses by default, but it can be uncompressed as well, if we force Bitcoin Core to use that. However, in general, we should use compressed ones, because they are cheaper, and they are always standard, when wrapped into Segwit or Taproot.

Code:
"pubkey": "023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e"

Now, we are ready to make some transaction, that will send coins to some regular address. Let's just send everything we have into our Segwit address first, just to get transaction data:

Code:
createrawtransaction "[{\"txid\":\"a8a552f75b4aad4a1eee859ed9babf0d3347ef49593c1d551c74ebd989795938\",\"vout\":1}]" "[{\"tb1qyqlpe9huxzpn9x42ztjdat7u6cslljzkpukqtp\":0.00012581}]" 0 true
020000000138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff012531000000000000160014203e1c96fc3083329aaa12e4deafdcd621ffc85600000000

I already put the proper amount, but you can go through the whole procedure first, then get transaction size in virtual bytes, and correct the amount in the end. But I already did that, so I know my transaction would take 123 virtual bytes with all signatures, so I can do it now, to not repeat commands.

Now, we can edit our transaction in Notepad, and replace our Segwit address with P2PK:

Code:
020000000138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff012531000000000000
160014203e1c96fc3083329aaa12e4deafdcd621ffc856 //this part should be replaced
00000000

023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e //this is our public key
2321023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac //this is our script

020000000138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff012531000000000000
2321023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac //this is how we modify our transaction
00000000

And then, we can confirm all of that, if we are not sure. First, to use different Scripts, we can use this command:

Code:
decodescript 21023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac
{
  "asm": "023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e OP_CHECKSIG",
  "desc": "pk(023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e)#24ru67fk",
  "type": "pubkey",
  "p2sh": "2N92fTTJNTJ8wMALQzKY44vcvGwgJy2BdL4",
  "segwit": {
    "asm": "0 203e1c96fc3083329aaa12e4deafdcd621ffc856",
    "desc": "addr(tb1qyqlpe9huxzpn9x42ztjdat7u6cslljzkpukqtp)#wnu5wk85",
    "hex": "0014203e1c96fc3083329aaa12e4deafdcd621ffc856",
    "address": "tb1qyqlpe9huxzpn9x42ztjdat7u6cslljzkpukqtp",
    "type": "witness_v0_keyhash",
    "p2sh-segwit": "2MtGUckgdneKb2Hvk7d6GzZRhd3KHE9DtaD"
  }
}

Then, if we can see "pubkey" in our "type" field, we are good to go. We should definitely avoid anything marked as "nonstandard", other outputs are usually fine, it depends, what exactly we need. But let's double check it, and decode a transaction:

Code:
decoderawtransaction 020000000138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff0125310000000000002321023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac00000000
{
  "txid": "04863e19ccf833b7d0e68f6e2173466cf97325ad1da3ba9d980c6ba05b25ede1",
  "hash": "04863e19ccf833b7d0e68f6e2173466cf97325ad1da3ba9d980c6ba05b25ede1",
  "version": 2,
  "size": 95,
  "vsize": 95,
  "weight": 380,
  "locktime": 0,
  "vin": [
    {
      "txid": "a8a552f75b4aad4a1eee859ed9babf0d3347ef49593c1d551c74ebd989795938",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 0.00012581,
      "n": 0,
      "scriptPubKey": {
        "asm": "023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e OP_CHECKSIG",
        "desc": "pk(023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e)#24ru67fk",
        "hex": "21023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac",
        "type": "pubkey"
      }
    }
  ]
}

As we can see, our "type" is "pubkey" in our output. Everything is fine, we can sign it.

Code:
signrawtransactionwithwallet "020000000138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff0125310000000000002321023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac00000000" "[{\"txid\":\"a8a552f75b4aad4a1eee859ed9babf0d3347ef49593c1d551c74ebd989795938\",\"vout\":1,\"scriptPubKey\":\"001423d9fec5b46a9b3c9a9f0d8b080e50e0c6a3daaa\",\"amount\":0.00012704}]"
{
  "hex": "0200000000010138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff0125310000000000002321023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac02473044022073798fe1171b029d20a3f4a1646acc12124b6d365700cd6ac0863fe4c6624d9f02204e9169296522dff46815a5e50b4e55cce47699f6d60b31ff696a4de5d8dbfd95012103aafc2a07508a54c90be4d844569f9746f5d247d153b1784e93277410cf5bd50a00000000",
  "complete": true
}

Then, we can decode it once more, to double check everything, mainly related to fees, if we didn't know, what to put there before:

Code:
decoderawtransaction 0200000000010138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff0125310000000000002321023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac02473044022073798fe1171b029d20a3f4a1646acc12124b6d365700cd6ac0863fe4c6624d9f02204e9169296522dff46815a5e50b4e55cce47699f6d60b31ff696a4de5d8dbfd95012103aafc2a07508a54c90be4d844569f9746f5d247d153b1784e93277410cf5bd50a00000000
{
  "txid": "04863e19ccf833b7d0e68f6e2173466cf97325ad1da3ba9d980c6ba05b25ede1",
  "hash": "3733cc23d8cf95965832032dede4ad2527874299040bd26d40736d559d23dd18",
  "version": 2,
  "size": 204,
  "vsize": 123,
  "weight": 489,
  "locktime": 0,
  "vin": [
    {
      "txid": "a8a552f75b4aad4a1eee859ed9babf0d3347ef49593c1d551c74ebd989795938",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "3044022073798fe1171b029d20a3f4a1646acc12124b6d365700cd6ac0863fe4c6624d9f02204e9169296522dff46815a5e50b4e55cce47699f6d60b31ff696a4de5d8dbfd9501",
        "03aafc2a07508a54c90be4d844569f9746f5d247d153b1784e93277410cf5bd50a"
      ],
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 0.00012581,
      "n": 0,
      "scriptPubKey": {
        "asm": "023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e OP_CHECKSIG",
        "desc": "pk(023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293e)#24ru67fk",
        "hex": "21023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac",
        "type": "pubkey"
      }
    }
  ]
}

As we can see, our "vsize" is 123, which means if we want to send our transaction with one satoshi per virtual byte fee, then we can subtract 123 satoshis from our output. As I said previously, usually I put the full amount first, then create and sign my transaction, then read the amount of virtual bytes, and then do it once more with a proper fee. And, as you can see, this "txid" and "hash" matches exactly with what you can see in testnet.

See and compare: https://mempool.space/testnet/api/tx/04863e19ccf833b7d0e68f6e2173466cf97325ad1da3ba9d980c6ba05b25ede1/hex
Code:
0200000000010138597989d9eb741c551d3c5949ef47330dbfbad99e85ee1e4aad4a5bf752a5a80100000000fdffffff0125310000000000002321023216db7a4dfc8b0926c608162a81828e06622000a4d2c34e87ac1de8c9cc293eac02473044022073798fe1171b029d20a3f4a1646acc12124b6d365700cd6ac0863fe4c6624d9f02204e9169296522dff46815a5e50b4e55cce47699f6d60b31ff696a4de5d8dbfd95012103aafc2a07508a54c90be4d844569f9746f5d247d153b1784e93277410cf5bd50a00000000

Quote
2. How would I claim the unspent transition to "only" a public key - in practice?
Spending from P2PK is similar, you just use different "scriptPubKey" when you specify, what should be signed, and put "2321...ac", instead of putting the script related to other address types. Then, the Core client will sign it, and you can broadcast it directly from your node, or by using any online tool, for example this one: https://live.blockcypher.com/btc-testnet/pushtx/

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
BTCW (OP)
Copper Member
Full Member
***
Offline Offline

Activity: 193
Merit: 234

Click "+Merit" top-right corner


View Profile
September 04, 2023, 03:14:48 PM
 #7

1. How would I send to the public key (NOT the public address) - in practice?
By using the software bech32p2pkaddress, which takes as input a public key and builds a raw transaction wherein you spend UTXOs and create new P2PK UTXOs. You can read how it works in this medium article, asides from the Github repo.

2. How would I claim the unspent transition to "only" a public key - in practice?
As you can see from the software above, there is no script needed to spend the P2PK output. Bitcoin Core will normally allow you to spend the P2PK output if you give the private key in WIF and the TXID.

And that I, in that case, would need to author (there are decent online tools) the transaction manually. Yes, no?
There are definitely more software to try out. According to this SE post, python-bitcoinlib does provide the utilities to create and spend P2PK.

Formidable! Much obliged. Looking forward to sharing a tx id, one that blockchain explorers will struggle to parse, and - nerdy mission accomplished Smiley

SendBTC.me <<< amazing imitative
BTCW (OP)
Copper Member
Full Member
***
Offline Offline

Activity: 193
Merit: 234

Click "+Merit" top-right corner


View Profile
September 05, 2023, 12:16:36 AM
 #8

Dang. Finder keepers - check out this tx on testnet (confirmation was FAST)

https://bitpay.com/insight/BTC/testnet/tx/24cd5df1dcbc1139054c36c989bae4d8a2e992111a112c3f6b31ab309689ed4d

1 tBTC sent to the uncompressed private key, NOT public address, first entry. #wholecoiner

I love that the blockchain explorer (Insnight) doesn't know what to think of it, or parse it right, and just says, "Unparsed address."

Difficult to follow the (play)money!

Take it! Keys are in the OP. Only one condition: That you immediately come bach here and write here how you did it. Very detailed, such as: did you use a wallet software or entirely manual or using some online tool to help assembling a complex tx or did you, finally, just do it in notepad and broadcast it at the nearest outlet?

If you feel extra kind, send all or at least the majority back to 2N2EJxoRy5hRE74aV4NDiC22dcH3QEqzf5G

Win-win!

SendBTC.me <<< amazing imitative
vjudeu
Hero Member
*****
Offline Offline

Activity: 663
Merit: 1527



View Profile
September 05, 2023, 04:46:11 AM
Merited by o_e_l_e_o (4), pooya87 (3), ABCbits (3)
 #9

Quote
1 tBTC sent to the uncompressed private key, NOT public address, first entry. #wholecoiner
Wrong. It was sent to "always true stack push", not protected by any key. It can be spent without any signatures, as I just demonstrated. If you paste your transaction into Bitcoin Core, it will tell you this output is "nonstandard". I told you to avoid that, if you don't know, what are you doing:

Code:
decoderawtransaction //put transaction data here
{
  "txid": "24cd5df1dcbc1139054c36c989bae4d8a2e992111a112c3f6b31ab309689ed4d",
  "hash": "f0a5a70eb2bc04dc7fa2d07a1309570993183a9404387496f1702d4ec2299e8d",
  "version": 2,
  "size": 2855,
  "vsize": 1570,
  "weight": 6278,
  "locktime": 2476301,
  "vin": // does not matter
  "vout": [
    {
      "value": 1.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "04038a7f3eb49c316d94e228ffb155113a0897e40f1f04f0878559fd8b7b37d8270ff752c2cd7e479c4c4844286fc6d924e578217d0354b97c42afe1f74c472e15",
        "desc": "raw(4104038a7f3eb49c316d94e228ffb155113a0897e40f1f04f0878559fd8b7b37d8270ff752c2cd7e479c4c4844286fc6d924e578217d0354b97c42afe1f74c472e15)#msm46cdn",
        "hex": "4104038a7f3eb49c316d94e228ffb155113a0897e40f1f04f0878559fd8b7b37d8270ff752c2cd7e479c4c4844286fc6d924e578217d0354b97c42afe1f74c472e15",
        "type": "nonstandard"
      }
    },
    {
      "value": 50.56155600,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_HASH160 628cde58e1bcd42efb72b1821ec9fdf49e0f1d49 OP_EQUAL",
        "desc": "addr(2N2EJxoRy5hRE74aV4NDiC22dcH3QEqzf5G)#492dkst6",
        "hex": "a914628cde58e1bcd42efb72b1821ec9fdf49e0f1d4987",
        "address": "2N2EJxoRy5hRE74aV4NDiC22dcH3QEqzf5G",
        "type": "scripthash"
      }
    }
  ]
}

You are lucky that you tried all of that on test network first. On main network, it would be non-standard of course, but if some miner would accept your transaction anyway, then that miner could sweep your 1 BTC, without any signatures. So, be careful!

Quote
I love that the blockchain explorer (Insnight) doesn't know what to think of it, or parse it right, and just says, "Unparsed address."
This is not a mistake, they are 100% right. It is not P2PK, and as it was shown, it can be moved without any signatures. It is just because of the missing OP_CHECKSIG.

Quote
Take it! Keys are in the OP.
I took it without signatures, so it is probably not what you intended. That means, I will give you another chance, to learn about P2PK, and do it correctly. Those are testnet coins anyway, so you can take them back, and move into P2PK, as you planned.

Quote
Only one condition: That you immediately come bach here and write here how you did it.
I just created a transaction, without signing anything.

Code:
getnewaddress
tb1qdjnnvlg9k674f9zarujthkz32ne4asxexnptz4

createrawtransaction "[{\"txid\":\"24cd5df1dcbc1139054c36c989bae4d8a2e992111a112c3f6b31ab309689ed4d\",\"vout\":0}]" "[{\"tb1qdjnnvlg9k674f9zarujthkz32ne4asxexnptz4\":0.99990000}]" 0 true

02000000014ded899630ab316b3f2c111a1192e9a2d8e4ba89c9364c053911bcdcf15dcd240000000000fdffffff01f0b9f505000000001600146ca7367d05b6bd54945d1f24bbd85154f35ec0d900000000

As you can see, I didn't need to sign it. That output matches exactly, what was broadcasted: https://mempool.space/testnet/api/tx/a38c3bbe14df0e10af990b3393635abdfa0b20622c22fdab92333ead0b89c252/hex

Quote
If you feel extra kind, send all or at least the majority back to 2N2EJxoRy5hRE74aV4NDiC22dcH3QEqzf5G
I sent you my key. You can try to move coins from tb1qdjnnvlg9k674f9zarujthkz32ne4asxexnptz4, and try again using P2PK correctly.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
NotATether
Legendary
*
Offline Offline

Activity: 1582
Merit: 6688


bitcoincleanup.com / bitmixlist.org


View Profile WWW
September 05, 2023, 06:19:44 AM
 #10

Quote
1 tBTC sent to the uncompressed private key, NOT public address, first entry. #wholecoiner
Wrong. It was sent to "always true stack push", not protected by any key. It can be spent without any signatures, as I just demonstrated. If you paste your transaction into Bitcoin Core, it will tell you this output is "nonstandard". I told you to avoid that, if you don't know, what are you doing:

Code:
~

You are lucky that you tried all of that on test network first. On main network, it would be non-standard of course, but if some miner would accept your transaction anyway, then that miner could sweep your 1 BTC, without any signatures. So, be careful!

For P2PK we can just a simple script with the contents "OP_PUSHDATA (32 bytes of public key) OP_EQUALVERIFY", and that would be enough to require a valid signature, right?

It's not too difficult to translate this into asm hex that you can paste into the raw transaction, though I guess you'd want to make a raw transaction sending to some random P2PKH address first and then replace the P2PKH output with this manually.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
vjudeu
Hero Member
*****
Offline Offline

Activity: 663
Merit: 1527



View Profile
September 05, 2023, 06:58:18 AM
Merited by nc50lc (1), NotATether (1)
 #11

Quote
For P2PK we can just a simple script with the contents "OP_PUSHDATA (32 bytes of public key) OP_EQUALVERIFY", and that would be enough to require a valid signature, right?
No. What was missing, was simply OP_CHECKSIG at the end. In your example, also no signatures are needed, just pushing "OP_TRUE <publicKey>" will do the trick. And that OP_TRUE is needed only because you used OP_EQUALVERIFY, instead of OP_EQUAL, which means that boolean will be consumed by your script, so it should be unnecessarily added inside input to make it spendable.

Quote
It's not too difficult to translate this into asm hex that you can paste into the raw transaction, though I guess you'd want to make a raw transaction sending to some random P2PKH address first and then replace the P2PKH output with this manually.
It doesn't matter, what exactly is replaced. You can send it to OP_RETURN as well, and then replace it. Also, "decoderawtransaction" and "decodescript" are your friends, and will tell you, if your script is standard or not. And to be absolutely sure, you can try it on regtest first, before touching even testnet, and locally confirm, that your transaction is standard, and will be picked by your own node, when broadcasted.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
nc50lc
Legendary
*
Offline Offline

Activity: 2394
Merit: 5539


Self-proclaimed Genius


View Profile
September 05, 2023, 01:55:26 PM
 #12

Quote
2. How would I claim the unspent transition to "only" a public key - in practice?
Spending from P2PK is similar, you just use different "scriptPubKey" when you specify, what should be signed, and put "2321...ac", instead of putting the script related to other address types. Then, the Core client will sign it, and you can broadcast it directly from your node, or by using any online tool, for example this one: https://live.blockcypher.com/btc-testnet/pushtx/
Alternatively, he can dedicate a blank descriptor wallet and import a "pk" descriptor containing the public key's private key pair.
Then, Bitcoin Core will be able to conveniently spend P2PK outputs for that pubKey with wallet commands or GUI.

Example import command with P2PK descriptor:
Code:
importdescriptors "[{\"desc\": \"pk(cPagNCmYNqoA4bwoB8nvdvqJ8ArMqHMPyNnGe5yZNFUVwSFVuPUR)#2qfdl8ra\",\"timestamp\": \"now\",\"label\": \"p2pk\"}]"

My only concern in this is the misleading GUI elements which shows an address in the 'receiving addresses' and in the 'inputs' list (as well in "listunspent" command)

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
vjudeu
Hero Member
*****
Offline Offline

Activity: 663
Merit: 1527



View Profile
October 02, 2023, 05:45:54 AM
 #13

Be careful with non-standard transactions. I told you. You tried using P2PK again, and created some always-true-stack-push. Again. Maybe you should use Bitcoin Core, or at least some better block explorer, like mempool.space, to see, what is really P2PK, and what is simply non-standard? Also, I guess bitpay.com cannot show you OP_RETURN, and cannot even tell you, that it is unspendable.

I thought about simply sending you all of those coins back. But I guess, in this way, you will not learn anything, and repeat the same mistakes. So, this time I will send you those coins, but this time with a locktime, and with some OP_CHECKSIG, to show you, what is missing.

Which means, you have two options:

1. Wait, and broadcast my transaction, after locktime will expire.
2. Use P2PK correctly, and get your coins faster than this locktime.

I send you my key again, and I hope you will do that correctly this time.

Also, I include that timelocked transaction publicly, to prove that all of the above is true:
Code:
decoderawtransaction 020000000100226040cba610aa5a422e06e4f310a2410710592922fe289e19496d605af89401000000484730440220671bd861ffd607ac59a4fc928aabdabde87bc9aa59788abcb3ad4a21224660ac02201588b333a4c574c9039a0534987ee32f3f0b7bef67307d3d1274a1d09bcf495283fdffffff01000e27070000000017a914628cde58e1bcd42efb72b1821ec9fdf49e0f1d498700f15365
{
  "txid": "cd8ad764c3c83a67ff5f04cbac1bfab93654bc387f8d1ab35e8c0e1e38cbed43",
  "hash": "cd8ad764c3c83a67ff5f04cbac1bfab93654bc387f8d1ab35e8c0e1e38cbed43",
  "version": 2,
  "size": 155,
  "vsize": 155,
  "weight": 620,
  "locktime": 1700000000,
  "vin": [
    {
      "txid": "94f85a606d49199e28fe222959100741a210f3e4062e425aaa10a6cb40602200",
      "vout": 1,
      "scriptSig": {
        "asm": "30440220671bd861ffd607ac59a4fc928aabdabde87bc9aa59788abcb3ad4a21224660ac02201588b333a4c574c9039a0534987ee32f3f0b7bef67307d3d1274a1d09bcf4952[SINGLE|ANYONECANPAY]",
        "hex": "4730440220671bd861ffd607ac59a4fc928aabdabde87bc9aa59788abcb3ad4a21224660ac02201588b333a4c574c9039a0534987ee32f3f0b7bef67307d3d1274a1d09bcf495283"
      },
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 1.20000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 628cde58e1bcd42efb72b1821ec9fdf49e0f1d49 OP_EQUAL",
        "desc": "addr(2N2EJxoRy5hRE74aV4NDiC22dcH3QEqzf5G)#492dkst6",
        "hex": "a914628cde58e1bcd42efb72b1821ec9fdf49e0f1d4987",
        "address": "2N2EJxoRy5hRE74aV4NDiC22dcH3QEqzf5G",
        "type": "scripthash"
      }
    }
  ]
}
Also, the funny thing is that some block explorers even accept that transaction with this locktime. But of course, they cannot make it valid, before reaching unix time 17,0000,0000: https://live.blockcypher.com/btc-testnet/tx/cd8ad764c3c83a67ff5f04cbac1bfab93654bc387f8d1ab35e8c0e1e38cbed43/

And then, after few hours, they drop it, after being unconfirmed for a long time, but you can always rebroadcast it again: https://live.blockcypher.com/btc-testnet/pushtx/

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!