bbc

package
v0.10.0-beta.2020101302 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SymbolBBC = internal.SymbolBBC
	SymbolMKF = internal.SymbolMKF
)

.

Variables

View Source
var FullnameMap = map[string]string{
	SymbolBBC: "BigBang Core",
	SymbolMKF: "MarketFinance",
}

FullnameMap .

Functions

func Address2pubk

func Address2pubk(address string) (string, error)

Address2pubk 将地址转换为公钥

func CalcTxid

func CalcTxid(symbol, rawTx string) (string, error)

CalcTxid 计算txid, symbol: BBC|MKF

func DecodeSymbolTX

func DecodeSymbolTX(symbol, rawTX string) (string, error)

DecodeSymbolTX 解析原始交易(使用JSON RPC createtransaction 创建的交易),symbol: BBC | MKF

func DecodeTX

func DecodeTX(rawTX string) (string, error)

DecodeTX 该函数已废弃,请使用 DecodeSymbolTX

func NewBip44Deriver

func NewBip44Deriver(seed []byte, accountIndex, changeType, index int) (bip44.Deriver, error)

NewBip44Deriver 该函数已废弃,请使用NewSymbolBip44Deriver

func NewCoin

func NewCoin(seed []byte, path string) (core.Coin, error)

NewCoin 该函数已废弃,请使用NewSymbolCoin

func NewSymbolBip44Deriver

func NewSymbolBip44Deriver(symbol string, bip44Path string, bip44Key string, seed []byte, accountIndex, changeType, index int) (bip44.Deriver, error)

NewSymbolBip44Deriver 获取bip44推导 accountIndex 账户索引,以0开始 changeType 0:外部使用, 1:找零, 通常使用0,BBC通常找零到发送地址 index 地址索引,以0开始

func NewSymbolCoin

func NewSymbolCoin(symbol string, seed []byte, path string, bip44Key string) (core.Coin, error)

NewSymbolCoin symbol 支持 兼容BBC的币种(比如MKF)

func SignWithPrivateKey

func SignWithPrivateKey(rawTX, templateData, privateKey string) (string, error)

SignWithPrivateKey 使用私钥对原始交易进行签名, 关于templateData的使用参考 https://github.com/dabankio/gobbc/blob/d51d596fa310a5778e3d11eb59bc66d1a6a5e3d6/transaction.go#L197 (SignWithPrivateKey部分) 参考测试用例 qa/bbc/example_bbc_test.go

func SymbolSignWithPrivateKey

func SymbolSignWithPrivateKey(symbol, rawTX, templateData, privateKey string) (string, error)

SymbolSignWithPrivateKey 指定币种使用私钥对交易签名

Types

type KeyInfo

type KeyInfo struct {
	PrivateKey, PublicKey, Address string
}

KeyInfo 私钥,公钥,地址

func DeriveKey

func DeriveKey(seed []byte, accountIndex, changeType, index int) (*KeyInfo, error)

DeriveKey 该该函数已废弃,请使用NewSymbolCoin

func DeriveKeySimple

func DeriveKeySimple(seed []byte) (*KeyInfo, error)

DeriveKeySimple 该函数已废弃,请使用NewSymbolCoin

func DeriveSymbolKeySimple

func DeriveSymbolKeySimple(symbol string, seed []byte) (*KeyInfo, error)

DeriveSymbolKeySimple 该函数已废弃,请使用NewSymbolCoin

func ParsePrivateKey

func ParsePrivateKey(privateKey string) (*KeyInfo, error)

ParsePrivateKey 解析私钥,返回 privateKey,publicKey,address

type TemplateInfo

type TemplateInfo struct {
	//Type 类型
	Type int
	//Address 地址
	Address string
	//RawHex hex编码的原始数据(TemplateData)
	RawHex string
}

TemplateInfo 简要模版信息

func CreateTemplateDataDexOrder

func CreateTemplateDataDexOrder(
	sellerAddress string,
	coinpair string,
	price int64,
	fee int32,
	recvAddress string,
	validHeight int32,
	matchAddress string,
	dealAddress string,
) (*TemplateInfo, error)

CreateTemplateDataDexOrder 获取dexOrder模版数据

type TxBuilder

type TxBuilder struct {
	*gobbc.TXBuilder
	// contains filtered or unexported fields
}

TxBuilder transaction builder

func NewTxBuilder

func NewTxBuilder() *TxBuilder

NewTxBuilder new 一个transaction builder

func (*TxBuilder) AddInput

func (b *TxBuilder) AddInput(txid string, vout int8) *TxBuilder

AddInput 参考listunspent,确保输入金额满足amount

func (*TxBuilder) AddTemplateData

func (b *TxBuilder) AddTemplateData(tplData string) *TxBuilder

AddTemplateData 添加模版原始数据,多个模版时需要自行确保顺序

func (*TxBuilder) Build

func (b *TxBuilder) Build() (string, error)

Build 构造交易,返回hex编码的tx

func (*TxBuilder) ExcludeAnchor

func (b *TxBuilder) ExcludeAnchor() *TxBuilder

ExcludeAnchor MKF需要调用该函数(使得序列化时不会处理anchor字段)

func (*TxBuilder) SetAddress

func (b *TxBuilder) SetAddress(add string) *TxBuilder

SetAddress 转账地址,目前只支持公钥地址

func (*TxBuilder) SetAmount

func (b *TxBuilder) SetAmount(amount float64) *TxBuilder

SetAmount 转账金额

func (*TxBuilder) SetAnchor

func (b *TxBuilder) SetAnchor(anchor string) *TxBuilder

SetAnchor 锚定分支id

func (*TxBuilder) SetData

func (b *TxBuilder) SetData(data []byte) *TxBuilder

SetData 原始data设置,参考 UtilDataEncoding

func (*TxBuilder) SetDataWithUUID

func (b *TxBuilder) SetDataWithUUID(_uuid string, timestamp int64, data string) *TxBuilder

SetDataWithUUID 指定uuid,timestamp,data

func (*TxBuilder) SetFee

func (b *TxBuilder) SetFee(fee float64) *TxBuilder

SetFee 手续费,目前0.01,如果带data则0.03, 额外需咨询BBC

func (*TxBuilder) SetLockUntil

func (b *TxBuilder) SetLockUntil(lockUntil int) *TxBuilder

SetLockUntil lock until

func (*TxBuilder) SetStringData

func (b *TxBuilder) SetStringData(data string) *TxBuilder

SetStringData 自动编码数据,自动生成uuid和时间戳

func (*TxBuilder) SetTimestamp

func (b *TxBuilder) SetTimestamp(timestamp int) *TxBuilder

SetTimestamp 交易时间戳

func (*TxBuilder) SetType

func (b *TxBuilder) SetType(v int) *TxBuilder

SetType typ

func (*TxBuilder) SetVersion

func (b *TxBuilder) SetVersion(v int) *TxBuilder

SetVersion 当前版本 1

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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