Skip to content

wealdtech/go-coincodec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e4892ab · Oct 22, 2019

History

7 Commits
Oct 19, 2019
Oct 18, 2019
Oct 18, 2019
Oct 18, 2019
Oct 19, 2019
Oct 21, 2019
Oct 21, 2019
Oct 21, 2019
Oct 19, 2019
Oct 18, 2019
Oct 21, 2019
Oct 19, 2019
Oct 18, 2019
Oct 19, 2019
Oct 19, 2019

Repository files navigation

go-coincodec

Tag License GoDoc Travis CI codecov.io

Go utility library to provide movement between string and binary representation of multpile different cryptocurrency coin formats.

Table of Contents

Install

go-coincodec is a standard Go module which can be installed with:

go get github.com/wealdtech/go-coincodec

Usage

Example

import (
    "bytes"
    "encoding/hex"
    "errors"

    slip44 "github.com/wealdtech/go-slip44"
    cc "github.com/wealdtech/go-coincodec"
)

func main() {
    bytes, err := cc.ToBytes("0x0102030405060708090A0b0c0d0e0f1011121314", slip44.ETHER)
    if err != nil {
        panic(err)
    }

    str, err := cc.ToString(bytes, slip44.ETHER)
    if err != nil {
        panic(err)
    }

    fmt.Printf("%s\n", str)
}

Maintainers

Jim McDonald: @mcdee.

Contribute

Contributions welcome. Please check out the issues.

If you are adding a new coin type please try to follow the following rules:

  • use the existing ether.go and ether_test.go as templates
  • ensure you have 100% code coverage with your tests
  • try not to import large amounts of code; consider copying the relevant code rather than bringing in an entire project to use the address conversion functions

License

Apache-2.0 © 2019 Weald Technology Trading Ltd