Wiki Home
Convert a script to its address
Convert a script
to its address (Main network)
$ echo 001499b73fb792d603bc6ef16664c9f39a8f850fd189 | dotnet fsi script2addr.fsx
bc1qnxmnlduj6cpmcmh3vejvnuu637zsl5vf5se8z9
Convert all scripts in a
file
$ cat CoinJoinScriptStore.txt | dotnet fsi script2addr.fsx > CoinJoinAddresses.txt
Code
#r "nuget:NBitcoin"
open System
open NBitcoin
fun _ -> Console.ReadLine()
|> Seq.initInfinite
|> Seq.takeWhile ((<>) null)
|> Seq.map Script.FromHex
|> Seq.map (fun s -> s.GetDestinationAddress(Network.Main))
|> Seq.iter Console.WriteLine