--- Log opened Sat Dec 02 00:00:43 2023 00:08 < yancy> cguida Rust-bitcoin isn't intended for that. Rust-bitcoin is a crate useful for building Bitcoin applications. 00:51 -!- cguida [~cguida@2806:2f0:55e1:f7b9:cde3:707d:5cbd:158d] has quit [Ping timeout: 250 seconds] 02:19 -!- Guest7282 [~nex8192@156.195-129-109.adsl-dyn.isp.belgacom.be] has joined #bitcoin-rust 04:57 -!- b10c[m] [~b10cb10cm@2620:6e:a000:ce11::1c] has joined #bitcoin-rust 04:57 < b10c[m]> cguida: you might want to use https://docs.rs/bitcoincore-rpc/latest/bitcoincore_rpc/ although that crate's development is somewhat stuck right now 05:33 -!- Guest7282 [~nex8192@156.195-129-109.adsl-dyn.isp.belgacom.be] has left #bitcoin-rust [Error from remote client] 05:48 -!- Guest7282 [~nex8192@156.195-129-109.adsl-dyn.isp.belgacom.be] has joined #bitcoin-rust 06:16 -!- Guest7282 [~nex8192@156.195-129-109.adsl-dyn.isp.belgacom.be] has left #bitcoin-rust [Error from remote client] 06:34 -!- Guest7282 [~nex8192@156.195-129-109.adsl-dyn.isp.belgacom.be] has joined #bitcoin-rust 12:22 -!- cguida [~cguida@2806:103e:19:277e:b389:31f8:3c06:fb74] has joined #bitcoin-rust 12:24 < cguida> My understanding is that rust-bitcoin takes a block from the wire and deserializes it into a `Block` struct. My question is, how can I get the height of a block, using the bitcoin RPC? surely there are applications that have used the block height before?? 12:25 < cguida> I went offline for a bit, perhaps i missed some messages? I'm only seeing the one from yancy 12:34 < vincenzopalazzo> cguida, it is not very active this channel 12:35 < vincenzopalazzo> cguida, Do you want get the height from a block hash? 12:36 < cguida> Yes exactly 12:37 < vincenzopalazzo> ok get block should do it https://developer.bitcoin.org/reference/rpc/getblock.html 12:37 < vincenzopalazzo> if there is no heigh in the `struct Block` this is a bug 12:38 < cguida> There isn't https://docs.rs/bitcoin/latest/bitcoin/blockdata/block/struct.Block.html 12:38 < vincenzopalazzo> also in the recent API is present https://bitcoincore.org/en/doc/25.0.0/rpc/blockchain/getblock/ so I think this is a bug 12:38 -!- ksedgwic[m] [~ksedgwicm@2620:6e:a000:ce11::1d] has joined #bitcoin-rust 12:38 < ksedgwic[m]> Is it possible that there is an associated "BlockHeader" and the height is there? 12:39 < cguida> it's just a Header (which also doesn't include the height) 12:39 < ksedgwic[m]> hmm, looking ... 12:39 < cguida> ksedgwic[m] no, the Header also doesn't contain the height https://docs.rs/bitcoin/latest/bitcoin/blockdata/block/struct.Header.html 12:39 < cguida> ksedgwic no, the Header also doesn't contain the height https://docs.rs/bitcoin/latest/bitcoin/blockdata/block/struct.Header.html 12:40 < cguida> whoops, can't figure out how to tag you Ken haha 12:40 < vincenzopalazzo> yeah, to work around it you can use `call("getblock", [])` and deserialize the object in your struct 12:41 < vincenzopalazzo> Ah wait 12:41 < vincenzopalazzo> you are looking in the wrong docs :) because the code is there https://github.com/rust-bitcoin/rust-bitcoincore-rpc/blob/1b51e3d0bb614d36d256947f55d228ac0e1dc58f/json/src/lib.rs#L202 12:42 < ksedgwic[m]> What is bip34_block_height? 12:43 < ksedgwic[m]> I think that is upgrade related ... nm 12:44 < cguida> bip34_block_height appears to resolve a height from the block, but I'm unsure if this is unambiguous. I'm trying to add the scanblocks RPC to BDK's RPC backend (to speed it up) and LLFourn from BDK suggests that this may not be unambiguous 12:44 < cguida> vincenzopalazzo ahhh cool! 12:45 * ksedgwic[m] sent a code block: https://matrix.bitcoin.ninja/_matrix/media/v3/download/bitcoin.ninja/BLqTCEYuHkVLGKKIhHDSByhQ 12:46 < cguida> ok so if i catch the rpc call upstream of serializing into a block, I can use the `GetBlockResult` struct instead 12:47 < cguida> ksedgwic[m] thanks, I guess version 1 blocks maybe don't support this? 12:49 < ksedgwic[m]> > Block number 227,835 (timestamp 2013-03-24 15:49:13 GMT) was the last version 1 block. 12:49 < ksedgwic[m]> from https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki 12:59 < cguida> ok cool, thanks ksedgwic! I wonder if bip34_block_height is inaccurate before then... 13:03 < ksedgwic[m]> More info from Pieter https://bitcoin.stackexchange.com/questions/48188/is-it-possible-to-decode-block-height-from-a-blockhash 13:04 < ksedgwic[m]> TIL that the height is not in the header or block (other then encoded by BIP34) 13:21 < cguida> Haha yeah this was also recent news to me! it's in the coinbase and originally wasn't even there! 13:22 < cguida> "So, if you want to know a block's height for sure, you need to request at least its coinbase transaction, the Merkle path from the coinbase to the root, and the full block header. If they all match, you can be pretty sure." 13:22 < cguida> Guessing this is what bip34_block_height does ^ 15:02 -!- cguida [~cguida@2806:103e:19:277e:b389:31f8:3c06:fb74] has quit [Ping timeout: 250 seconds] 16:19 -!- pablomartin [~pablomart@193.160.246.216] has joined #bitcoin-rust 16:23 -!- b42 [~mmilata@b42.cz] has quit [Quit: WeeChat 3.7.1] 16:35 -!- pablomartin [~pablomart@193.160.246.216] has quit [Ping timeout: 276 seconds] 21:12 -!- pablomartin [~pablomart@193.160.246.226] has joined #bitcoin-rust 21:23 -!- pablomartin [~pablomart@193.160.246.226] has quit [Ping timeout: 255 seconds] 23:16 -!- DeanGuss [~dean@user/deanguss] has quit [Ping timeout: 245 seconds] 23:16 -!- DeanGuss [~dean@nonplayercharacter.me] has joined #bitcoin-rust 23:16 -!- DeanGuss [~dean@user/deanguss] has changed host --- Log closed Sun Dec 03 00:00:44 2023