bitcoin

package module
v0.0.0-...-a05b099 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 17 Imported by: 0

README

Nakji Bitcoin Connector

Bitcoin is an innovative payment network and a new kind of money. Bitcoin uses peer-to-peer technology to operate with no central authority or banks; managing transactions and the issuing of bitcoins is carried out collectively by the network. Bitcoin is open-source; its design is public, nobody owns or controls Bitcoin and everyone can take part. Through many of its unique properties, Bitcoin allows exciting uses that could not be covered by any previous payment system.

Nakji currently indexes the following from Bitcoin:

  • Blocks
  • Transactions

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_connectors_source_bitcoin_bitcoin_proto protoreflect.FileDescriptor
View Source
var TopicTypes = map[string]proto.Message{
	"nakji.bitcoin.0_0_0.chain_block": &Block{},
	"nakji.bitcoin.0_0_0.chain_tx":    &Transaction{},
}

Functions

This section is empty.

Types

type BTCClient

type BTCClient interface {
	GetBlock(*chainhash.Hash) (*wire.MsgBlock, error)
	GetBlockVerbose(*chainhash.Hash) (*btcjson.GetBlockVerboseResult, error)
	GetRawTransactionVerbose(*chainhash.Hash) (*btcjson.TxRawResult, error)
	Shutdown()
	WaitForShutdown()
	NotifyBlocks() error
	GetBlockCount() (int64, error)
}

type BitcoinConnector

type BitcoinConnector struct {
	*connector.Connector // embed Nakji connector.Connector into your custom connector to get access to all its methods
	// contains filtered or unexported fields
}

func NewConnector

func NewConnector(callback func()) *BitcoinConnector

NewConnector creates new BitcoinConnector and connects to the bitcoin RPC

func (*BitcoinConnector) Start

func (c *BitcoinConnector) Start(ctx context.Context)

type Block

type Block struct {
	Ts            *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=ts,proto3" json:"ts,omitempty"`
	MerkleRoot    string                 `protobuf:"bytes,2,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"`
	Bits          string                 `protobuf:"bytes,3,opt,name=bits,proto3" json:"bits,omitempty"`
	Hash          string                 `protobuf:"bytes,4,opt,name=hash,proto3" json:"hash,omitempty"`
	Difficulty    float64                `protobuf:"fixed64,5,opt,name=difficulty,proto3" json:"difficulty,omitempty"`
	Nonce         uint32                 `protobuf:"varint,6,opt,name=nonce,proto3" json:"nonce,omitempty"`
	PreviousHash  string                 `protobuf:"bytes,7,opt,name=previous_hash,json=previousHash,proto3" json:"previous_hash,omitempty"`
	NextHash      string                 `protobuf:"bytes,8,opt,name=next_hash,json=nextHash,proto3" json:"next_hash,omitempty"`
	Version       int32                  `protobuf:"varint,9,opt,name=version,proto3" json:"version,omitempty"`
	VersionHex    string                 `protobuf:"bytes,10,opt,name=version_hex,json=versionHex,proto3" json:"version_hex,omitempty"`
	Height        int64                  `protobuf:"varint,11,opt,name=height,proto3" json:"height,omitempty"`
	Weight        int32                  `protobuf:"varint,12,opt,name=weight,proto3" json:"weight,omitempty"`
	Size          int32                  `protobuf:"varint,13,opt,name=size,proto3" json:"size,omitempty"`
	StrippedSize  int32                  `protobuf:"varint,14,opt,name=stripped_size,json=strippedSize,proto3" json:"stripped_size,omitempty"`
	Confirmations int64                  `protobuf:"varint,15,opt,name=confirmations,proto3" json:"confirmations,omitempty"`
	// contains filtered or unexported fields
}

https://pkg.go.dev/github.com/btcsuite/btcd@v0.21.0-beta/btcjson#GetBlockVerboseTxResult

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetBits

func (x *Block) GetBits() string

func (*Block) GetConfirmations

func (x *Block) GetConfirmations() int64

func (*Block) GetDifficulty

func (x *Block) GetDifficulty() float64

func (*Block) GetHash

func (x *Block) GetHash() string

func (*Block) GetHeight

func (x *Block) GetHeight() int64

func (*Block) GetMerkleRoot

func (x *Block) GetMerkleRoot() string

func (*Block) GetNextHash

func (x *Block) GetNextHash() string

func (*Block) GetNonce

func (x *Block) GetNonce() uint32

func (*Block) GetPreviousHash

func (x *Block) GetPreviousHash() string

func (*Block) GetSize

func (x *Block) GetSize() int32

func (*Block) GetStrippedSize

func (x *Block) GetStrippedSize() int32

func (*Block) GetTs

func (x *Block) GetTs() *timestamppb.Timestamp

func (*Block) GetVersion

func (x *Block) GetVersion() int32

func (*Block) GetVersionHex

func (x *Block) GetVersionHex() string

func (*Block) GetWeight

func (x *Block) GetWeight() int32

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

func (*Block) UnmarshalBTCBlock

func (b *Block) UnmarshalBTCBlock(in *btcjson.GetBlockVerboseResult)

Convert from btcd MsgBlock to Blep's Bitcoin Block

type Transaction

type Transaction struct {
	Ts            *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=ts,proto3" json:"ts,omitempty"`
	Hex           string                 `protobuf:"bytes,2,opt,name=hex,proto3" json:"hex,omitempty"`
	Txid          string                 `protobuf:"bytes,3,opt,name=txid,proto3" json:"txid,omitempty"`
	Hash          string                 `protobuf:"bytes,4,opt,name=hash,proto3" json:"hash,omitempty"`
	Size          int32                  `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"`
	Vsize         int32                  `protobuf:"varint,6,opt,name=vsize,proto3" json:"vsize,omitempty"`
	Weight        int32                  `protobuf:"varint,7,opt,name=weight,proto3" json:"weight,omitempty"`
	Version       uint32                 `protobuf:"varint,8,opt,name=version,proto3" json:"version,omitempty"`
	LockTime      uint32                 `protobuf:"varint,9,opt,name=lock_time,json=lockTime,proto3" json:"lock_time,omitempty"`
	BlockHash     string                 `protobuf:"bytes,10,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
	Confirmations uint64                 `protobuf:"varint,11,opt,name=confirmations,proto3" json:"confirmations,omitempty"`
	Blocktime     int64                  `protobuf:"varint,12,opt,name=blocktime,proto3" json:"blocktime,omitempty"`
	Vin           []*Vin                 `protobuf:"bytes,13,rep,name=vin,proto3" json:"vin,omitempty"`
	Vout          []*Vout                `protobuf:"bytes,14,rep,name=vout,proto3" json:"vout,omitempty"`
	// contains filtered or unexported fields
}

https://pkg.go.dev/github.com/btcsuite/btcd@v0.21.0-beta/btcjson#TxRawResult

func (*Transaction) Descriptor deprecated

func (*Transaction) Descriptor() ([]byte, []int)

Deprecated: Use Transaction.ProtoReflect.Descriptor instead.

func (*Transaction) GetBlockHash

func (x *Transaction) GetBlockHash() string

func (*Transaction) GetBlocktime

func (x *Transaction) GetBlocktime() int64

func (*Transaction) GetConfirmations

func (x *Transaction) GetConfirmations() uint64

func (*Transaction) GetHash

func (x *Transaction) GetHash() string

func (*Transaction) GetHex

func (x *Transaction) GetHex() string

func (*Transaction) GetLockTime

func (x *Transaction) GetLockTime() uint32

func (*Transaction) GetSize

func (x *Transaction) GetSize() int32

func (*Transaction) GetTs

func (x *Transaction) GetTs() *timestamppb.Timestamp

func (*Transaction) GetTxid

func (x *Transaction) GetTxid() string

func (*Transaction) GetVersion

func (x *Transaction) GetVersion() uint32

func (*Transaction) GetVin

func (x *Transaction) GetVin() []*Vin

func (*Transaction) GetVout

func (x *Transaction) GetVout() []*Vout

func (*Transaction) GetVsize

func (x *Transaction) GetVsize() int32

func (*Transaction) GetWeight

func (x *Transaction) GetWeight() int32

func (*Transaction) ProtoMessage

func (*Transaction) ProtoMessage()

func (*Transaction) ProtoReflect

func (x *Transaction) ProtoReflect() protoreflect.Message

func (*Transaction) Reset

func (x *Transaction) Reset()

func (*Transaction) String

func (x *Transaction) String() string

func (*Transaction) UnmarshalBTCTransaction

func (tx *Transaction) UnmarshalBTCTransaction(in *btcjson.TxRawResult)

type Vin

type Vin struct {
	Coinbase string   `protobuf:"bytes,1,opt,name=coinbase,proto3" json:"coinbase,omitempty"`
	Txid     string   `protobuf:"bytes,2,opt,name=txid,proto3" json:"txid,omitempty"`
	Vout     uint32   `protobuf:"varint,3,opt,name=vout,proto3" json:"vout,omitempty"`
	Asm      string   `protobuf:"bytes,4,opt,name=asm,proto3" json:"asm,omitempty"`
	Hex      string   `protobuf:"bytes,5,opt,name=hex,proto3" json:"hex,omitempty"`
	Sequence uint32   `protobuf:"varint,6,opt,name=sequence,proto3" json:"sequence,omitempty"`
	Witness  []string `protobuf:"bytes,7,rep,name=witness,proto3" json:"witness,omitempty"`
	// contains filtered or unexported fields
}

https://pkg.go.dev/github.com/btcsuite/btcd@v0.21.0-beta/btcjson#Vin

func (*Vin) Descriptor deprecated

func (*Vin) Descriptor() ([]byte, []int)

Deprecated: Use Vin.ProtoReflect.Descriptor instead.

func (*Vin) GetAsm

func (x *Vin) GetAsm() string

func (*Vin) GetCoinbase

func (x *Vin) GetCoinbase() string

func (*Vin) GetHex

func (x *Vin) GetHex() string

func (*Vin) GetSequence

func (x *Vin) GetSequence() uint32

func (*Vin) GetTxid

func (x *Vin) GetTxid() string

func (*Vin) GetVout

func (x *Vin) GetVout() uint32

func (*Vin) GetWitness

func (x *Vin) GetWitness() []string

func (*Vin) ProtoMessage

func (*Vin) ProtoMessage()

func (*Vin) ProtoReflect

func (x *Vin) ProtoReflect() protoreflect.Message

func (*Vin) Reset

func (x *Vin) Reset()

func (*Vin) String

func (x *Vin) String() string

type Vout

type Vout struct {
	Value     float64  `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"`
	N         uint32   `protobuf:"varint,2,opt,name=n,proto3" json:"n,omitempty"`
	Asm       string   `protobuf:"bytes,3,opt,name=asm,proto3" json:"asm,omitempty"`
	Hex       string   `protobuf:"bytes,4,opt,name=hex,proto3" json:"hex,omitempty"`
	ReqSigs   int32    `protobuf:"varint,5,opt,name=req_sigs,json=reqSigs,proto3" json:"req_sigs,omitempty"`
	Type      string   `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
	Addresses []string `protobuf:"bytes,7,rep,name=addresses,proto3" json:"addresses,omitempty"`
	// contains filtered or unexported fields
}

https://pkg.go.dev/github.com/btcsuite/btcd@v0.21.0-beta/btcjson#Vout

func (*Vout) Descriptor deprecated

func (*Vout) Descriptor() ([]byte, []int)

Deprecated: Use Vout.ProtoReflect.Descriptor instead.

func (*Vout) GetAddresses

func (x *Vout) GetAddresses() []string

func (*Vout) GetAsm

func (x *Vout) GetAsm() string

func (*Vout) GetHex

func (x *Vout) GetHex() string

func (*Vout) GetN

func (x *Vout) GetN() uint32

func (*Vout) GetReqSigs

func (x *Vout) GetReqSigs() int32

func (*Vout) GetType

func (x *Vout) GetType() string

func (*Vout) GetValue

func (x *Vout) GetValue() float64

func (*Vout) ProtoMessage

func (*Vout) ProtoMessage()

func (*Vout) ProtoReflect

func (x *Vout) ProtoReflect() protoreflect.Message

func (*Vout) Reset

func (x *Vout) Reset()

func (*Vout) String

func (x *Vout) String() string

Directories

Path Synopsis
cmd
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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