Skip to content

Add mining example and CI step#18

Closed
Copilot wants to merge 5 commits intomasterfrom
copilot/add-examples-to-crate
Closed

Add mining example and CI step#18
Copilot wants to merge 5 commits intomasterfrom
copilot/add-examples-to-crate

Conversation

Copy link

Copilot AI commented Mar 11, 2026

Adds a runnable example to help newcomers get started with the crate, as suggested in the issue discussion.

  • examples/mining.rs — Demonstrates the full Mining IPC workflow: Unix socket connection, bootstrap, chain queries (isTestChain, isInitialBlockDownload, getTip), block template creation and inspection (header, fees, coinbase, merkle path), waitNext with timeout, interruptWait, and cleanup
  • .github/workflows/ci.yml — Runs the example after the test suite
cargo run --example mining
Original prompt

This section details on the original issue you should resolve

<issue_title>add examples</issue_title>
<issue_description>I feel this was quite useful to help me get started with this crate

https://github.com/rustaceanrob/bitcoin-ipc/blob/mining/example/mining.rs</issue_description>

<agent_instructions>Let's add a small number of simple examples inspired by the tests.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@Sjors Do you think that's still useful now that we have test coverage? @plebhash what inspired me to create this issue was trying to explain this crate to @johnnyasantoss

since he's coming at this with fresh eyes, maybe he can check the examples vs tests and weigh in?</comment_new>
<comment_new>@rustaceanrob
FWIW I always look in the examples folder when using a new crate. Even if just duplication from the test suite, I think it would be nice to have a standard example.</comment_new>
<comment_new>@Sjors
Sounds reasonable.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits March 11, 2026 12:49
Co-authored-by: Sjors <10217+Sjors@users.noreply.github.com>
Co-authored-by: Sjors <10217+Sjors@users.noreply.github.com>
Co-authored-by: Sjors <10217+Sjors@users.noreply.github.com>
Co-authored-by: Sjors <10217+Sjors@users.noreply.github.com>
Copilot AI changed the title [WIP] Add examples inspired by existing tests Add mining example and CI step Mar 11, 2026
@Sjors
Copy link
Collaborator

Sjors commented Mar 11, 2026

@copilot please squash the commits

Note to others: let's wait for #14 so we can expand the example to show what happens when the mempool changes and waitNext() returns

Copy link
Author

Copilot AI commented Mar 11, 2026

@copilot please squash the commits

Note to others: let's wait for #14 so we can expand the example to show what happens when the mempool changes and waitNext() returns

I can’t force-push from this environment, so I wasn’t able to rewrite the branch into a single commit. The current tip is 0c4aa6b; please use GitHub’s squash-and-merge at merge time, or have a maintainer force-push a squashed commit if you want the branch history flattened before then.

@Sjors Sjors closed this Mar 11, 2026
@Sjors Sjors mentioned this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add examples

2 participants