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
  interface ISerializable
  new : unit -> unit + 5 overloads
  member GetObjectData : serializationInfo: SerializationInfo * streamingContext: StreamingContext -> unit
  member System.Runtime.Serialization.ISerializable.GetObjectData : serializationInfo: SerializationInfo * streamingContext: StreamingContext -> unit
  static member CreateCompatibleException : exception: exn -> exn
  static member GetStatusFromException : ex: HttpRequestException -> WebExceptionStatus
  static member GetStatusFromExceptionHelper : ex: HttpRequestException -> WebExceptionStatus
  static val InnerExceptionPrefix : string
  static val s_DispatchStateLock : obj
  ...

--------------------
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 : unit -> unit + 11 overloads
  member <ThrowIfDisposed>g__ThrowObjectDisposedException|68_0 : unit -> unit
  member CheckAsyncTaskInProgress : unit -> unit
  member Close : unit -> unit
  member CompressBuffer : n: int -> unit
  member DetectEncoding : unit -> unit
  member DiscardBufferedData : unit -> unit
  member Dispose : disposing: bool -> unit
  member IsPreamble : unit -> bool
  ...

--------------------
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 Beep : unit -> unit + 1 overload
  static member CheckNonNull : obj: obj * paramName: string -> unit
  static member Clear : unit -> unit
  static member CreateOutputWriter : outputStream: Stream -> TextWriter
  static member EnsureInitialized<'T (requires reference type)> : field: byref<'T> * initializer: Func<'T> -> 'T
  static member HandleBreakEvent : controlKey: ConsoleSpecialKey -> bool
  static member MoveBufferArea : sourceLeft: int * sourceTop: int * sourceWidth: int * sourceHeight: int * targetLeft: int * targetTop: int -> unit + 1 overload
  static member OpenStandardError : unit -> Stream + 1 overload
  static member OpenStandardInput : unit -> Stream + 1 overload
  static member OpenStandardOutput : unit -> Stream + 1 overload
  ...
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 member ChangeType : value: obj * typeCode: TypeCode -> obj + 3 overloads
  static member ConvertToBase64Array : outChars: nativeptr<char> * inData: nativeptr<byte> * offset: int * length: int * insertLineBreaks: bool -> int
  static member CopyToTempBufferWithoutWhiteSpace : chars: ReadOnlySpan<char> * tempBuffer: Span<char> * consumed: byref<int> * charsWritten: byref<int> -> unit
  static member Decode : encodedChars: byref<char> * decodingMap: byref<sbyte> -> int
  static member DefaultToType : value: IConvertible * targetType: Type * provider: IFormatProvider -> obj
  static member FromBase64CharArray : inArray: char [] * offset: int * length: int -> byte []
  static member FromBase64CharPtr : inputPtr: nativeptr<char> * inputLength: int -> byte []
  static member FromBase64String : s: string -> byte []
  static member FromBase64_ComputeResultLength : inputPtr: nativeptr<char> * inputLength: int -> int
  static member GetTypeCode : value: obj -> TypeCode
  ...
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:7 months ago
Author:The streets
Tags: blockchain