Kayuii / block_io-go

Work in Progress: Go library for Block.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlockIo

This Golang library is the official Block.IO low-level SDK. To use the functions provided by this SDK, you will need a REST client of your choice, the Bitcoin, Litecoin, or Dogecoin API key(s) from Block.io and, if required by your use case, your PIN or secret keys.

Installation

  go get github.com/BlockIo/block_io-go

Usage

Example implementations

Method documentation

Signing

SignWithdrawRequestJson()

  func SignWithdrawRequestJson(pin string, withdrawData string) (string, error)

Signs JSON encoded signature requests returned from the /api/v2/withdraw* endpoints with a PIN-derived key and returns a JSON encoded string that can be posted to /api/v2/sign_and_finalize_withdrawal.

SignRequestJsonWithKey()

  func SignRequestJsonWithKey(ecKey *ECKey, data string) (string, error)

Signs JSON encoded strings returned from the /api/v2/sweep* and /api/v2/withdraw_dtrust*/ endpoints with a local ECKey and returns a JSON encoded string that can be posted to /api/v2/sign_and_finalize_* endpoints.

SignRequestJsonWithKeys()

  func SignRequestJsonWithKeys(ecKeys []*ECKey, data string) (string, error)

Signs JSON encoded strings returned from the /api/v2/withdraw_dtrust*/ endpoints with multiple local ECKeys and returns a JSON encoded string that can be posted to /api/v2/sign_and_finalize_* endpoints.

Key derivation

NewECKey()

  func NewECKey (d [32]byte, compressed bool) *ECKey

Creates an ECKey from a byte slice.

FromWIF()

  func FromWIF(strWif string) (*ECKey, error)

Creates an ECKey from a WIF-formatted string. Returns an error if the given string could not be

DeriveKeyFromHex()

  func DeriveKeyFromHex(hexPass string) (*ECKey, error)

Derives an ECKey from a hexadecimal encoded string by hashing it with sha256 once.

DeriveKeyFromString()

  func DeriveKeyFromString(pass string) *ECKey

Convenience function to derive an ECKey from a string seed by hashing it with sha256 once.

NOTE: Do not use this for deriving production keys!

Testing

  go test -v

About

Work in Progress: Go library for Block.io

License:MIT License


Languages

Language:Go 100.0%