I have been following this guide: https://freedomnode.com/blog/58/generate-bitcoin-wallet-addresses-from-extended-public-key-with-php
to try and derive legacy bitcoin addresses from an xpub key from my electrum wallet which using the bitwasp classes as specified in the guide. With the latest repository changes, it seems to have broken this method of generation somehow and there are comments with the exact error i am getting on the guide article but no solutions anywhere. this is my error:
Fatal error: Uncaught InvalidArgumentException: Invalid fingerprint for BIP32 key, must be in range [0 - (231)-1] inclusive
after looking at where this error is thrown in: vendor\bitwasp\bitcoin\src\Key\Deterministic\HierarchicalKey.php (Line 82)
if ($parentFingerprint < 0 || $parentFingerprint > IntRange::U32_MAX) { throw new \InvalidArgumentException('Invalid fingerprint for BIP32 key, must be in range [0 - (2^31)-1] inclusive'); }
$parentFingerprint is 0 when I echo it but i do not know how any of these classes work enough to debug it.
Can anyone follow this guide and see if they can replicate my issue please? I used the exact sample code provided for xpub keys.
Full stack trace:
Fatal error: Uncaught InvalidArgumentException: Invalid fingerprint for BIP32 key, must be in range [0 - (2^31)-1] inclusive in [path_redacted]\vendor\bitwasp\bitcoin\src\Key\Deterministic\HierarchicalKey.php:82 Stack trace: #0 [path_redacted]\vendor\bitwasp\bitcoin\src\Serializer\Key\HierarchicalKey\ExtendedKeySerializer.php(147): BitWasp\Bitcoin\Key\Deterministic\HierarchicalKey->__construct(Object(BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Adapter\EcAdapter), Object(BitWasp\Bitcoin\Key\KeyToScript\Factory\P2pkhScriptDataFactory), 0, 0, 0, Object(BitWasp\Buffertools\Buffer), Object(BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PublicKey)) #1 [path_redacted]\vendor\bitwasp\bitcoin\src\Serializer\Key\HierarchicalKey\ExtendedKeySerializer.php(159): BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\ExtendedKeySerializer->fromParser(Object(BitWasp\Bitcoin\Network\Networks\Bitcoin), Object(BitWasp\Bufferto in [path_redacted]\vendor\bitwasp\bitcoin\src\Key\Deterministic\HierarchicalKey.php on line 82
Thank you for any knowledge that can be share for this!
No comments:
Post a Comment