Go utility library to provide movement between string and binary representation of multpile different cryptocurrency coin formats.
go-coincodec
is a standard Go module which can be installed with:
go get github.com/wealdtech/go-coincodec
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)
}
Jim McDonald: @mcdee.
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
andether_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
Apache-2.0 © 2019 Weald Technology Trading Ltd