Public key for address ‘’ not published in blockchain

When I try to publish I’m getting the error


Public key for address ‘mqGf3q3TmSo1HbLium8tgqbxpdFpkXybyN’ not published in blockchain.

Here is the command I’m trying to execute:

counterpartyd publish --source ‘mqGf3q3TmSo1HbLium8tgqbxpdFpkXybyN’ --gasprice 1 --startgas 1000000 --endowment 0 --code-hex '6127103355603c806010600039604c5660003560001a6000811415603a57600135604052602135606052335460605113151560395760605160405154016040515560605133540333555b5b505b6000f3’

I was able to get the pubkey for my address using validateaddress, however I’m not sure what the next steps are to add “023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe” to my counterpartyd.

I feel like there is a simple connection here I’m missing, any help would be appreciated.

@calum, see:

https://github.com/CounterpartyXCP/counterpartyd/issues/589
https://github.com/CounterpartyXCP/counterpartyd/releases/tag/v9.49.3

On Windows it’s in here and it’s similar on Linux:
c:\counterpartyd_build\dist\counterpartyd\counterparty-cli.py
If the CLI doesn’t work, update your code or get the deps.
https://github.com/CounterpartyXCP/counterpartyd_build/issues/171


@something

Thanks for the quick reply Something.  I managed to progress a bit further, I wasn’t familiar with the cli and apparently that’s what I needed to be using.  Indeed the cli didn’t work due to missing dependencies.


I’m getting a new error that I’m not to sure about:

./counterparty-cli.py \
–data-dir ~/.config/counterpartyd \
publish \
–source ‘mqGf3q3TmSo1HbLium8tgqbxpdFpkXybyN’ \
–gasprice 1 \
–startgas 1000000 \
–endowment 0 \
–code-hex '6127103355603c806010600039604c5660003560001a6000811415603a57600135604052602135606052335460605113151560395760605160405154016040515560605133540333555b5b505b6000f3’

Transaction (unsigned): 0100000002d79b646dfdf2aa164c0e068720596424639535858f56d69978c51512105b49c2000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088acffffffff6c54ab73831351f49054ff3b0c8fc93271fa9b7b4dc95ce153aa2fa9e27ac7ec000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088acffffffff04771e00000000000069512103a9c3fe6b1aad0cef9b5af170b06c9c4373f4a67887979892b219429d9b2cc58b21037d6c3184e1800c9d2ad1ef0cc602331d52c3c311842f076d830070f67f2b668521023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e00000000000069512102a9c3fe6b1aad0cef9b4ee410ee3bfc424694e62ae6b6adf2d24b7e8bbb4c946c21026e7924e4d8d70dda6b82fa3dae83334d63969a11994a336e85352bb74f70876621023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e000000000000695121039ec3fe6b1aad0cef9b5a0270d46c9c4373f4a67886979892b2194ddfdb2cc5ce21027d6c3184e1806dba3ae2ba6cfa82530d32c3fa71c879676db66070ec1f2be7dd21023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae010b7d01000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088ac00000000
Sign and broadcast? (y/N) y
Traceback (most recent call last):
  File “./counterparty-cli.py”, line 943, in
    args.op_return_value}, args.unsigned)
  File “./counterparty-cli.py”, line 223, in cli
    if backend.is_mine(proxy, source):
NameError: name ‘source’ is not defined

Also, it seemed like I had to specify my configuration file using ‘–data-dir ~/.config/counterpartyd’ and I thought that seemed odd.  If I don’t do that I get all sorts of errors ranging from ‘AttributeError: ‘module’ object has no attribute ‘user_config_dir’’ to ‘backend RPC password not set.’ Does it indicate that my configuration file isn’t in the default location?

I’d try “–source ADDRESS” without quoting the address, just put it there as-is, but I’m not sure since I haven’t tried that myself.


Also, it seemed like I had to specify my configuration file using ‘–data-dir ~/.config/counterpartyd’ and I thought that seemed odd. 

Haha, yeah that’s weird and annoying. I still haven’t had time to figure that out myself, so:
a) I use the extremely long CLI (I pass all variables allthough that shouldn’t be the case)
b) it seems unavoidable, at least on Fed Node, since there’s no shell for the XCP user, I would think
and
c) You could (I guess) install counterpartyd for the user you’re running this CLI stuff as, and then maybe you could just run it without passing all the variables to every line (you’d have to create your own config files, by copying them from the XCP user). I think this could be a good approach for Fed Node users. 
Or write a simple shell wrapper (Bash, Python, whatever) to get these vars and pass them in the full form to the CLI (I’ve started doing this for commands that I often use, like tailing the logs and so on).

Edit: to answer the question, I think that doesn’t indicate your config filel’s in the wrong location, but I can’t tell for sure because I don’t actually know where it is. The default loco is .config/counterpartyd[-testnet]/counterpartyd.[testnet.]conf, but if you’re running a Fed Node then you don’t have it installed, so that’s why.
See how to impersonate the XCP user here (in case you run a Fed Node):
http://support.counterparty.io/support/solutions/articles/5000505729-counterparty-federated-node-and-counterpartyd-with-bitcoin-qt-and-addrindex-patch

I tried the command without quoting the address, looks like it created the same unsigned raw transaction as it did previously, but I still get the name “NameError: name ‘source’ is not defined” error that I got previously.

Out of curiosity I tried sending the raw transaction that is being created from the command by hand through bitcoind:

> signrawtransaction '0100000002d79b646dfdf2aa164c0e068720596424639535858f56d69978c51512105b49c2000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088acffffffff6c54ab73831351f49054ff3b0c8fc93271fa9b7b4dc95ce153aa2fa9e27ac7ec000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088acffffffff04771e00000000000069512103a9c3fe6b1aad0cef9b5af170b06c9c4373f4a67887979892b219429d9b2cc58b21037d6c3184e1800c9d2ad1ef0cc602331d52c3c311842f076d830070f67f2b668521023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e00000000000069512102a9c3fe6b1aad0cef9b4ee410ee3bfc424694e62ae6b6adf2d24b7e8bbb4c946c21026e7924e4d8d70dda6b82fa3dae83334d63969a11994a336e85352bb74f70876621023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e000000000000695121039ec3fe6b1aad0cef9b5a0270d46c9c4373f4a67886979892b2194ddfdb2cc5ce21027d6c3184e1806dba3ae2ba6cfa82530d32c3fa71c879676db66070ec1f2be7dd21023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae010b7d01000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088ac00000000' '[{"txid":"c2495b101215c57899d6568f853595632464592087060e4c16aaf2fd6d649bd7","vout":0,"scriptPubKey":"76a9146afd09ec01a573d87e85176aa228f404c8456c9088ac"}]' '["cVm5LkEeagLMcyAyFUSzfnS3t3QCKk1DjtHs9SvXtm1queZ3U1on"]'


{

"hex" : "0100000002d79b646dfdf2aa164c0e068720596424639535858f56d69978c51512105b49c2000000006b483045022100fb7c42a6c358c039190147a5a956571321c2a8842532ad95bc0fccec7cc8ff830220447c09288b9a3e954076182824582a89f44b826d4c1e718273aea3255156fe110121023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefeffffffff6c54ab73831351f49054ff3b0c8fc93271fa9b7b4dc95ce153aa2fa9e27ac7ec000000006a47304402204ebfd6847e1180f46bb9630dcd1d8ae50b671ca2c21b825da190e206d8dbea8002200958778b9086cad2a0292aaca20742db7c2eaced5d80b692ad3eed514fc51f8d0121023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefeffffffff04771e00000000000069512103a9c3fe6b1aad0cef9b5af170b06c9c4373f4a67887979892b219429d9b2cc58b21037d6c3184e1800c9d2ad1ef0cc602331d52c3c311842f076d830070f67f2b668521023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e00000000000069512102a9c3fe6b1aad0cef9b4ee410ee3bfc424694e62ae6b6adf2d24b7e8bbb4c946c21026e7924e4d8d70dda6b82fa3dae83334d63969a11994a336e85352bb74f70876621023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e000000000000695121039ec3fe6b1aad0cef9b5a0270d46c9c4373f4a67886979892b2194ddfdb2cc5ce21027d6c3184e1806dba3ae2ba6cfa82530d32c3fa71c879676db66070ec1f2be7dd21023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae010b7d01000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088ac00000000",

"complete" : true

}

> sendrawtransaction 0100000002d79b646dfdf2aa164c0e068720596424639535858f56d69978c51512105b49c2000000006b483045022100fb7c42a6c358c039190147a5a956571321c2a8842532ad95bc0fccec7cc8ff830220447c09288b9a3e954076182824582a89f44b826d4c1e718273aea3255156fe110121023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefeffffffff6c54ab73831351f49054ff3b0c8fc93271fa9b7b4dc95ce153aa2fa9e27ac7ec000000006a47304402204ebfd6847e1180f46bb9630dcd1d8ae50b671ca2c21b825da190e206d8dbea8002200958778b9086cad2a0292aaca20742db7c2eaced5d80b692ad3eed514fc51f8d0121023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefeffffffff04771e00000000000069512103a9c3fe6b1aad0cef9b5af170b06c9c4373f4a67887979892b219429d9b2cc58b21037d6c3184e1800c9d2ad1ef0cc602331d52c3c311842f076d830070f67f2b668521023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e00000000000069512102a9c3fe6b1aad0cef9b4ee410ee3bfc424694e62ae6b6adf2d24b7e8bbb4c946c21026e7924e4d8d70dda6b82fa3dae83334d63969a11994a336e85352bb74f70876621023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae771e000000000000695121039ec3fe6b1aad0cef9b5a0270d46c9c4373f4a67886979892b2194ddfdb2cc5ce21027d6c3184e1806dba3ae2ba6cfa82530d32c3fa71c879676db66070ec1f2be7dd21023dee07a5e6cc9c74f9d72d006dcbce00ac1ecf72347dc816ff570bc0f97ebefe53ae010b7d01000000001976a9146afd09ec01a573d87e85176aa228f404c8456c9088ac00000000


72a547ea55293f6f915bfa740ffd2c715435316167b9b7c2da9b5684ccf853cb


It looks like it sent without complaint, so somewhere I have something missconfigured with counterpartyd or counterparty.cli


Edit: fixed some formating

I’ll try to figure this out tomorrow.


The API doc is moving to the Official Wiki and I edited it there, hopefully correctly.
https://github.com/CounterpartyXCP/OfficialWiki/wiki/counterpartyd-API

Testnet is now having issues, see https://github.com/CounterpartyXCP/counterpartyd/issues/615, maybe that’s impacting your work too.

@Calum The missing dependencies for the cli is a known issue, there was an issue opened for it at github by rippler . I am not sure if this was already fixed though

@mtbitcoin: very helpful


I listed my list of pip3 modules that got my CLI to work:
For Windows:
https://github.com/CounterpartyXCP/counterpartyd_build/issues/171#issuecomment-68515101
For Linux: 
https://github.com/CounterpartyXCP/counterpartyd_build/issues/175

I think the issue is fixed if you clone the latest bitcoind_build scripts and then update.
If you merely update the code from Github (setup.py update or similar on Fed Node), that doesn’t update the installer which is where the problem was.
On a stand-alone counterpartyd node I just nuke my installs and install from scratch, because it only takes 2-3 mins anyway.

@something I cloned the latest counterpartyd_build and then ran ./setup.py update.  After doing that I noticed your comment was to actually clone the latest bitcoind_build, I just wanted to double check which one needed updating.


Also, I’m fairly new to Linux and was wondering if when you say “I just nuke my installs” it’s as simple as blowing away my counterpartyd_build directory?

@calum


Yes, because counterpartyd_build isn’t supposed to contain user-specific persistent data, I just delete it and re-run setup.py.
That’s not much slower than “setup.py update”. I used the word clone because after you delete it you need to run “git clone source target” to redownload the source from Github.

On Fed Node I don’t do that (because it builds bitcoin core, Nginx and other stuff from source) - there I run setup_federated_node.py => (U)pdate from Git. It’s possible to “manually” run “git clone” to check out specific updates of various components (rather than use one global “branch” value), but I’ve never tried that and because Fed Node is more difficult to troubleshoot I use the built-in update procedure.