ptnjson

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: GPL-3.0, GPL-3.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// pubkeyCompressed     byte = 0x2 // y_bit + x coord
	// pubkeyUncompressed   byte = 0x4 // x coord + y coord
	// pubkeyHybrid         byte = 0x6 // y_bit + x coord + y coord
	MinCoinbaseScriptLen = 2
	MaxCoinbaseScriptLen = 100
)
View Source
const (
	// MaxBlockWeight defines the maximum block weight, where "block
	// weight" is interpreted as defined in BIP0141. A block's weight is
	// calculated as the sum of the of bytes in the existing transactions
	// and header, plus the weight of each byte within a transaction. The
	// weight of a "base" byte is 4, while the weight of a witness byte is
	// 1. As a result, for a block to be valid, the BlockWeight MUST be
	// less than, or equal to MaxBlockWeight.
	MaxBlockWeight = 4000000

	// MaxBlockBaseSize is the maximum number of bytes within a block
	// which can be allocated to non-witness data.
	MaxBlockBaseSize = 1000000

	// MaxBlockSigOpsCost is the maximum number of signature operations
	// allowed for a block. It is calculated via a weighted algorithm which
	// weights segregated witness sig ops lower than regular sig ops.
	MaxBlockSigOpsCost = 80000
)
View Source
const (
	// SatoshiPerBitcent is the number of satoshi in one bitcoin cent.
	DaoPerPtncent = 1e6

	// SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC).
	DaoPerPtn = 1e8

	// MaxSatoshi is the maximum transaction amount allowed in satoshi.
	MaxDao = 10e8 * DaoPerPtn
)
View Source
const (
	PubKeyBytesLenCompressed   = 33
	PubKeyBytesLenUncompressed = 65
	PubKeyBytesLenHybrid       = 65
)

These constants define the lengths of serialized public keys.

View Source
const BlackList_ABI = `` /* 1058-byte string literal not displayed */
View Source
const CoinBaseABI = `` /* 281-byte string literal not displayed */
View Source
const Debug_ABI = `` /* 1195-byte string literal not displayed */
View Source
const Deposit_ABI = `` /* 9837-byte string literal not displayed */
View Source
const DigitalID_ABI = `` /* 2055-byte string literal not displayed */
View Source
const PRC20_ABI = `` /* 1721-byte string literal not displayed */
View Source
const PRC721_ABI = `` /* 2281-byte string literal not displayed */
View Source
const Partition_ABI = `` /* 2705-byte string literal not displayed */
View Source
const PrivKeyBytesLen = 32

PrivKeyBytesLen defines the length in bytes of a serialized private key.

View Source
const SysConfig_ABI = `` /* 1594-byte string literal not displayed */
View Source
const Vote_ABI = `` /* 1722-byte string literal not displayed */

Variables

View Source
var (
	ErrRPCInvalidRequest = &RPCError{
		Code:    -32600,
		Message: "Invalid request",
	}
	ErrRPCMethodNotFound = &RPCError{
		Code:    -32601,
		Message: "Method not found",
	}
	ErrRPCInvalidParams = &RPCError{
		Code:    -32602,
		Message: "Invalid parameters",
	}
	ErrRPCInternal = &RPCError{
		Code:    -32603,
		Message: "Internal error",
	}
	ErrRPCParse = &RPCError{
		Code:    -32700,
		Message: "Parse error",
	}
)

Standard JSON-RPC 2.0 errors.

View Source
var (
	// ErrChecksumMismatch describes an error where decoding failed due
	// to a bad checksum.
	ErrChecksumMismatch = errors.New("checksum mismatch")

	// ErrUnknownAddressType describes an error where an address can not
	// decoded as a specific address type due to the string encoding
	// beginning with an identifier byte unknown to any standard or
	// registered (via chaincfg.Register) network.
	ErrUnknownAddressType = errors.New("unknown address type")

	// ErrAddressCollision describes an error where an address can not
	// be uniquely determined as either a pay-to-pubkey-hash or
	// pay-to-script-hash address since the leading identifier is used for
	// describing both address kinds, but for different networks.  Rather
	// than assuming or defaulting to one or the other, this error is
	// returned and the caller must decide how to decode the address.
	ErrAddressCollision = errors.New("address collision")
)
View Source
var ErrMalformedPrivateKey = errors.New("malformed private key")
View Source
var (
	PalletOneABI = map[string]string{
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DR32W9vM": Deposit_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DREThG43": PRC20_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DRLGbeyd": Vote_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DRS71ZEM": SysConfig_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DRUp5qmM": CoinBaseABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DRdWEXJF": BlackList_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DRijspoq": PRC721_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DRv2vsEk": DigitalID_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DRxVdGDZ": Partition_ABI,
		"PCGTta3M4t3yXu8uRgkKvaWd2d8DSfQdUHf": Debug_ABI,
	}
)

Functions

func AssetAmt2JsonAmt

func AssetAmt2JsonAmt(asset *modules.Asset, amount uint64) decimal.Decimal

func ConvertGetTransactions2Json

func ConvertGetTransactions2Json(gets []GetTransactions) string

func ConvertJson2Payment

func ConvertJson2Payment(json *PaymentJson) *modules.PaymentPayload

func ConvertJson2Tx

func ConvertJson2Tx(json *TxJson) *modules.Transaction

func ConvertMegs2Json

func ConvertMegs2Json(msgs []*modules.Message) string

func ConvertRawTxJson2Paymsg

func ConvertRawTxJson2Paymsg(rawTxJson RawTransactionGenParams) (*modules.PaymentPayload, error)

func ConvertRawTxJson2Tx

func ConvertRawTxJson2Tx(rawTxJson RawTransactionGenParams) *modules.Transaction

func Dao2Ptn

func Dao2Ptn(amount uint64) decimal.Decimal

func FormatAssetAmountByDecimal added in v1.0.1

func FormatAssetAmountByDecimal(amount uint64, dec byte) decimal.Decimal

func Hash160

func Hash160(buf []byte) []byte

Hash160 calculates the hash ripemd160(sha256(b)).

func JsonAmt2AssetAmt

func JsonAmt2AssetAmt(asset *modules.Asset, jsonAmt decimal.Decimal) uint64

func Ptn2Dao

func Ptn2Dao(ptnAmount decimal.Decimal) uint64

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it. This is useful when assigning optional parameters.

Types

type AccountStateJson

type AccountStateJson struct {
	Number   int    `json:"row_number"`
	WriteSet string `json:"write_set"`
}

type AddressAmt

type AddressAmt struct {
	Address string          `json:"address"`
	Amount  decimal.Decimal `json:"amount"`
}

type AddressPubKey

type AddressPubKey struct {
	// contains filtered or unexported fields
}

AddressPubKey is an Address for a pay-to-pubkey transaction.

func NewAddressPubKey

func NewAddressPubKey(serializedPubKey []byte) (*AddressPubKey, error)

func (*AddressPubKey) EncodeAddress

func (a *AddressPubKey) EncodeAddress() string

type AddressPubKeyHash

type AddressPubKeyHash struct {
	// contains filtered or unexported fields
}

AddressPubKeyHash is an Address for a pay-to-pubkey-hash (P2PKH) transaction.

func NewAddressPubKeyHash

func NewAddressPubKeyHash(pkHash []byte, netID byte) (*AddressPubKeyHash, error)

NewAddressPubKeyHash returns a new AddressPubKeyHash. pkHash mustbe 20 bytes.

func (*AddressPubKeyHash) EncodeAddress

func (a *AddressPubKeyHash) EncodeAddress() string

EncodeAddress returns the string encoding of a pay-to-pubkey-hash address. Part of the Address interface.

func (*AddressPubKeyHash) ScriptAddress

func (a *AddressPubKeyHash) ScriptAddress() []byte

ScriptAddress returns the bytes to be included in a txout script to pay to a pubkey hash. Part of the Address interface.

type AddressScriptHash

type AddressScriptHash struct {
	// contains filtered or unexported fields
}

AddressScriptHash is an Address for a pay-to-script-hash (P2SH) transaction.

func NewAddressScriptHash

func NewAddressScriptHash(serializedScript []byte, netScriptHashAddrID byte) (*AddressScriptHash, error)

NewAddressScriptHash returns a new AddressScriptHash.

func NewAddressScriptHashFromHash

func NewAddressScriptHashFromHash(scriptHash []byte, netScriptHashAddrID byte) (*AddressScriptHash, error)

NewAddressScriptHash returns a new AddressScriptHash. NewAddressScriptHashFromHash returns a new AddressScriptHash. scriptHash must be 20 bytes.

func (*AddressScriptHash) EncodeAddress

func (a *AddressScriptHash) EncodeAddress() string

EncodeAddress returns the string encoding of a pay-to-script-hash address. Part of the Address interface.

func (*AddressScriptHash) String

func (a *AddressScriptHash) String() string

String returns a human-readable string for the pay-to-script-hash address. This is equivalent to calling EncodeAddress, but is provided so the type can be used as a fmt.Stringer.

type Amount

type Amount int64

Amount represents the base bitcoin monetary unit (colloquially referred to as a `Satoshi'). A single Amount is equal to 1e-8 of a bitcoin.

type ChainIndexJson

type ChainIndexJson struct {
	AssetID string `json:"asset_id"`
	Index   uint64 `json:"index"`
}

type ChainInfo added in v1.0.7

type ChainInfo struct {
	HeadHash    common.Hash `json:"head_hash"`
	HeadNum     uint64      `json:"head_num"`
	HeadTime    string      `json:"head_time"`
	StableHash  common.Hash `json:"stable_hash"`
	StableIndex uint64      `json:"stable_num"`
	StableTime  string      `json:"stable_time"`
}

type ChainUnitPropertyJson added in v1.0.5

type ChainUnitPropertyJson struct {
	FastHash        common.Hash `json:"fast_hash"`
	FastIndex       uint64      `json:"fast_index"`
	StableHash      common.Hash `json:"stable_hash"`
	StableIndex     uint64      `json:"stable_index"`
	FastTimestamp   string      `json:"fast_timestamp"`
	StableTimestamp string      `json:"stable_timestamp"`
}

type CmdTransactionGenParams

type CmdTransactionGenParams struct {
	Address string `json:"address"`
	Outputs []struct {
		Address string          `json:"address"`
		Amount  decimal.Decimal `json:"amount"`
	} `json:"outputs"`
	Locktime int64 `json:"locktime"`
}

type CoinbaseWriteSet

type CoinbaseWriteSet struct {
	IsDelete bool   `json:"is_delete"`
	Key      string `json:"key"`
	Value    string `json:"value"`
}

type ConfigJson

type ConfigJson struct {
	Key   string `json:"key"`   // 配置参数的key
	Value string `json:"value"` // 配置参数的value
}

配置参数的键值对,区块链浏览器专用

func ConvertAllSysConfigToJson

func ConvertAllSysConfigToJson(configs *core.ChainParameters) []*ConfigJson

type ContractInvokeHistoryJson added in v1.0.3

type ContractInvokeHistoryJson struct {
	TxHash     string              `json:"tx_hash"`
	RequestId  string              `json:"request_id"`
	UnitHash   string              `json:"unit_hash"`
	TxSize     float64             `json:"tx_size"`
	Payment    *PaymentSummaryJson `json:"payment"`
	InvokeJson *InvokeJson         `json:"invoke_result"`

	InvokeRequest *InvokeRequestJson `json:"invoke_request"`
	Timestamp     string             `json:"timestamp"`
}

func ConvertTx2ContractInvokeHistoryJson added in v1.0.3

func ConvertTx2ContractInvokeHistoryJson(tx *modules.TransactionWithUnitInfo,
	utxoQuery modules.QueryUtxoFunc) *ContractInvokeHistoryJson

type ContractInvokeResultJson added in v1.0.8

type ContractInvokeResultJson struct {
	TxHash             string    `json:"tx_hash"`
	ResultErrorCode    uint32    `json:"result_err_code"`
	ResultErrorMessage string    `json:"result_err_message"`
	RequestHash        string    `json:"request_hash"`
	UnitHash           string    `json:"unit_hash"`
	UnitHeight         uint64    `json:"unit_height"`
	Timestamp          time.Time `json:"timestamp"`
	TxIndex            uint64    `json:"tx_index"`
}

type ContractJson

type ContractJson struct {
	//Contract Id 即Address,[20]byte,
	// 根据用户创建合约实例申请的RequestId截取其后20字节生成
	ContractId      string                `json:"contract_id"` //Hex
	ContractAddress string                `json:"contract_address"`
	TemplateId      string                `json:"tpl_id"`
	Name            string                `json:"contract_name"`
	Status          byte                  `json:"status"` // 合约状态
	Creator         string                `json:"creator"`
	CreationTime    time.Time             `json:"creation_time"` // creation date
	DuringTime      uint64                `json:"during_time"`   // deploy during date
	Template        *ContractTemplateJson `json:"template"`
	Version         string                `json:"version"`
}

func ConvertContract2Json

func ConvertContract2Json(contract *modules.Contract) *ContractJson

type ContractStateJson added in v1.0.3

type ContractStateJson struct {
	Key     string                `json:"key"`
	Value   string                `json:"value"`
	Version *modules.StateVersion `json:"version"`
}

type ContractTemplateJson

type ContractTemplateJson struct {
	TplId          string   `json:"tpl_id"`
	TplName        string   `json:"tpl_name"`
	TplDescription string   `json:"tpl_description"`
	Path           string   `json:"install_path"`
	Version        string   `json:"tpl_version"`
	Abi            string   `json:"abi"`
	Language       string   `json:"language"`
	AddrHash       []string `json:"addr_hash" rlp:"nil"`
	Size           uint16   `json:"size"`
	Creator        string   `json:"creator"`
}

func ConvertContractTemplate2Json

func ConvertContractTemplate2Json(tpl *modules.ContractTemplate) *ContractTemplateJson

func GetSysContractABI added in v1.0.4

func GetSysContractABI(addr string) *ContractTemplateJson

type CreateProofTransactionCmd

type CreateProofTransactionCmd struct {
	Inputs   []TransactionInput
	Amounts  []AddressAmt `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
	Proof    string
	Extra    string
	LockTime *int64
}

CreateRawTransactionCmd defines the createrawtransaction JSON-RPC command.

func NewCreateProofTransactionCmd

func NewCreateProofTransactionCmd(inputs []TransactionInput, amounts []AddressAmt,
	lockTime *int64, proof string, extra string) *CreateProofTransactionCmd

type CreateRawTransactionCmd

type CreateRawTransactionCmd struct {
	Inputs   []TransactionInput
	Amounts  []AddressAmt `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
	LockTime *int64
}

CreateRawTransactionCmd defines the createrawtransaction JSON-RPC command.

func NewCreateRawTransactionCmd

func NewCreateRawTransactionCmd(inputs []TransactionInput, amounts []AddressAmt,
	lockTime *int64) *CreateRawTransactionCmd

NewCreateRawTransactionCmd returns a new instance which can be used to issue a createrawtransaction JSON-RPC command.

Amounts are in BTC.

type CreateVoteTransactionCmd

type CreateVoteTransactionCmd struct {
	Inputs          []TransactionInput
	Amounts         map[string]decimal.Decimal `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
	LockTime        *int64
	MediatorAddress string
	ExpiredTerm     uint16
}

CreateVoteTransactionCmd defines the createrawtransaction JSON-RPC command.

func NewCreateVoteTransactionCmd

func NewCreateVoteTransactionCmd(inputs []TransactionInput, amounts map[string]decimal.Decimal,
	lockTime *int64, mediatorAddress string, expiredTerm uint16) *CreateVoteTransactionCmd

type DataJson

type DataJson struct {
	Number    int    `json:"row_number"`
	MainData  string `json:"main_data"`
	ExtraData string `json:"extra_data"`
	Reference string `json:"reference"`
}

type DbRowJson

type DbRowJson struct {
	KeyString   string `json:"key_string"`
	KeyHex      string `json:"key_hex"`
	ValueString string `json:"value_string"`
	ValueHex    string `json:"value_hex"`
}

func NewDbRowJson

func NewDbRowJson(key, value []byte) *DbRowJson

type DeployJson

type DeployJson struct {
	Number       int    `json:"row_number"`
	TemplateId   string `json:"tpl_id"`
	ContractId   string `json:"contract_id"`
	Name         string `json:"name"`
	EleNode      string `json:"election_node"`
	ReadSet      string `json:"read_set"`
	WriteSet     string `json:"write_set"`
	DuringTime   uint64 `json:"during_time"`
	ErrorCode    uint32 `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type DeployRequestJson

type DeployRequestJson struct {
	Number  int           `json:"row_number"`
	TplId   string        `json:"tpl_id"`
	Args    []string      `json:"arg_set"`
	Timeout time.Duration `json:"timeout"`
	ExtData string        `json:"extend_data"`
}

type DynamicGlobalPropertyJson added in v1.0.5

type DynamicGlobalPropertyJson struct {
	LastMediator        string `json:"lastMediator"`
	IsShuffledSchedule  bool   `json:"isShuffledSchedule"`
	NextMaintenanceTime string `json:"nextMaintenanceTime"`
	LastMaintenanceTime string `json:"lastMaintenanceTime"`
	CurrentAbsoluteSlot uint64 `json:"currentAbsoluteSlot"`
	RecentSlotsFilled   string `json:"recentSlotsFilled"`
	MaintenanceFlag     bool   `json:"maintenanceFlag"`
}

func DynGlobalPropToJson added in v1.0.5

func DynGlobalPropToJson(dgp *modules.DynamicGlobalProperty) *DynamicGlobalPropertyJson

type ErrorCode

type ErrorCode int
const (
	// ErrDuplicateBlock indicates a block with the same hash already
	// exists.
	ErrDuplicateBlock ErrorCode = iota

	// ErrBlockTooBig indicates the serialized block size exceeds the
	// maximum allowed size.
	ErrBlockTooBig

	// ErrBlockWeightTooHigh indicates that the block's computed weight
	// metric exceeds the maximum allowed value.
	ErrBlockWeightTooHigh

	// ErrBlockVersionTooOld indicates the block version is too old and is
	// no longer accepted since the majority of the network has upgraded
	// to a newer version.
	ErrBlockVersionTooOld

	// ErrInvalidTime indicates the time in the passed block has a precision
	// that is more than one second.  The chain consensus rules require
	// timestamps to have a maximum precision of one second.
	ErrInvalidTime

	// ErrTimeTooOld indicates the time is either before the median time of
	// the last several blocks per the chain consensus rules or prior to the
	// most recent checkpoint.
	ErrTimeTooOld

	// ErrTimeTooNew indicates the time is too far in the future as compared
	// the current time.
	ErrTimeTooNew

	// ErrDifficultyTooLow indicates the difficulty for the block is lower
	// than the difficulty required by the most recent checkpoint.
	ErrDifficultyTooLow

	// ErrUnexpectedDifficulty indicates specified bits do not align with
	// the expected value either because it doesn't match the calculated
	// valued based on difficulty regarted rules or it is out of the valid
	// range.
	ErrUnexpectedDifficulty

	// ErrHighHash indicates the block does not hash to a value which is
	// lower than the required target difficultly.
	ErrHighHash

	// ErrBadMerkleRoot indicates the calculated merkle root does not match
	// the expected value.
	ErrBadMerkleRoot

	// ErrBadCheckpoint indicates a block that is expected to be at a
	// checkpoint height does not match the expected one.
	ErrBadCheckpoint

	// ErrForkTooOld indicates a block is attempting to fork the block chain
	// before the most recent checkpoint.
	ErrForkTooOld

	// ErrCheckpointTimeTooOld indicates a block has a timestamp before the
	// most recent checkpoint.
	ErrCheckpointTimeTooOld

	// ErrNoTransactions indicates the block does not have a least one
	// transaction.  A valid block must have at least the coinbase
	// transaction.
	ErrNoTransactions

	// ErrNoTxInputs indicates a transaction does not have any inputs.  A
	// valid transaction must have at least one input.
	ErrNoTxInputs

	// ErrNoTxOutputs indicates a transaction does not have any outputs.  A
	// valid transaction must have at least one output.
	ErrNoTxOutputs

	// ErrTxTooBig indicates a transaction exceeds the maximum allowed size
	// when serialized.
	ErrTxTooBig

	// ErrBadTxInput indicates a transaction input is invalid in some way
	// such as referencing a previous transaction outpoint which is out of
	// range or not referencing one at all.
	// ErrMissingTxOut indicates a transaction output referenced by an input
	// either does not exist or has already been spent.
	ErrMissingTxOut

	// ErrUnfinalizedTx indicates a transaction has not been finalized.
	// A valid block may only contain finalized transactions.
	ErrUnfinalizedTx

	// ErrDuplicateTx indicates a block contains an identical transaction
	// (or at least two transactions which hash to the same value).  A
	// valid block may only contain unique transactions.
	ErrDuplicateTx

	// ErrOverwriteTx indicates a block contains a transaction that has
	// the same hash as a previous transaction which has not been fully
	// spent.
	ErrOverwriteTx

	// ErrImmatureSpend indicates a transaction is attempting to spend a
	// coinbase that has not yet reached the required maturity.
	ErrImmatureSpend

	// ErrSpendTooHigh indicates a transaction is attempting to spend more
	// value than the sum of all of its inputs.
	ErrSpendTooHigh

	// ErrBadFees indicates the total fees for a block are invalid due to
	// exceeding the maximum possible value.
	ErrBadFees

	// ErrTooManySigOps indicates the total number of signature operations
	// for a transaction or block exceed the maximum allowed limits.
	ErrTooManySigOps

	// ErrFirstTxNotCoinbase indicates the first transaction in a block
	// is not a coinbase transaction.
	ErrFirstTxNotCoinbase

	// ErrMultipleCoinbases indicates a block contains more than one
	// coinbase transaction.
	ErrMultipleCoinbases

	// ErrBadCoinbaseValue indicates the amount of a coinbase value does
	// not match the expected value of the subsidy plus the sum of all fees.
	ErrBadCoinbaseValue

	// ErrMissingCoinbaseHeight indicates the coinbase transaction for a
	// block does not start with the serialized block block height as
	// required for version 2 and higher blocks.
	ErrMissingCoinbaseHeight

	// ErrBadCoinbaseHeight indicates the serialized block height in the
	// coinbase transaction for version 2 and higher blocks does not match
	// the expected value.
	ErrBadCoinbaseHeight

	// ErrScriptMalformed indicates a transaction script is malformed in
	// some way.  For example, it might be longer than the maximum allowed
	// length or fail to parse.
	ErrScriptMalformed

	// ErrScriptValidation indicates the result of executing transaction
	// script failed.  The error covers any failure when executing scripts
	// such signature verification failures and execution past the end of
	// the stack.
	ErrScriptValidation

	// ErrUnexpectedWitness indicates that a block includes transactions
	// with witness data, but doesn't also have a witness commitment within
	// the coinbase transaction.
	ErrUnexpectedWitness

	// ErrInvalidWitnessCommitment indicates that a block's witness
	// commitment is not well formed.
	ErrInvalidWitnessCommitment

	// ErrWitnessCommitmentMismatch indicates that the witness commitment
	// included in the block's coinbase transaction doesn't match the
	// manually computed witness commitment.
	ErrWitnessCommitmentMismatch

	// ErrPreviousBlockUnknown indicates that the previous block is not known.
	ErrPreviousBlockUnknown

	// ErrInvalidAncestorBlock indicates that an ancestor of this block has
	// already failed validation.
	ErrInvalidAncestorBlock

	// ErrPrevBlockNotBest indicates that the block's previous block is not the
	// current chain tip. This is not a block validation rule, but is required
	// for block proposals submitted via getblocktemplate RPC.
	ErrPrevBlockNotBest
)

These constants are used to identify a specific RuleError.

type GetTransactions

type GetTransactions struct {
	Txid    string              `json:"txid"`
	Inputs  []string            `json:"inputs"`
	Outputs []GetTranscationOut `json:"outputs"`
}

type GetTranscationOut

type GetTranscationOut struct {
	Addr  string `json:"address"`
	Value uint64 `json:"vout"`
	Asset string `json:"asset"`
}

type GetTxIdResult

type GetTxIdResult struct {
	Txid     string `json:"txid"`
	Apptype  string `json:"apptype"`
	Content  []byte `json:"content"`
	Coinbase bool   `json:"coinbase"`
	UnitHash string `json:"unit_hash"`
}

GetTxOutResult models the data from the getTransactionsByTxid command.

type HeaderJson

type HeaderJson struct {
	ParentsHash   []common.Hash  `json:"parents_hash"`
	Hash          string         `json:"hash"`
	AuthorAddress string         `json:"mediator_address"`
	AuthorPubKey  string         `json:"mediator_pubkey"`
	AuthorSign    string         `json:"mediator_sign"` // the unit creation authors
	GroupSign     string         `json:"group_sign"`    // 群签名, 用于加快单元确认速度
	GroupPubKey   string         `json:"group_pubKey"`  // 群公钥, 用于验证群签名
	TxRoot        common.Hash    `json:"root"`
	TxsIllegal    []string       `json:"txs_illegal"` //Unit中非法交易索引
	Number        ChainIndexJson `json:"index"`
	Extra         string         `json:"extra"`
	CreationTime  time.Time      `json:"creation_time"` // unit create time
}

func ConvertUnitHeader2Json

func ConvertUnitHeader2Json(header *modules.Header) *HeaderJson

type InputJson

type InputJson struct {
	TxHash       string `json:"txid"`          // reference Utxo struct key field
	MessageIndex uint32 `json:"message_index"` // message index in transaction
	OutIndex     uint32 `json:"out_index"`
	UnlockScript string `json:"unlock_script"`
	//UnlockScriptHex string `json:"unlock_script_hex"`
	FromAddress string `json:"from_address"`
}

type InputSummaryJson added in v1.0.3

type InputSummaryJson struct {
	TxHash       string `json:"txid"`          // reference Utxo struct key field
	MessageIndex uint32 `json:"message_index"` // message index in transaction
	OutIndex     uint32 `json:"out_index"`
	FromAddress  string `json:"from_address"`
}

type InstallRequestJson

type InstallRequestJson struct {
	Number         int      `json:"row_number"`
	TplName        string   `json:"tpl_name"`
	TplDescription string   `json:"tpl_description"`
	Path           string   `json:"path"`
	Version        string   `json:"version"`
	Abi            string   `json:"abi"`
	Language       string   `json:"language"`
	AddrHash       []string `json:"addr_hash"`
}

type InvokeJson

type InvokeJson struct {
	Number       int    `json:"row_number"`
	ContractId   string `json:"contract_id"` // contract id
	ReadSet      string `json:"read_set"`    // the set data of read, and value could be any type
	WriteSet     string `json:"write_set"`   // the set data of write, and value could be any type
	Payload      string `json:"payload"`     // the contract execution result
	ErrorCode    uint32 `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type InvokeRequestJson

type InvokeRequestJson struct {
	Number       int      `json:"row_number"`
	ContractAddr string   `json:"contract_addr"`
	Args         []string `json:"arg_set"`
	Timeout      uint32   `json:"timeout"`
}

type MultiSignRawTransactionCmd added in v1.0.5

type MultiSignRawTransactionCmd struct {
	RawTx    string
	Inputs   *[]RawTxInput
	PrivKeys *[]string
	Flags    *string `jsonrpcdefault:"\"ALL\""`
}

func NewMultiSignRawTransactionCmd added in v1.0.5

func NewMultiSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKeys *[]string, flags *string) *MultiSignRawTransactionCmd

type OutPointJson

type OutPointJson struct {
	TxHashHex    string `json:"txhash"`        // reference Utxo struct key field
	MessageIndex uint32 `json:"message_index"` // message index in transaction
	OutIndex     uint32 `json:"out_index"`
}

func ConvertOutPoint2Json

func ConvertOutPoint2Json(outpoint *modules.OutPoint) *OutPointJson

type OutputJson

type OutputJson struct {
	Amount     uint64 `json:"amount"`
	Asset      string `json:"asset"`
	ToAddress  string `json:"to_address"`
	LockScript string `json:"lock_script"`
}

type OutputSummaryJson added in v1.0.3

type OutputSummaryJson struct {
	Amount    uint64 `json:"amount"`
	Asset     string `json:"asset"`
	ToAddress string `json:"to_address"`
}

type PaymentJson

type PaymentJson struct {
	Inputs   []*InputJson  `json:"inputs"`
	Outputs  []*OutputJson `json:"outputs"`
	LockTime uint32        `json:"locktime"`
	Number   int           `json:"number"`
}

func ConvertPayment2Json

func ConvertPayment2Json(payment *modules.PaymentPayload) *PaymentJson

func ConvertPayment2JsonIncludeFromAddr

func ConvertPayment2JsonIncludeFromAddr(payment *modules.PaymentPayload, utxoQuery modules.QueryUtxoFunc) *PaymentJson

type PaymentSummaryJson added in v1.0.3

type PaymentSummaryJson struct {
	Inputs  []*InputSummaryJson  `json:"inputs"`
	Outputs []*OutputSummaryJson `json:"outputs"`
	Number  int                  `json:"number"`
}

func ConvertPayment2SummaryJson added in v1.0.3

func ConvertPayment2SummaryJson(payment *modules.PaymentPayload, utxoQuery modules.QueryUtxoFunc) *PaymentSummaryJson

type ProofOfExistenceJson

type ProofOfExistenceJson struct {
	Creator    string    `json:"creator"`
	MainData   string    `json:"main_data"`
	ExtraData  string    `json:"extra_data"`
	Reference  string    `json:"reference"`
	UintHeight uint64    `json:"unit_index"`
	TxId       string    `json:"tx_hash"`
	UnitHash   string    `json:"unit_hash"`
	Timestamp  time.Time `json:"timestamp"`
}

func ConvertProofOfExistence2Json

func ConvertProofOfExistence2Json(poe *modules.ProofOfExistence) *ProofOfExistenceJson

func ConvertTx2ProofOfExistence added in v1.0.5

func ConvertTx2ProofOfExistence(tx *TxWithUnitInfoJson) *ProofOfExistenceJson

type ProofTransactionGenParams

type ProofTransactionGenParams struct {
	From    string `json:"from"`
	Outputs []struct {
		Address string          `json:"address"`
		Amount  decimal.Decimal `json:"amount"`
	} `json:"outputs"`
	Proof    string          `json:"proof"`
	Extra    string          `json:"extra"`
	Fee      decimal.Decimal `json:"fee"`
	Locktime int64           `json:"locktime"`
}

type PubKeyFormat

type PubKeyFormat int

PubKeyFormat describes what format to use for a pay-to-pubkey address.

const (
	// PKFUncompressed indicates the pay-to-pubkey address format is an
	// uncompressed public key.
	PKFUncompressed PubKeyFormat = iota

	// PKFCompressed indicates the pay-to-pubkey address format is a
	// compressed public key.
	PKFCompressed

	// PKFHybrid indicates the pay-to-pubkey address format is a hybrid
	// public key.
	PKFHybrid
)

type RPCError

type RPCError struct {
	Code    RPCErrorCode `json:"code,omitempty"`
	Message string       `json:"message,omitempty"`
}

RPCError represents an error that is used as a part of a JSON-RPC Response object.

func NewRPCError

func NewRPCError(code RPCErrorCode, message string) *RPCError

NewRPCError constructs and returns a new JSON-RPC error that is suitable for use in a JSON-RPC Response object.

func (RPCError) Error

func (e RPCError) Error() string

Error returns a string describing the RPC error. This satisifies the builtin error interface.

type RPCErrorCode

type RPCErrorCode int

RPCErrorCode represents an error code to be used as a part of an RPCError which is in turn used in a JSON-RPC Response object.

A specific type is used to help ensure the wrong errors aren't used.

const (
	ErrRPCMisc                RPCErrorCode = -1
	ErrRPCForbiddenBySafeMode RPCErrorCode = -2
	ErrRPCType                RPCErrorCode = -3
	ErrRPCInvalidAddressOrKey RPCErrorCode = -5
	ErrRPCOutOfMemory         RPCErrorCode = -7
	ErrRPCInvalidParameter    RPCErrorCode = -8
	ErrRPCDatabase            RPCErrorCode = -20
	ErrRPCDeserialization     RPCErrorCode = -22
	ErrRPCVerify              RPCErrorCode = -25
)

General application defined JSON errors.

const (
	ErrRPCClientNotConnected      RPCErrorCode = -9
	ErrRPCClientInInitialDownload RPCErrorCode = -10
	ErrRPCClientNodeNotAdded      RPCErrorCode = -24
)

Peer-to-peer client errors.

const (
	ErrRPCWallet                    RPCErrorCode = -4
	ErrRPCWalletInsufficientFunds   RPCErrorCode = -6
	ErrRPCWalletInvalidAccountName  RPCErrorCode = -11
	ErrRPCWalletKeypoolRanOut       RPCErrorCode = -12
	ErrRPCWalletUnlockNeeded        RPCErrorCode = -13
	ErrRPCWalletPassphraseIncorrect RPCErrorCode = -14
	ErrRPCWalletWrongEncState       RPCErrorCode = -15
	ErrRPCWalletEncryptionFailed    RPCErrorCode = -16
	ErrRPCWalletAlreadyUnlocked     RPCErrorCode = -17
)

Wallet JSON errors

const (
	ErrRPCBlockNotFound     RPCErrorCode = -5
	ErrRPCBlockCount        RPCErrorCode = -5
	ErrRPCBestBlockHash     RPCErrorCode = -5
	ErrRPCDifficulty        RPCErrorCode = -5
	ErrRPCOutOfRange        RPCErrorCode = -1
	ErrRPCNoTxInfo          RPCErrorCode = -5
	ErrRPCNoCFIndex         RPCErrorCode = -5
	ErrRPCNoNewestBlockInfo RPCErrorCode = -5
	ErrRPCInvalidTxVout     RPCErrorCode = -5
	ErrRPCRawTxString       RPCErrorCode = -32602
	ErrRPCDecodeHexString   RPCErrorCode = -22
	ErrBadTxOutValue        RPCErrorCode = -23
	ErrDuplicateTxInputs    RPCErrorCode = -24
	ErrBadCoinbaseScriptLen RPCErrorCode = -25
	ErrBadTxInput           RPCErrorCode = -26
)

type RawTransactionGenParams

type RawTransactionGenParams struct {
	Inputs []struct {
		Txid         string `json:"txid"`
		Vout         uint32 `json:"vout"`
		MessageIndex uint32 `json:"messageindex"`
	} `json:"inputs"`
	Outputs []struct {
		Address string          `json:"address"`
		Amount  decimal.Decimal `json:"amount"`
	} `json:"outputs"`
	Locktime int64 `json:"locktime"`
}

type RawTxInput

type RawTxInput struct {
	Txid         string `json:"txid"`
	Vout         uint32 `json:"vout"`
	MessageIndex uint32 `json:"messageindex"`
	ScriptPubKey string `json:"scriptPubKey"`
	RedeemScript string `json:"redeemScript"`
}

type SignRawTransactionCmd

type SignRawTransactionCmd struct {
	RawTx    string
	Inputs   *[]RawTxInput
	PrivKeys *[]string
	Flags    *string `jsonrpcdefault:"\"ALL\""`
}

SignRawTransactionCmd defines the signrawtransaction JSON-RPC command.

func NewSignRawTransactionCmd

func NewSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKeys *[]string, flags *string) *SignRawTransactionCmd

type SignRawTransactionError

type SignRawTransactionError struct {
	TxID      string `json:"txid"`
	ScriptSig string `json:"scriptSig"`
	Error     string `json:"error"`
	Vout      uint32 `json:"vout"`
	Sequence  uint32 `json:"sequence"`
}

type SignRawTransactionResult

type SignRawTransactionResult struct {
	Hex      string                    `json:"hex"`
	Txid     string                    `json:"txid"`
	Complete bool                      `json:"complete"`
	Errors   []SignRawTransactionError `json:"errors,omitempty"`
}

type SignatureJson

type SignatureJson struct {
	Number     int      `json:"row_number"`
	Signatures []string `json:"signature_set"` // the array of signature
}

type StopJson

type StopJson struct {
	Number     int    `json:"row_number"`
	ContractId string `json:"contract_id"`
	//Jury         []string `json:"jury"`
	ReadSet      string `json:"read_set"`
	WriteSet     string `json:"write_set"`
	ErrorCode    uint32 `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type StopRequestJson

type StopRequestJson struct {
	Number      int    `json:"row_number"`
	ContractId  string `json:"contract_id"`
	DeleteImage bool   `json:"delete_image"`
}

type StxoJson added in v1.0.1

type StxoJson struct {
	TxHash         string    `json:"txid"`          // reference Utxo struct key field
	MessageIndex   uint32    `json:"message_index"` // message index in transaction
	OutIndex       uint32    `json:"out_index"`
	Amount         uint64    `json:"amount"`           // 数量
	Asset          string    `json:"asset"`            // 资产类别
	PkScriptHex    string    `json:"pk_script_hex"`    // 要执行的代码段
	PkScriptString string    `json:"pk_script_string"` // 要执行的代码段
	Time           time.Time `json:"create_time"`      //创建该UTXO的时间(打包到Unit的时间)
	LockTime       uint32    `json:"lock_time"`        //
	SpentByTxId    string    `json:"spent_by_tx_id"`   //
	SpentTime      time.Time `json:"spent_time"`       //

}

func ConvertStxo2Json added in v1.0.1

func ConvertStxo2Json(outPoint *modules.OutPoint, stxo *modules.Stxo) *StxoJson

type TokenFlowJson added in v1.0.3

type TokenFlowJson struct {
	TxHash        string          `json:"tx_hash"`
	UnitHash      string          `json:"unit_hash"`
	Timestamp     string          `json:"timestamp"`
	Direction     string          `json:"direction"` // + -
	FromAddresses string          `json:"from_addrs"`
	ToAddresses   string          `json:"to_addrs"`
	Amount        decimal.Decimal `json:"amount"`
	Fee           decimal.Decimal `json:"fee"`
	Asset         string          `json:"asset"`
	Balance       decimal.Decimal `json:"balance"`
}

func ConvertTx2TokenFlowJson added in v1.0.3

func ConvertTx2TokenFlowJson(addr common.Address, token *modules.Asset, preBalance uint64,
	tx *modules.TransactionWithUnitInfo, utxoQuery modules.QueryUtxoFunc) ([]*TokenFlowJson, uint64)

type TplJson

type TplJson struct {
	Number       int    `json:"row_number"`
	TemplateId   string `json:"template_id"`
	Bytecode     []byte `json:"bytecode"`      // contract bytecode
	BytecodeSize int    `json:"bytecode_size"` // contract bytecode
	ErrorCode    uint32 `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type TransactionInput

type TransactionInput struct {
	Txid         string `json:"txid"`
	Vout         uint32 `json:"vout"`
	MessageIndex uint32 `json:"messageindex"`
}

TransactionInput represents the inputs to a transaction. Specifically a transaction hash and output number pair.

type TxHashWithUnitInfoJson added in v1.0.6

type TxHashWithUnitInfoJson struct {
	TxHash      string    `json:"tx_hash"`
	RequestHash string    `json:"request_hash"`
	UnitHash    string    `json:"unit_hash"`
	UnitHeight  uint64    `json:"unit_height"`
	Timestamp   time.Time `json:"timestamp"`
	TxIndex     uint64    `json:"tx_index"`
}

type TxHistoryJson

type TxHistoryJson struct {
	TxHash     string       `json:"tx_hash"`
	UnitHash   string       `json:"unit_hash"`
	UnitHeight uint64       `json:"unit_height"`
	TxSize     float64      `json:"tx_size"`
	Payment    *PaymentJson `json:"payment"`

	Data *DataJson `json:"data"`
	//InstallRequest *InstallRequestJson `json:"install_request"`
	//DeployRequest  *DeployRequestJson  `json:"deploy_request"`
	InvokeRequest *InvokeRequestJson `json:"invoke_request"`
	//StopRequest    *StopRequestJson    `json:"stop_request"`
	Timestamp string `json:"timestamp"`
}

type TxJson

type TxJson struct {
	TxHash             string              `json:"tx_hash"`
	RequestHash        string              `json:"request_hash"`
	TxSize             float64             `json:"tx_size"`
	Version            uint32              `json:"version"`
	Nonce              uint64              `json:"nonce"`
	Payment            []*PaymentJson      `json:"payment"`
	Fee                uint64              `json:"fee"`
	AccountStateUpdate *AccountStateJson   `json:"account_state_update"`
	Data               []*DataJson         `json:"data"`
	ContractTpl        *TplJson            `json:"contract_tpl"`
	Deploy             *DeployJson         `json:"contract_deploy"`
	Invoke             *InvokeJson         `json:"contract_invoke"`
	Stop               *StopJson           `json:"contract_stop"`
	Signature          *SignatureJson      `json:"signature"`
	InstallRequest     *InstallRequestJson `json:"install_request"`
	DeployRequest      *DeployRequestJson  `json:"deploy_request"`
	InvokeRequest      *InvokeRequestJson  `json:"invoke_request"`
	StopRequest        *StopRequestJson    `json:"stop_request"`
}

func ConvertTx2FullJson

func ConvertTx2FullJson(tx *modules.Transaction,
	utxoQuery modules.QueryUtxoFunc) *TxJson

type TxPackInfoJson added in v1.0.6

type TxPackInfoJson struct {
	UnitHash    string    `json:"unit_hash"`
	RequestHash string    `json:"request_hash"`
	UnitHeight  uint64    `json:"unit_height"`
	Timestamp   time.Time `json:"timestamp"`
	TxIndex     uint64    `json:"tx_index"`
	TxHash      string    `json:"tx_hash"`
	Error       string    `json:"error"`
}

func ConvertTxPackInfoJson added in v1.0.6

func ConvertTxPackInfoJson(txInfo *modules.TxPackInfo) *TxPackInfoJson

type TxPoolPendingJson

type TxPoolPendingJson struct {
	TxHash       string    `json:"tx_hash"`
	Fee          uint64    `json:"fee"`
	Asset        string    `json:"asset"`
	CreationDate time.Time `json:"creation_date"`
	Amount       uint64    `json:"amount"`
}

func ConvertTxPoolTx2PendingJson

func ConvertTxPoolTx2PendingJson(tx *txspool.TxPoolTransaction) *TxPoolPendingJson

type TxPoolTxJson

type TxPoolTxJson struct {
	TxHash     string       `json:"tx_hash"`
	Version    uint32       `json:"version"`
	Nonce      uint64       `json:"nonce"`
	UnitHash   string       `json:"unit_hash"`
	UnitIndex  uint64       `json:"unit_index"`
	Timestamp  uint64       `json:"timestamp"`
	TxIndex    uint64       `json:"tx_index"`
	Payment    *PaymentJson `json:"payment"`
	TxMessages string       `json:"tx_messages"`

	Froms        []*OutPointJson `json:"froms"`
	CreationDate time.Time       `json:"creation_date"`
	Priority     float64         `json:"priority"` // 打包的优先级
	Pending      bool            `json:"pending"`
	Confirmed    bool            `json:"confirmed"`
	IsOrphan     bool            `json:"is_orphan"`
	NotExsit     bool            `json:"not_exist"`
	Index        int             `json:"index"` // index 是该tx在优先级堆中的位置
	Extra        []byte          `json:"extra"`
	TxHex        string          `json:"tx_hex"`
}

func ConvertTxPoolTx2Json

func ConvertTxPoolTx2Json(tx *txspool.TxPoolTransaction, hash common.Hash) *TxPoolTxJson

func ConvertTxWithInfo2Json added in v1.0.4

func ConvertTxWithInfo2Json(tx *modules.TransactionWithUnitInfo) *TxPoolTxJson

type TxSerachEntryJson

type TxSerachEntryJson struct {
	UnitHash  string `json:"unit_hash"`
	AssetId   string `json:"asset_id"`
	UnitIndex uint64 `json:"unit_index"`
	TxIndex   uint64 `json:"tx_index"`
}

func ConvertTxEntry2Json

func ConvertTxEntry2Json(entry *modules.TxLookupEntry) *TxSerachEntryJson

type TxSummaryJson

type TxSummaryJson struct {
	TxHash      string       `json:"tx_hash"`
	RequestHash string       `json:"request_hash"`
	Version     uint32       `json:"version"`
	Nonce       uint64       `json:"nonce"`
	TxSize      float64      `json:"tx_size"`
	Payment     *PaymentJson `json:"payment"`
	TxMessages  string       `json:"tx_messages"`
	UnitHash    string       `json:"unit_hash"`
	UnitHeight  uint64       `json:"unit_height"`
	Timestamp   time.Time    `json:"timestamp"`
	TxIndex     uint64       `json:"tx_index"`
}

func ConvertTx2SummaryJson

func ConvertTx2SummaryJson(tx *modules.Transaction,
	unitHash common.Hash,
	unitHeigth uint64,
	unitTimestamp int64,
	txIndex uint64,
	utxoQuery modules.QueryUtxoFunc) *TxSummaryJson

func ConvertTxWithUnitInfo2SummaryJson

func ConvertTxWithUnitInfo2SummaryJson(tx *modules.TransactionWithUnitInfo,
	utxoQuery modules.QueryUtxoFunc) *TxSummaryJson

type TxWithUnitInfoJson

type TxWithUnitInfoJson struct {
	*TxJson
	UnitHash   string    `json:"unit_hash"`
	UnitHeight uint64    `json:"unit_height"`
	Timestamp  time.Time `json:"timestamp"`
	TxIndex    uint64    `json:"tx_index"`
}

type UnitJson

type UnitJson struct {
	UnitHeader *HeaderJson        `json:"unit_header"`  // unit header
	Txs        []*TxJson          `json:"transactions"` // transaction list
	UnitHash   common.Hash        `json:"unit_hash"`    // unit hash
	UnitSize   common.StorageSize `json:"unit_size"`    // unit size
	Reward     decimal.Decimal    `json:"reward"`       //区块奖励
}

func ConvertUnit2Json

func ConvertUnit2Json(unit *modules.Unit, utxoQuery modules.QueryUtxoFunc,
	versionFunc modules.QueryStateByVersionFunc, enableGasFee bool) *UnitJson

type UnitPropertyJson added in v1.0.5

type UnitPropertyJson struct {
	Hash      common.Hash `json:"hash"`
	Number    uint64      `json:"number"`
	Timestamp string      `json:"timestamp"`
}

func UnitPropertyToJson added in v1.0.5

func UnitPropertyToJson(up *modules.UnitProperty) *UnitPropertyJson

type UnitSummaryJson

type UnitSummaryJson struct {
	UnitHeader *HeaderJson        `json:"unit_header"`  // unit header
	Txs        []common.Hash      `json:"transactions"` // transaction list
	UnitHash   common.Hash        `json:"unit_hash"`    // unit hash
	UnitSize   common.StorageSize `json:"unit_size"`    // unit size
	TxCount    int                `json:"transaction_count"`
}

func ConvertUnit2SummaryJson

func ConvertUnit2SummaryJson(unit *modules.Unit) *UnitSummaryJson

type UtxoJson

type UtxoJson struct {
	TxHash         string    `json:"txid"`          // reference Utxo struct key field
	MessageIndex   uint32    `json:"message_index"` // message index in transaction
	OutIndex       uint32    `json:"out_index"`
	Amount         uint64    `json:"amount"`           // 数量
	Asset          string    `json:"asset"`            // 资产类别
	PkScriptHex    string    `json:"pk_script_hex"`    // 要执行的代码段
	PkScriptString string    `json:"pk_script_string"` // 要执行的代码段
	Time           time.Time `json:"create_time"`      //创建该UTXO的时间(打包到Unit的时间)
	LockTime       uint32    `json:"lock_time"`        //
	FlagStatus     string    `json:"flag_status"`      // utxo状态
	CoinDays       uint64    `json:"coin_days"`        //这个Utxo存在多少天了。用于计算利息

}

func ConvertUtxo2Json

func ConvertUtxo2Json(outPoint *modules.OutPoint, utxo *modules.Utxo) *UtxoJson

func (*UtxoJson) GetAmount

func (utxo *UtxoJson) GetAmount() uint64

type VoteTransactionGenParams

type VoteTransactionGenParams struct {
	Inputs []struct {
		Txid         string `json:"txid"`
		Vout         uint32 `json:"vout"`
		MessageIndex uint32 `json:"messageindex"`
	} `json:"inputs"`
	Outputs []struct {
		Address string  `json:"address"`
		Amount  float64 `json:"amount"`
	} `json:"outputs"`
	Locktime int64 `json:"locktime"`
	// Additional fields
	MediatorAddress string `json:"mediatoraddress"`
	ExpiredTerm     uint16 `json:"expiredterm"`
}

type WIF

type WIF struct {
	// PrivKey is the private key being imported or exported.
	PrivKey *ecdsa.PrivateKey

	// CompressPubKey specifies whether the address controlled by the
	// imported or exported private key was created by hashing a
	// compressed (33-byte) serialized public key, rather than an
	// uncompressed (65-byte) one.
	CompressPubKey bool
	// contains filtered or unexported fields
}

func NewWIF

func NewWIF(privKey *ecdsa.PrivateKey, netid byte, compress bool) (*WIF, error)

func (*WIF) SerializePubKey

func (w *WIF) SerializePubKey() []byte

SerializePubKey serializes the associated public key of the imported or exported private key in either a compressed or uncompressed format. The serialization format chosen depends on the value of w.CompressPubKey.

func (*WIF) String

func (w *WIF) String() string

String creates the Wallet Import Format string encoding of a WIF structure. See DecodeWIF for a detailed breakdown of the format and requirements of a valid WIF string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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