Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitcoin] Auto generate new block when broadcast Bitcoin tx in local network #2651

Open
jolestar opened this issue Sep 19, 2024 · 3 comments
Assignees
Labels
area::bitcoin area:rpc RPC relative issues help wanted Extra attention is needed proposal New external API or other notable changes skill::rust Need the rust language skill to complete the issue
Milestone

Comments

@jolestar
Copy link
Contributor

jolestar commented Sep 19, 2024

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

/// Broadcast a Bitcoin transaction
#[method(name = "broadcastTX")]
async fn broadcast_tx(
&self,
hex: BytesView,
maxfeerate: Option<f64>,
maxburnamount: Option<f64>,
) -> RpcResult<String>;

Note: this only available for Roch local network and Bitcoin regtest network.

@jolestar jolestar added area:rpc RPC relative issues area::bitcoin proposal New external API or other notable changes labels Sep 19, 2024
@jolestar jolestar added this to the Rooch v0.9 milestone Sep 19, 2024
@jolestar jolestar added help wanted Extra attention is needed skill::rust Need the rust language skill to complete the issue labels Sep 19, 2024
@wfnuser
Copy link

wfnuser commented Oct 18, 2024

Maybe I can have a try on this one?

@wfnuser
Copy link

wfnuser commented Oct 25, 2024

@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!

@jolestar
Copy link
Contributor Author

jolestar commented Oct 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area::bitcoin area:rpc RPC relative issues help wanted Extra attention is needed proposal New external API or other notable changes skill::rust Need the rust language skill to complete the issue
Projects
Status: No status
Development

No branches or pull requests

2 participants