webworker01 / komodophp

A library for working with Komodo addresses and keys and interfacing with full nodes and electrumx servers
https://packagist.org/packages/webworker01/komodophp
GNU General Public License v3.0
2 stars 2 forks source link

manage KMD or BTC addresses #9

Closed melaxon closed 4 years ago

melaxon commented 4 years ago

I replaced blockchain.address.get_balance to blockchain.scripthash.get_balance to comply with new protocol methods, but: 1) The hash must be a string while the object is returned by AddressCreator (otherwise error is returned by server):

BitWasp\Bitcoin\Address\PayToPubKeyHashAddress Object
(
    [hash:protected] => BitWasp\Buffertools\Buffer Object
        (
            [size] => 20
            [buffer] => 0xcebb2851a9c7cfe2582c12ecaf7f3ff4383d1dc0
        )

)

not sure how to get the buffer (protected property) without modifying BitWasp\Buffertools\Buffer class

2) Based on https://electrumx.readthedocs.io/en/latest/protocol-basics.html#script-hashes This hash must be SHA256 of P2PKH that is quite different than the value in the buffer