openoms / joininbox

A terminal based graphical menu for JoinMarket
MIT License
153 stars 20 forks source link

Scan and display Joinamrket coinjoins with `snicker-finder.py -j` #47

Closed openoms closed 3 years ago

openoms commented 3 years ago

info:

$ python snicker/snicker-finder.py -h
Usage: snicker-finder.py [options] startingblock [endingblock]                      

Find SNICKER candidate transactions on the blockchain.  Using a connection to                                                                                                                                     
Bitcoin Core, which allows retrieving full blocks, this script will list the                               
transaction IDs of transactions that fit the pattern of SNICKER, as codified        
in https://gist.github.com/AdamISZ/2c13fb5819bd469ca318156e2cf25d79 and as          
checked in the `jmbitcoin.snicker` module function `is_snicker_tx`, and also                                                                            
optionally, transactions that fit the pattern of Joinmarket coinjoins (see                                                                              
-j).  Pass a starting and finishing block value as argument. If the finishing       
block is not provided, it is assumed to be the latest block.  **Note that this      
is slow.**  This script does *NOT* require a wallet, but it does require a                                                                              
connection to Core, so does not work with `no-blockchain`. Note that this                                                                               
script obviates the need to have txindex enabled in Bitcoin Core in order to                                                                                                                                      
get full transactions, since it parses the raw blocks.                              

Options:                                                                                                                                                
  -h, --help            show this help message and exit                                                                                     
  --datadir=DATADIR     Specify the path to a directory you want to use to                                                                                                                                        
                        store your userdata - wallets, logs and commitment
                        files - and your joinmarket.cfg. By default, the                                                                                                                                          
                        directory .joinmarket is used.                                                                                                  
  --recoversync         choose to do detailed wallet sync, used for recovering                                                                          
                        on new Core instance.                                                                                                           
  --wallet-password-stdin                                                           
                        Read wallet password from stdin                                                                                                 
  --version             Print JoinMarket version and exit.                                                                                              
  -f CANDIDATE_FILE_NAME, --filename=CANDIDATE_FILE_NAME                                                                                                
                        filename to write details of candidate transactions,                                                                            
                        default ./candidates.txt                                                                                                        
  -j, --include-jm      scan for Joinmarket coinjoin outputs, as well as                                                                                
                        SNICKER.                                

Example for the last 5 blocks:

$ BLOCKSTOSCAN=5
$ BLOCKHEIGHT=$(sudo -u bitcoin bitcoin-cli getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
$ python snicker/snicker-finder.py -j $((BLOCKHEIGHT - BLOCKSTOSCAN))

User data location: /home/joinmarket/.joinmarket/
2021-04-29 12:51:24,529 [INFO]  Finished processing block: 681082
2021-04-29 12:51:56,587 [INFO]  Finished processing block: 681083
2021-04-29 12:51:56,589 [WARNING]  Connection had broken pipe, attempting reconnect.
2021-04-29 12:52:31,581 [INFO]  Finished processing block: 681084
2021-04-29 12:52:31,582 [WARNING]  Connection had broken pipe, attempting reconnect.
2021-04-29 12:52:44,525 [INFO]  Found Joinmarket coinjoin transaction: 943b1f52d9c3e83de3c704c8d6b9d9eb39a169c8c4ebbfc9abdf4b6b00a32c02 in block: 681085
2021-04-29 12:53:10,783 [INFO]  Finished processing block: 681085
2021-04-29 12:53:43,872 [INFO]  Finished processing block: 681086
2021-04-29 12:53:43,874 [WARNING]  Connection had broken pipe, attempting reconnect.
2021-04-29 12:54:21,269 [INFO]  Finished processing block: 681087
done

``