Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anaskhan96/base58check
Go implementation of base58check to encode Bitcoin addresses
https://github.com/anaskhan96/base58check
base58 base58check bitcoin golang
Last synced: 2 days ago
JSON representation
Go implementation of base58check to encode Bitcoin addresses
- Host: GitHub
- URL: https://github.com/anaskhan96/base58check
- Owner: anaskhan96
- License: mit
- Created: 2017-10-20T15:46:27.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-20T12:20:48.000Z (almost 6 years ago)
- Last Synced: 2024-06-18T18:44:43.862Z (5 months ago)
- Topics: base58, base58check, bitcoin, golang
- Language: Go
- Size: 10.7 KB
- Stars: 12
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# base58check
[![Build Status](https://travis-ci.org/anaskhan96/base58check.svg?branch=master)](https://travis-ci.org/anaskhan96/base58check)
[![GoDoc](https://godoc.org/github.com/anaskhan96/base58check?status.svg)](https://godoc.org/github.com/anaskhan96/base58check)
[![Go Report Card](https://goreportcard.com/badge/github.com/anaskhan96/base58check)](https://goreportcard.com/report/github.com/anaskhan96/base58check)This package in Go provides functions to encode and decode in `base58check`, a specific `base58` encoding format for encoding Bitcoin addresses.
Functions:
```go
func Encode(string, string) (string, error) {} // takes the version and data as hexadecimal strings and returns the encoded string
func Decode(string) (string, error) {} // takes the encoded string and returns the decoded version prepended hexadecimal string
```### Installation
```bash
go get github.com/anaskhan96/base58check
```### Usage
```go
package mainimport (
"fmt"
"log""github.com/anaskhan96/base58check"
)func main() {
encoded, err := base58check.Encode("80", "44D00F6EB2E5491CD7AB7E7185D81B67A23C4980F62B2ED0914D32B7EB1C5581")
if err != nil {
log.Fatal(err)
}
fmt.Println(encoded) // 5JLbJxi9koHHvyFEAERHLYwG7VxYATnf8YdA9fiC6kXMghkYXpkdecoded, err := base58check.Decode("1mayif3H2JDC62S4N3rLNtBNRAiUUP99k")
if err != nil {
log.Fatal(err)
}
fmt.Println(decoded) // 00086eaa677895f92d4a6c5ef740c168932b5e3f44
}```
### References
+ [Base58Check encoding](https://en.bitcoin.it/wiki/Base58Check_encoding)