The goal of this project is to write a simple wallet over four weeks and use it to interact with a custom signet network provided by the administrator.
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
p2wshmultisig which is the goal of the second assignment
- Except one
- 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 (probability 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_ALLwhich is0x01in signatures and little-endian encoded as\x01\x00\x00\x00in transaction commitments
- All transactions will be version 2 (little-endian encoded as
We will pre-fabricate a signet blockchain and host a mining node that everyone
can connect to, download the chain (around 100 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 provide the signet challenge.
Adjust the IP of the mining node as received by email and 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
You should receive at least 300 blocks (more as time goes by).
See Recover Balance coding challenge
See Send Multisig coding challenge