bcm

package module
v0.0.0-...-6151a0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: ISC Imports: 5 Imported by: 0

README

BitCache Message

bitcache-message is a Go package for serializing and deserializing BitCache messages to and from bytes. This library, part of the bcm (BitCache Message) package, provides a simple and efficient way to handle BitCache messages, making it easier to work with them in Go applications.

Installation

To install the bitcache-message package, use the go get command:

go get github.com/bitcache-tech/bitcache-message

This will download and install the bitcache-message package, ready for use in your Go projects.

Usage

Here is a basic example of how to use the bitcache-message package to encode and decode BitCache messages.

Encoding a BitCache Message
package main

import (
    "github.com/bitcache-tech/bitcache-message/bcm"
    "log"
)

func main() {
    // Create a BitCacheMessage instance
    bcmInstance := bcm.BitCacheMessage{
        // Initialize your BitCacheMessage here
    }

    // Encode the BitCacheMessage to bytes
    encodedBytes, err := bcmInstance.Bytes()
    if err != nil {
        log.Fatalf("Error encoding BitCacheMessage: %v", err)
    }

    // Use encodedBytes as needed
}
Decoding a BitCache Message
package main

import (
    "github.com/bitcache-tech/bitcache-message/bcm"
    "log"
)

func main() {
    // Assume you have a byte slice `data` that represents a serialized BitCacheMessage
    data := []byte{ /* ... */ }

    // Decode the byte slice into a BitCacheMessage
    bcmInstance, err := bcm.NewBitCacheMessage(data)
    if err != nil {
        log.Fatalf("Error decoding BitCacheMessage: %v", err)
    }

    // Use bcmInstance as needed
}

License

This library is distributed under the ISC License. See LICENSE file in the repository for more information.

Documentation

Index

Constants

View Source
const KUMChunkPrefix = "TXOKEYS."
View Source
const TxChunkPrefix = "TXBYTES."

Variables

This section is empty.

Functions

This section is empty.

Types

type BitCacheMessage

type BitCacheMessage struct {
	Tx   *bt.Tx              `json:"tx"`
	KUMs []*KeyUsageMetadata `json:"key_map"`
}

func NewBitCacheMessage

func NewBitCacheMessage(bcmBytes []byte) (*BitCacheMessage, error)

func (*BitCacheMessage) Bytes

func (bcm *BitCacheMessage) Bytes() ([]byte, error)

type KeyUsageMetadata

type KeyUsageMetadata struct {
	Vout           uint32 `json:"vout"`
	ScriptType     string `json:"script_type"`
	KeyFingerprint string `json:"key_fingerprint"`
	KeyDerivation  string `json:"key_derivation"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL