-
-
Save stevenroose/de1cdd183b1d3b9a6e5a5623a4ca969a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"os" | |
"github.com/btcsuite/btcutil/base58" | |
) | |
func main() { | |
addressFile, err := os.Open("addresses.txt") | |
if err != nil { | |
log.Fatal(err) | |
} | |
addresses := bufio.NewScanner(addressFile) | |
outputFile, err := os.OpenFile("ripemd160.txt", os.O_RDWR|os.O_CREATE, 0755) | |
if err != nil { | |
log.Fatal(err) | |
} | |
for addresses.Scan() { | |
address := addresses.Text() | |
ripemd160, _, err := base58.CheckDecode(address) | |
if err != nil { | |
fmt.Printf("Failed to decode address %s: %s\n", address, err) | |
continue | |
} | |
result := fmt.Printf("%s: %x\n", address, ripemd160) | |
_, err := outputFile.WriteString(result) | |
if err != nil { | |
log.Fatalf("Error writing to file: %s", err) | |
} | |
} | |
if err := outputFile.Close(); err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/addresses.go:32:10: assignment mismatch: 1 variable but fmt.Printf returns 2 values
./addresses.go:33:10: no new variables on left side of :=