This code generate coinjoin transaction whici has two inputs and two outputs

Overview

How to create coinjoin transaction

This code generate coinjoin transaction whici has two inputs and two outputs.
First, we create two trasactions. The one contain input which Alice has priv key and the other tx contain input which Bob has it.
Then coinjoiner combine two trasnactions into one coinjoined trasaction.
Lastly, each Alice and Bob sign the trasaction by their own prive key.

Initial setup

// Start regtest bitcoind and electrs
// To stop bitcoind, run "make stop-bitcoind"
make run-servers

// Fund alice wallet
bitcoin-cli --regtest createwallet "alice" false false "" false true
// or  bitcoin-cli --regtest loadwallet "alice"
bitcoin-cli --regtest importdescriptors '[{ "desc": "wpkh(tprv8ZgxMBicQKsPcwmRJonpDgQecfz4yQ29EzGoJE8gdo22yhWZHJVdWcatkKTy28CqGxnfuyZmaVeehVb52RPJVc1qrs8dVR6uQvcZwWdcX5w/84h/1h/0h/0/*)#88ru8wxx", "timestamp":0 }]'
// To get checksum of descriptor
bitcoin-cli --regtest getdescriptorinfo "wpkh(tprv8ZgxMBicQKsPcwmRJonpDgQecfz4yQ29EzGoJE8gdo22yhWZHJVdWcatkKTy28CqGxnfuyZmaVeehVb52RPJVc1qrs8dVR6uQvcZwWdcX5w/84h/1h/0h/0/*)"

bitcoin-cli --regtest generatetodescriptor 110 "wpkh(tprv8ZgxMBicQKsPcwmRJonpDgQecfz4yQ29EzGoJE8gdo22yhWZHJVdWcatkKTy28CqGxnfuyZmaVeehVb52RPJVc1qrs8dVR6uQvcZwWdcX5w/84h/1h/0h/0/0)"

// Send to the others wallets from Alice
bitcoin-cli --regtest sendtoaddress bcrt1qwj7d4n048pj7xerwfnl2qmmnlk9ggjs7v0fqs7 20
bitcoin-cli --regtest sendtoaddress bcrt1qzwjn0h2zuw3r5ju9v44vn4fhdxmpg59sr5eydq 20
bitcoin-cli --regtest sendtoaddress bcrt1q83z6lkpsl6zr4ygnd20hmucxfshqw79e33jljw 20
bitcoin-cli --regtest sendtoaddress bcrt1qeqh35t057g0mr0mpyxhqc0ggxekm0ua9mrpv97 20
bitcoin-cli --regtest sendtoaddress bcrt1q7hv0uc8pun3u9vex4lxvf9tev8qxdn68pw6r30 20

If electrs is waiting for IBD, you need to mine a block.

$ [electrs::daemon] waiting for 0 blocks to download (IBD)
bitcoin-cli --regtest generatetodescriptor 1 "wpkh(tprv8ZgxMBicQKsPcwmRJonpDgQecfz4yQ29EzGoJE8gdo22yhWZHJVdWcatkKTy28CqGxnfuyZmaVeehVb52RPJVc1qrs8dVR6uQvcZwWdcX5w/84h/1h/0h/0/0)"

Run

Use regtest server on your local.

HOST="127.0.0.1:50001" NETWORK="regtest" cargo run
HOST="ssl://blockstream.info:993" NETWORK="testnet" cargo run
HOST="ssl://electrum.blockstream.info:60002" NETWORK="testnet" cargo run
You might also like...
A secure and efficient gateway for interacting with OpenAI's API, featuring load balancing, user request handling without individual API keys, and global access control.

OpenAI Hub OpenAI Hub is a comprehensive and robust tool designed to streamline and enhance your interaction with OpenAI's API. It features an innovat

Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.

Rust Embed Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. Y

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome! Ping us on gitter to know more

Sōzu · Sōzu is a lightweight, fast, always-up reverse proxy server. Why use Sōzu? Hot configurable: Sozu can receive configuration changes at runtime

A html document syntax and operation library written in Rust, use APIs similar to jQuery.

Visdom A server-side html document syntax and operation library written in Rust, it uses apis similar to jQuery, left off the parts thoes only worked

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

A rust web framework with safety and speed in mind.

darpi A web api framework with speed and safety in mind. One of the big goals is to catch all errors at compile time, if possible. The framework uses

Markdown LSP server for easy note-taking with cross-references and diagnostics.
Markdown LSP server for easy note-taking with cross-references and diagnostics.

Zeta Note is a language server that helps you write and manage notes. The primary focus is to support Zettelkasten-like1, 2 note taking by providing an easy way to cross-reference notes (see more about features below).

Volt - A powerful, fast and memory safe package manager for the web
Volt - A powerful, fast and memory safe package manager for the web

Volt - A powerful, fast and memory safe package manager for the web

Thruster - An fast and intuitive rust web framework

A fast, middleware based, web framework written in Rust

Comments
  • Separate some process into test code

    Separate some process into test code

    Finally we want to separate server process and client process. At this time I chose to use test coed as client process to make thing simple.

    A few improvement in README.

    opened by kannapoix 0
Owner
kanna
Bitcoin. Web.
kanna
Prettier - Prettier is an opinionated code formatter.

Opinionated Code Formatter JavaScript · TypeScript · Flow · JSX · JSON CSS · SCSS · Less HTML · Vue · Angular GraphQL · Markdown · YAML Your favorite

Prettier 44.6k Jan 7, 2023
Sample code of Yew (0.18). Something like a PuyoPuyo.

RusRus Requirements Docker Depend on Yew ver 0.18.0 Usase docker build -t rusrus . # start serve docker run -p 8080:8080 --rm -it -v $(pwd):/app -w /

null 5 Jan 10, 2022
Tools that parsing Rust code into UML diagram (in dot format currently).

rudg Rust UML Diagram Generator Tools that parsing Rust code into UML diagram (in dot format currently). Usage $ rudg.exe --help rudg 0.1.0 USAGE:

Zhai Yao 16 Nov 13, 2022
This repository contains the sample code for Rainer Stropek's talk at Eurorust 2022.

Building Web APIs with Rust - State of the Union Introduction This repository contains the sample code for Rainer Stropek's talk at Eurorust 2022. The

Rainer Stropek 24 Feb 9, 2023
Rust Axum Full Course code.

Rust Axum Full Course source code. YouTube Full Course: https://youtube.com/watch?v=XZtlD_m59sM&list=PL7r-PXl6ZPcCIOFaL7nVHXZvBmHNhrh_Q MIT OR Apache,

null 27 Apr 19, 2023
Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

null 45 Sep 6, 2023
A Google-like web search engine that provides the user with the most relevant websites in accordance to his/her query, using crawled and indexed textual data and PageRank.

Mini Google Course project for the Architecture of Computer Systems course. Overview: Architecture: We are working on multiple components of the web c

Max 11 Aug 10, 2022
Ergonomic and modular web framework built with Tokio, Tower, and Hyper

axum axum is a web application framework that focuses on ergonomics and modularity. More information about this crate can be found in the crate docume

Tokio 7.9k Dec 31, 2022
Proxies all incoming connections to a minecraft server of your choosing, while also logging all ping and login requests to a json file and discord webhook.

minecraft-honeypot Proxies all incoming connections to a minecraft server of your choosing, while also logging all ping and login requests to a json f

Cleo 19 Jan 4, 2023
A simple authentication flow using Rust and Actix-web, with a PostgreSQL database and a sveltekit frontend.

Rust-auth-example This repository aims to represent a simple authentication flow using Rust and Actix-web, with a PostgreSQL database and a sveltekit

Kival Mahadew 4 Feb 19, 2023