| submitted by /u/KeyserSozze
If I have the bitcoin address, the private key and a transaction ID from Bitcoin (
regtest mode) in shell variables, what Python code do I need to run to claim the Bitcoins are indeed intended for this private key?
I have been following this excellent article – Bitcoins the hard way : Using the raw Bitcoin protocol. I hope to replicate this with Bitcoin in regtest mode as part of a larger design.
To begin with, I had to ensure that the code mentioned in the article (available here) can generate Bitcoin address with
n as the prefix and uses
111 as the network ID. See here. I made the following code changes to generate addresses for
def pubKeyToAddr(s): ripemd160 = hashlib.new('ripemd160') ripemd160.update(hashlib.sha256(s.decode('hex')).digest()) return utils.base58CheckEncode(111, ripemd160.digest())
def base58CheckEncode(version, payload): s = chr(version) + payload checksum = hashlib.sha256(hashlib.sha256(s).digest()).digest()[0:4] result = s + checksum leadingZeros = countLeadingChars(result, '') return 'm' * leadingZeros + base58encode(base256decode(result))
bitcoin-qt, I transferred some BTC to an address generated from above. The transfer goes through and is confirmed when a new block is created.
However, I am unable to see the amount credited to this new address with the
getreceivedbyaddress command. I am running this command in the Debug Window console (for some reason,
bitcoin-cli wouldn’t connect even after configuring
bitcoind). I think, the reason could be the fact that, the private key and the bitcoin address was generated elsewhere from command line rather than the default
--data-dir location that
bitcoin-qt used when it was launched. I understand this.
Called Chase FORTY SEVEN FUCKING TIMES this week. Was told this would not happen anymore after talking to multiple supervisors in six different departments. Then they shut down everything, no notice, no contact. On hold for an hour, they can't help me, won't even tell me why. Transferred Bitcoin into my pocket securely & instantly in two clicks for pennies. This is why Bitcoin is & will continue to shove their fucking shit in. It's seven fucking degrees outside where do they expect me to sleep. Thank god for Expedia accepting BTC directly.