user133335: I have been trying to import a public key into my bitcoin[1] node, but it keeps saying that it isn't valid.
The address '18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E' publishes front-pages of the New York times into the BSV ledger and I want to add its public key to my bitcoin server so I can see new UTXOs. The key must be in HEX, per the command.

bitcoin-cli validateaddress 18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E

{
"isvalid": true,
"address": "18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E",
"scriptPubKey": "76a91456aea08d8feaefb18222fcef953366da2a7f200588ac",
"ismine": false,
"iswatchonly": false,
"isscript": false
}

bitcoin-cli importpubkey 76a91456aea08d8feaefb18222fcef953366da2a7f200588ac
error code: -5
error message:
Pubkey is not a valid public key

It accepts that I have sent hex, but it doesn't like it. This is clearly more than just the public key, I can see that from a vout:
"asm": "OP_DUP OP_HASH160 56aea08d8feaefb18222fcef953366da2a7f2005 OP_EQUALVERIFY # OP_CHECKSIG",
So maybe it wants me to remove the OP_DUP, OP_HASH160 and OP_EQUALVERIFY:

bitcoin-cli importpubkey 56aea08d8feaefb18222fcef953366da2a7f2005
Pubkey is not a valid public key

Hmm? Maybe it wants the checksum at the end...

echo 18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E | base58 -d | xxd -p
0056aea08d8feaefb18222fcef953366da2a7f200559461147
bitcoin-cli importpubkey 0056aea08d8feaefb18222fcef953366da2a7f200559461147
error code: -5
error message:
Pubkey is not a valid public key

I them write a bigendian reversal script and tried it, didn't help either.
I am official stumped.
Thanks in advance.
[1] I currently run bitcoin.sv and digibyte and have the same problem on both.

user208: importpubkey imports a public key, not a scriptPubKey.
A public key in this context is a 66 character hexadecimal string starting with 02 or 03, or a 130 character hexadecimal string starting with 04. It encodes a secp256k1 public key. A scriptPubKey is any hexadecimal string, and encodes a locking script. These are distinct things; you can't use one in place of the other.
In this case, it appears you want to import an address. You can do so directly using importaddress.

133335: <p>I have been trying to import a public key into my bitcoin[1] node, but it keeps saying that it isn't valid.</p>
<p>The address '18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E' publishes front-pages of the New York times into the BSV ledger and I want to add its public key to my bitcoin server so I can see new UTXOs. The key must be in HEX, per the command.</p>
<blockquote>
<p>bitcoin-cli validateaddress 18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E</p>
</blockquote>
<p>{
&quot;isvalid&quot;: true,
&quot;address&quot;: &quot;18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E&quot;,
&quot;scriptPubKey&quot;: &quot;76a91456aea08d8feaefb18222fcef953366da2a7f200588ac&quot;,
&quot;ismine&quot;: false,
&quot;iswatchonly&quot;: false,
&quot;isscript&quot;: false
}</p>
<blockquote>
<p>bitcoin-cli importpubkey 76a91456aea08d8feaefb18222fcef953366da2a7f200588ac
error code: -5
error message:
Pubkey is not a valid public key</p>
</blockquote>
<p>It accepts that I have sent hex, but it doesn't like it. This is clearly more than just the public key, I can see that from a vout:</p>
<p>&quot;asm&quot;: &quot;OP_DUP OP_HASH160 56aea08d8feaefb18222fcef953366da2a7f2005 OP_EQUALVERIFY # OP_CHECKSIG&quot;,</p>
<p>So maybe it wants me to remove the OP_DUP, OP_HASH160 and OP_EQUALVERIFY:</p>
<blockquote>
<p>bitcoin-cli importpubkey 56aea08d8feaefb18222fcef953366da2a7f2005
Pubkey is not a valid public key</p>
</blockquote>
<p>Hmm? Maybe it wants the checksum at the end...</p>
<blockquote>
<p>echo 18uLJohita1yWTAcDpoLPpd2vNAtnsLW4E | base58 -d | xxd -p
0056aea08d8feaefb18222fcef953366da2a7f200559461147
bitcoin-cli importpubkey 0056aea08d8feaefb18222fcef953366da2a7f200559461147
error code: -5
error message:
Pubkey is not a valid public key</p>
</blockquote>
<p>I them write a bigendian reversal script and tried it, didn't help either.</p>
<p>I am official stumped.</p>
<p>Thanks in advance.</p>
<p>[1] I currently run bitcoin.sv and digibyte and have the same problem on both.</p>
 208: <p><code>importpubkey</code> imports a public key, not a scriptPubKey.</p>
<p>A public key in this context is a 66 character hexadecimal string starting with 02 or 03, or a 130 character hexadecimal string starting with 04. It encodes a secp256k1 public key. A scriptPubKey is any hexadecimal string, and encodes a locking script. These are distinct things; you can't use one in place of the other.</p>
<p>In this case, it appears you want to import an address. You can do so directly using <code>importaddress</code>.</p>
