Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing overidentification of p2ms by moving the case statement below p2wpkh, p2wsh, p2tr. #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ count,txid,vout,amount,type,address

## Install

First of all, you need to have a full copy of the blockchain. You also need to install LevelDB:
First of all, you need to have a full copy of the blockchain, which you can get from installing and running bitcoind.

```
sudo apt install bitcoind
```

You also need to install LevelDB to run this program:

```
sudo apt install libleveldb-dev
```

Expand All @@ -66,6 +71,15 @@ This will start dumping all of the UTXO database to a file called `utxodump.csv`

**NOTE:** LevelDB wasn't designed to be accessed by multiple programs at the same time, so make sure `bitcoind` isn't running before you start (`bitcoin-cli stop` should do it).

## Build

If you prefer to build and run locally, clone the repo and build with Go:

```
$ git clone https://github.com/in3rsha/bitcoin-utxo-dump.git
$ cd bitcoin-utxo-dump
$ go build .
```

## Usage

Expand Down
10 changes: 5 additions & 5 deletions utxodump.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,6 @@ func main() {
}
}

// P2MS
case len(script) > 0 && script[len(script)-1] == 174: // if there is a script and if the last opcode is OP_CHECKMULTISIG (174) (0xae)
scriptType = "p2ms"
scriptTypeCount["p2ms"] += 1

// P2WPKH
case nsize == 28 && script[0] == 0 && script[1] == 20: // P2WPKH (script type is 28, which means length of script is 22 bytes)
// 315,c016e8dcc608c638196ca97572e04c6c52ccb03a35824185572fe50215b80000,0,551005,3118,0,28,001427dab16cca30628d395ccd2ae417dc1fe8dfa03e
Expand Down Expand Up @@ -516,6 +511,11 @@ func main() {
scriptType = "p2tr"
scriptTypeCount["p2tr"] += 1

// P2MS
case len(script) > 0 && script[len(script)-1] == 174: // if there is a script and if the last opcode is OP_CHECKMULTISIG (174) (0xae)
scriptType = "p2ms"
scriptTypeCount["p2ms"] += 1

// Non-Standard (if the script type hasn't been identified and set then it remains as an unknown "non-standard" script)
default:
scriptType = "non-standard"
Expand Down