I want to use "getblock" msg to get someone block information.
That should work fine as long as you know the block hash.
If you only know the block index, then you'll need to run getblockhash first.
but the tx information in block only don't contain the tx hash,
Yes, it does.
getblock returns the block header and a list of all the transaction hashes of all the transactions in the block.
the hash in tx is the previous transaction hash.
I think you are mistaken. The list of transactions hashes provided by getblock are the hashes of the transactions that are included in that block.
So, how can I get the current hash code of the block?
If you are using getblock, then you already have the hash of the current block. If you don't have the hash of the block then you'll need to know the index (the height of the block). Then you can use getblockhash. If you don't know the index or the hash, then how do you know which block you want to get?
Then, in blockchain(link:www.blockchain.info), each transaction contain the in and out bitcoin address, can I get these addresses in block?
Once you have the transaction hash, you can get the details of the transaction with getrawtransaction (if you have txindex=1 in your bitcoin.conf)
The transaction outputs will have the address (if any) as well as the scriptPubKey so you can handle transaction outputs that do not have addresses.
The transaction inputs will have the index of the output and the transaction hash that identifies the output that is being spent. You can use getrawtransaction on that transaction hash and look at the indicated output to find the address (if any) as well as the scriptPubKey so you can handle transaction outputs that do not have addresses.
Thank your answer, according your answer, i get what i want.
i have other question,
memkleblock: i know , when i send "getdata" message to node, and node maybe reply the "memkleblock". but , i don't know how to set inv data struct in "getdata" message,
1, type, I set 2 or 3? 2 means MSG_BLOCK, 3 means MSG_FILTERED_BLOCK;
2, hash, I set block hash or memkle hash?
the whole stage of "memkleblock" as follow:
"?" -> "inv"-> "getdata"->"memkleblock".
when start, what message should I send to node?
Thank you !