Skip to content

Task for a bitcoin educational cohort. Goal is to build a simplified bitcoin wallet to find funds, build and transmit transactions on a signet.

Notifications You must be signed in to change notification settings

vinteumorg/task-signet-wallet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Signet Wallet Project

The goal of this project is to write a simple wallet over two weeks and use it to interact with a custom signet network provided by the administrator.

Simplify

To reduce the scope of this project the wallet will be very limited:

  • No separate change addresses: one descriptor is used for all internal and external addressees.
  • No VarInt: all vectors will be under 255 bytes in length and always require one single byte to indicate length.
  • All sending and receiving addresses will be p2wpkh
    • Except one p2wsh multisig which is the goal of the week 2 assignment
  • Fees can be hard-coded by value, no estimation is necessary.
  • Transactions you create will always have exactly 1 input and 2 outputs.
  • Don't worry about invalid keys (probabilty is less than 1 in 2127)
  • Other constants:
    • All transactions will be version 2 (little-endian encoded as \x02\x00\x00\x00)
    • All input sequences will be 0xffffffff
    • All transaction locktimes will be 0x00000000
    • All input scriptSigs will be 0x00 (because we are only concerned with segregated witness inputs)
    • All sighash flags will be SIGHASH_ALL which is 0x01 in signatures and little-endian encoded as \x01\x00\x00\x00 in transaction commitments

Custom Signet

We will pre-fabricate a signet blockchain and host a mining node that everyone can connect to, download the chain (around 20 MB), and broadcast their completed transactions. We will have already generated private key descriptors for each student and used them to generate hundreds of transactions sending and receiving in the chain. Each student will be provided with a single wpkh descriptor with an extended private key like this example:

wallet_000: wpkh(tprv8ZgxMBicQKsPekvUvQEdWuFnTazwP6QwU15RJCTAEUaUn9ti3NEtywCywj1PF4G2MzvTad4F3MSSZvT2nZuxHBJ9HaZad5r1dYJtzYsR9iW/84h/1h/0h/0/*)#3ajpxxju

The important elements here are the extended private key (tprv...) and the derivation path (84h/1h/0h/0/*).

Note: If you have already connected to the "default" (or any other) signet network with your node, you may need to rename / move your existing data directory. See #27494

A bitcoin.conf file will be provided to students in config/bitcoin.conf which will set the address of the mining node as well as provide the signet challenge. Copy this file to your system's default datadir location and start Bitcoin Core:

bitcoind -signet

You should also then be able to execute RPCs with (for example):

bitcoin-cli -signet getblockcount

Task 1 (keys and addresses)

See Recover Balance coding challenge

Task 2 (transactions, scripts, and signatures)

See Send Multisig coding challenge

About

Task for a bitcoin educational cohort. Goal is to build a simplified bitcoin wallet to find funds, build and transmit transactions on a signet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 51.9%
  • Python 42.9%
  • Shell 5.2%