Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack-tx Operation Failing Due to Address Compatibility #1

Open
moodmosaic opened this issue Aug 19, 2024 · 2 comments · May be fixed by #2
Open

stack-tx Operation Failing Due to Address Compatibility #1

moodmosaic opened this issue Aug 19, 2024 · 2 comments · May be fixed by #2

Comments

@moodmosaic
Copy link

The stack-tx operation in the naka3.sh script consistently fails (in make_stacking_tx) with the following error:

stack stackity stack-stack-stack
Only support testnet p2pkh

I think, the failure occurs because the provided PoX address has a version byte of 8d (instead of 6f?)

Binary Versions:

blockstack-cli
  develop (09c4b066e25104be8b066e8f7530ff0c6df4ccd5)

stacks-signer
  develop (09c4b066e25104be8b066e8f7530ff0c6df4ccd5)

stacks-node
  develop (09c4b066e25104be8b066e8f7530ff0c6df4ccd5)

bitcoind
  25.0.0

bitcoin-cli
  25.0.0

jq
  1.6.0

dc
  1.4.1

/cc @wileyj

@wileyj
Copy link

wileyj commented Aug 19, 2024

with a test script, it seems to work fine:

addr=mkcL5EbpxqYtf1VHtrmBKgJ5aTfMttduUG #https://github.com/jcnelson/naka3.sh/blob/db72d0a536f30d1c85e935a33fbb2cd046a6234f/config.sh#L30
function b58_decode() {
   local base58_chars="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxy"
   local b58text="$1"
   if [[ "$b58text" =~ ^(1*)([$base58_chars]+)$ ]]; then
      dc -e "${BASH_REMATCH[1]//1/0P} 0${base58_chars//?/ds&1+} 0${BASH_REMATCH[2]//?/ 58*l&+}P" | hex_encode
   else
      return 1
   fi
}
function hex_encode() {
   od -An -v -tx1 | tr -d ' \n'
}
function b58_address_decode() {
   local addr="$1"
   b58_decode "$addr" | sed -r 's/^([0-9a-f]{2})([0-9a-f]{40}).+$/\1 \2#/g' | tr '#' '\n'
}
b58_decode "$addr" | sed -r 's/^([0-9a-f]{2})([0-9a-f]{40}).+$/\1 \2#/g' | tr '#' '\n'
pox_address=$addr
address_parts="$(b58_address_decode "$pox_address")"
address_version="$(echo "$address_parts" | cut -d ' ' -f 1)"

echo "address_parts: $address_parts"
echo "address_version: $address_version"

if [ "$address_version" != "6f" ]; then
    echo "Only support testnet p2pkh"
fi
$ bash t
6f 37dce38faf7956918d6bd3c026cc8a628246dedc
address_parts: 6f 37dce38faf7956918d6bd3c026cc8a628246dedc
address_version: 6f

can this be reproduced? I'm wondering if a variable is getting overwritten somewhere maybe

@wileyj
Copy link

wileyj commented Aug 19, 2024

update: this seems to be a version difference between linux's GNU dc and what macos is using.

let's keep this open for now, it would be nice to find a solution that works for both, but we're unblocked by only running on linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants