Open jolestar opened 2 months ago
Maybe I can have a try on this one?
@jolestar Hi, I’ve just started looking into this issue and wanted to clarify. When you mentioned “auto-generate new block,” did you mean that after the client requests to broadcast a transaction, it should then send an additional request to generate a new block?
If that’s the case, could you provide some guidance on where the logic for packaging transactions into a block is implemented? That would help me get started, thanks!
The bitcoin cli generates a new block via a command; it should be an RPC request.
bitcoin-cli generatetoaddress 1 <address>
https://github.com/rooch-network/rooch/tree/main/scripts/bitcoin
Make this TBD after discussing it with @wfnuser.
Proposal Details
On the Bitcoin regtest network, developers need to manually trigger a new block via the
bitcoin-cli generatetoaddress
command.Some examples are in the document Bitcoin local development environment and test cases in bitseed and bitcoin.
We can auto-generate a new block when broadcasting Bitcoin tx via RPC
https://github.com/rooch-network/rooch/blob/2d65e2e06cadca20616da0a040829a95a1b93355/crates/rooch-rpc-api/src/api/btc_api.rs#L39-L46
Note: this only available for Roch local network and Bitcoin regtest network.