Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAnybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I am writing a program that reads Bitcoin transactions from .blk
files and performs some analysis on them. I would like to get the transaction destination addresses (like in some transaction explorers: link.
Raw transaction data looks like this and I don't see any address fields anywhere.
How is it possible to calculate it? Is there a (preferably C/C++) program that already does that? Or are there any details on how to implement this?
Best regards and thanks for all answers in advance! :)
Raw transaction data looks like this and I don't see any address fields anywhere.
That's because transactions don't directly involve addresses. An address is an abstraction of a Bitcoin-script used in a transaction. An address is a way for a payee to externally communicate to a payer enough information for the payer to construct an output entry for a new transaction.
are there any details on how to implement this?
See for example https://learnmeabitcoin.com/technical/p2pkh
So for a pay-to-public-key-hash (P2PKH) address you:
- Calculate a Hash160 (SHA256 + RIPEMD160) of the public key
- Prefix that hash with 0x00
- Suffix with a checksum (first four bytes of a SHA256 hash of other data)
- Encode in Base58
You'd need to separately handle address formation for every standard type of Bitcoin-script. Some don't have a standard way to derive an address.
You can get bonuses upto $100 FREE BONUS when you:
๐ฐ Install these recommended apps:
๐ฒ SocialGood - 100% Crypto Back on Everyday Shopping
๐ฒ xPortal - The DeFi For The Next Billion
๐ฒ CryptoTab Browser - Lightweight, fast, and ready to mine!
๐ฐ Register on these recommended exchanges:
๐ก Binance๐ก Bitfinex๐ก Bitmart๐ก Bittrex๐ก Bitget
๐ก CoinEx๐ก Crypto.com๐ก Gate.io๐ก Huobi๐ก Kucoin.
Comments