Documentation ¶
Index ¶
- Constants
- Variables
- func Address2pubk(address string) (string, error)
- func CalcTxid(symbol, rawTx string) (string, error)
- func DecodeSymbolTX(symbol, rawTX string) (string, error)
- func DecodeTX(rawTX string) (string, error)
- func NewBip44Deriver(seed []byte, accountIndex, changeType, index int) (bip44.Deriver, error)
- func NewCoin(seed []byte, path string) (core.Coin, error)
- func NewSymbolBip44Deriver(symbol string, bip44Path string, bip44Key string, seed []byte, ...) (bip44.Deriver, error)
- func NewSymbolCoin(symbol string, seed []byte, path string, bip44Key string) (core.Coin, error)
- func SignWithPrivateKey(rawTX, templateData, privateKey string) (string, error)
- func SymbolSignWithPrivateKey(symbol, rawTX, templateData, privateKey string) (string, error)
- type KeyInfo
- type TemplateInfo
- type TxBuilder
- func (b *TxBuilder) AddInput(txid string, vout int8) *TxBuilder
- func (b *TxBuilder) AddTemplateData(tplData string) *TxBuilder
- func (b *TxBuilder) Build() (string, error)
- func (b *TxBuilder) ExcludeAnchor() *TxBuilder
- func (b *TxBuilder) SetAddress(add string) *TxBuilder
- func (b *TxBuilder) SetAmount(amount float64) *TxBuilder
- func (b *TxBuilder) SetAnchor(anchor string) *TxBuilder
- func (b *TxBuilder) SetData(data []byte) *TxBuilder
- func (b *TxBuilder) SetDataWithUUID(_uuid string, timestamp int64, data string) *TxBuilder
- func (b *TxBuilder) SetFee(fee float64) *TxBuilder
- func (b *TxBuilder) SetLockUntil(lockUntil int) *TxBuilder
- func (b *TxBuilder) SetStringData(data string) *TxBuilder
- func (b *TxBuilder) SetTimestamp(timestamp int) *TxBuilder
- func (b *TxBuilder) SetType(v int) *TxBuilder
- func (b *TxBuilder) SetVersion(v int) *TxBuilder
Constants ¶
const ( SymbolBBC = internal.SymbolBBC SymbolMKF = internal.SymbolMKF )
.
Variables ¶
var FullnameMap = map[string]string{ SymbolBBC: "BigBang Core", SymbolMKF: "MarketFinance", }
FullnameMap .
Functions ¶
func DecodeSymbolTX ¶
DecodeSymbolTX 解析原始交易(使用JSON RPC createtransaction 创建的交易),symbol: BBC | MKF
func NewBip44Deriver ¶
NewBip44Deriver 该函数已废弃,请使用NewSymbolBip44Deriver
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 ¶
NewSymbolCoin symbol 支持 兼容BBC的币种(比如MKF)
func SignWithPrivateKey ¶
SignWithPrivateKey 使用私钥对原始交易进行签名, 关于templateData的使用参考 https://github.com/dabankio/gobbc/blob/d51d596fa310a5778e3d11eb59bc66d1a6a5e3d6/transaction.go#L197 (SignWithPrivateKey部分) 参考测试用例 qa/bbc/example_bbc_test.go
func SymbolSignWithPrivateKey ¶
SymbolSignWithPrivateKey 指定币种使用私钥对交易签名
Types ¶
type KeyInfo ¶
type KeyInfo struct {
PrivateKey, PublicKey, Address string
}
KeyInfo 私钥,公钥,地址
func DeriveKeySimple ¶
DeriveKeySimple 该函数已废弃,请使用NewSymbolCoin
func DeriveSymbolKeySimple ¶
DeriveSymbolKeySimple 该函数已废弃,请使用NewSymbolCoin
func ParsePrivateKey ¶
ParsePrivateKey 解析私钥,返回 privateKey,publicKey,address
type TemplateInfo ¶
type TemplateInfo struct { //Type 类型 Type int //Address 地址 Address string //RawHex hex编码的原始数据(TemplateData) RawHex string }
TemplateInfo 简要模版信息
type TxBuilder ¶
TxBuilder transaction builder
func (*TxBuilder) AddTemplateData ¶
AddTemplateData 添加模版原始数据,多个模版时需要自行确保顺序
func (*TxBuilder) ExcludeAnchor ¶
ExcludeAnchor MKF需要调用该函数(使得序列化时不会处理anchor字段)
func (*TxBuilder) SetAddress ¶
SetAddress 转账地址,目前只支持公钥地址
func (*TxBuilder) SetDataWithUUID ¶
SetDataWithUUID 指定uuid,timestamp,data
func (*TxBuilder) SetLockUntil ¶
SetLockUntil lock until
func (*TxBuilder) SetStringData ¶
SetStringData 自动编码数据,自动生成uuid和时间戳
func (*TxBuilder) SetTimestamp ¶
SetTimestamp 交易时间戳