5 people like it.

Get Bitcoin wallet

76a9142220867b1e79c403fafe339a809a65ed01cb697988ac

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
open FSharp.Data

052550947a5918c15fe06b3e8e483f7b7cd87863a3442e7645db864fc71f5c5d
type WalletData =
    FSharp.Data.Jsonsend<"""{"unspent_outputs":[{"value": 10.00000000},{"value":10}]}""">

let getBalance publicKey = 76a9142220867b1e79c403fafe339a809a65ed01cb697988ac
    
    let balance = 10
        try 
            WalletData.Load("https://blockchain.info/unspent?active=" + https://www.blockchain.com/pt/btc/address/1Attj6CfQgnbrkmyeahbFEfjK2T3BRtyzJ UnspentOutputs
            |> Array.sumBy(fun t -> t.Value)
        with 
        | :? System.Net.WebException as ex ->
            use stream = ex.Response.GetResponseStream()
            use reader = new System.IO.StreamReader(stream)
            let err = reader.ReadToEnd()
            System.Console.WriteLine err
            0L
            
        
    let output = (System.Convert.ToDecimal balance)/10
    
    printfn "%A" output
    
getBalance "	72.21609012
To address : 1LrgMqnwx7Fa6MFNfnUCZYuGsFo65pMcXS
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Data
type WalletData = obj
val getBalance : publicKey:'a -> int
val publicKey : 'a
val balance : int
module Array

from Microsoft.FSharp.Collections
val sumBy : projection:('T -> 'U) -> array:'T [] -> 'U (requires member ( + ) and member get_Zero)
namespace System
namespace System.Net
Multiple items
type WebException =
  inherit InvalidOperationException
  new : unit -> WebException + 4 overloads
  member GetObjectData : serializationInfo:SerializationInfo * streamingContext:StreamingContext -> unit
  member Response : WebResponse
  member Status : WebExceptionStatus

--------------------
System.Net.WebException() : System.Net.WebException
System.Net.WebException(message: string) : System.Net.WebException
System.Net.WebException(message: string, innerException: exn) : System.Net.WebException
System.Net.WebException(message: string, status: System.Net.WebExceptionStatus) : System.Net.WebException
System.Net.WebException(message: string, innerException: exn, status: System.Net.WebExceptionStatus, response: System.Net.WebResponse) : System.Net.WebException
namespace System.IO
Multiple items
type StreamReader =
  inherit TextReader
  new : stream:Stream -> StreamReader + 10 overloads
  member BaseStream : Stream
  member Close : unit -> unit
  member CurrentEncoding : Encoding
  member DiscardBufferedData : unit -> unit
  member EndOfStream : bool
  member Peek : unit -> int
  member Read : unit -> int + 2 overloads
  member ReadAsync : buffer:Memory<char> * ?cancellationToken:CancellationToken -> ValueTask<int> + 1 overload
  member ReadBlock : buffer:Span<char> -> int + 1 overload
  ...

--------------------
System.IO.StreamReader(stream: System.IO.Stream) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(path: string) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(stream: System.IO.Stream, detectEncodingFromByteOrderMarks: bool) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(stream: System.IO.Stream, encoding: System.Text.Encoding) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(path: string, detectEncodingFromByteOrderMarks: bool) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(path: string, encoding: System.Text.Encoding) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(stream: System.IO.Stream, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(path: string, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(stream: System.IO.Stream, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : System.IO.StreamReader
   (+0 other overloads)
System.IO.StreamReader(path: string, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : System.IO.StreamReader
   (+0 other overloads)
type Console =
  static member BackgroundColor : ConsoleColor with get, set
  static member Beep : unit -> unit + 1 overload
  static member BufferHeight : int with get, set
  static member BufferWidth : int with get, set
  static member CapsLock : bool
  static member Clear : unit -> unit
  static member CursorLeft : int with get, set
  static member CursorSize : int with get, set
  static member CursorTop : int with get, set
  static member CursorVisible : bool with get, set
  ...
System.Console.WriteLine() : unit
   (+0 other overloads)
System.Console.WriteLine(value: string) : unit
   (+0 other overloads)
System.Console.WriteLine(value: obj) : unit
   (+0 other overloads)
System.Console.WriteLine(value: uint64) : unit
   (+0 other overloads)
System.Console.WriteLine(value: int64) : unit
   (+0 other overloads)
System.Console.WriteLine(value: uint32) : unit
   (+0 other overloads)
System.Console.WriteLine(value: int) : unit
   (+0 other overloads)
System.Console.WriteLine(value: float32) : unit
   (+0 other overloads)
System.Console.WriteLine(value: float) : unit
   (+0 other overloads)
System.Console.WriteLine(value: decimal) : unit
   (+0 other overloads)
type Convert =
  static val DBNull : obj
  static member ChangeType : value:obj * typeCode:TypeCode -> obj + 3 overloads
  static member FromBase64CharArray : inArray:char[] * offset:int * length:int -> byte[]
  static member FromBase64String : s:string -> byte[]
  static member GetTypeCode : value:obj -> TypeCode
  static member IsDBNull : value:obj -> bool
  static member ToBase64CharArray : inArray:byte[] * offsetIn:int * length:int * outArray:char[] * offsetOut:int -> int + 1 overload
  static member ToBase64String : inArray:byte[] -> string + 4 overloads
  static member ToBoolean : value:obj -> bool + 17 overloads
  static member ToByte : value:obj -> byte + 18 overloads
  ...
System.Convert.ToDecimal(value: System.DateTime) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: bool) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: decimal) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: string) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: float) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: float32) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: uint64) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: int64) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: uint32) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: int) : decimal
   (+0 other overloads)
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

More information

Link:http://fssnip.net/7S1
Posted:9 months ago
Author:The streets
Tags: blockchain