boost

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MIT Imports: 10 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-boost

A transaction parser for boost (Bitcoin protocol)

Release Build Status Go
Mergify Status Sponsor Donate

Installation

go-boost requires a supported release of Go.

go get -u github.com/bitcoinschema/go-boost

Documentation

View the generated documentation

GoDoc


Boost Object

It takes a BOB formatted transaction and produces an easy-to-use BOOST struct with all protocol fields populated.

type Boost struct {
	Redeem Redeem `json:"redeem" bson:"redeem"`
	Spend  Spend  `json:"spend" bson:"spend"`
}

Coverage

  • V1 Bounty Spend
  • V1 Bounty Redeem
  • V2 Contract Spend
  • V2 Contract Redeem

Usage

Get the package

go get github.com/bitcoinschema/go-boost

Import the package

import (
  github.com/bitcoinschema/go-boost
)

Use to transform BOB formatted transactions.

var b *boost.Boost
b, err = boostNewFromTape(&bobData.In[0].Tape[0])

V1 Contract Spend Example

	// Get BOB data from string
	bobData, err := bob.NewFromRawTxString(boostTx)
	if err != nil {
		t.Fatalf("error occurred: %s", err.Error())
	}

	var b *Boost
	b, err = boost.NewFromTape(&bobData.Out[0].Tape[0])thing": "else"
}

boost.BoostSpend Result:

{
  "Content": "7332808b5283f8acedcc6240a42f669cc3d305413201527852061fd5b283d0d8",
  "MinerAddress": "16nhPWCkbkR1bNACwPYULBWyvxQ5MCDZBo",
  "Category": 1111,
  "Difficulty": 0.01,
  "Topic": "theory",
  "AdditionalData": "this is the Boost whitepaper",
  "Nonce": 137,
  "Version": 1
}

More examples can be found in tests.



Contributing

View the contributing guidelines and follow the code of conduct.

How can I help?

All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬. You can also support this project by becoming a sponsor on GitHub 👏 or by making a bitcoin donation to ensure this journey continues indefinitely! 🚀

Stars


License

License

Documentation

Overview

Package boost provides a way to parse boostpow data from a bpu.Tape

Index

Constants

View Source
const Prefix = "boostpow"

Prefix is the protocol prefix for Boost Pow

Variables

This section is empty.

Functions

func PubkeyHashToAddress

func PubkeyHashToAddress(pubkeyHash []byte) string

PubkeyHashToAddress converts a pubkey hash to a base58check encoded address

func RemoveLBR

func RemoveLBR(text string) string

RemoveLBR removes linebreaks

func Reverse

func Reverse(input []byte) []byte

Reverse a byte array

Types

type Boost

type Boost struct {
	Redeem Redeem `json:"redeem" bson:"redeem"`
	Spend  Spend  `json:"spend" bson:"spend"`
}

Boost is Boost Pow data object

func NewFromTape

func NewFromTape(tape *bpu.Tape) (b *Boost, err error)

NewFromTape takes a bob.Tape and returns a BAP data structure

func (*Boost) FromTape

func (b *Boost) FromTape(tape *bpu.Tape) (err error)

FromTape builds a boost object from a *bpu.Tape

type Redeem

type Redeem struct {
	// 3044022100ac4003d62ddadbf0bff9cbe63d0f6ad740494ee7fcf5f296cfc056f52f087c7c\
	// 021f2f9e2db03b141ce88edc1c10850a0831dea63edd6c6a8040d80e24737e6d4a41
	Signature string `json:"signature" bson:"signature"`
	// pubkey: 03097e9768554d40c0b5b18e44db2a15bbd137a373c39af46033049477bcbb79a4
	PubKey string `json:"pubkey" bson:"pubkey"`
	// nonce : 31497
	Nonce uint32 `json:"nonce" bson:"nonce"`
	// timestamp : 1677268580
	Timestamp uint32 `json:"timestamp" bson:"timestamp"`
	// extra_nonce_2 : "0f0445b186e64adc"
	ExtraNonce2 string `json:"extra_nonce_2" bson:"extra_nonce_2"`
	// extra_nonce_1 : 909479219
	ExtraNonce1 uint32 `json:"extra_nonce_1" bson:"extra_nonce_1"`
	// miner_pubkey_hash: 0xa3c10ac097a7da0009a786cc17edc1391a3bddf6
	MinerPubKeyHash string `json:"miner_pubkey_hash" bson:"miner_pubkey_hash"`
	Version         int32  `json:"version" bson:"version"`
}

Redeem is the parsed redeem data

type Spend

type Spend struct {
	Hash           string  `json:"hash,omitempty" bson:"hash,omitempty"`
	Content        string  `json:"content,omitempty" bson:"content,omitempty"`
	Difficulty     float64 `json:"difficulty,omitempty" bson:"difficulty,omitempty"`
	Topic          *string `json:"topic,omitempty" bson:"topic,omitempty"`
	AdditionalData *string `json:"additional_data,omitempty" bson:"additional_data,omitempty"`
	Bits           uint64  `json:"bits" bson:"bits"`
	MetadataHash   string  `json:"metadata_hash,omitempty" bson:"metadata_hash,omitempty"`
	Time           uint64  `json:"time,omitempty" bson:"time,omitempty"`
	Nonce          uint32  `json:"nonce,omitempty" bson:"nonce,omitempty"`
	Category       uint32  `json:"category" bson:"category,omitempty"`
	MinerAddress   *string `json:"miner_address,omitempty" bson:"miner_address,omitempty"`
	Version        int32   `json:"version" bson:"version"`
}

Spend is the parsed spend data. Version unknown when 0.

Jump to

Keyboard shortcuts

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