Documentation ¶
Index ¶
- Constants
- func AuditContract(testnet bool, params libs.AuditParams) (*libs.AuditResult, error)
- func ExtractSecret(redemptionTx string, secretHash string) (string, error)
- func GetNewAddress(testnet bool, rpcinfo libs.RPCInfo) (string, error)
- func GetTx(testnet bool, rpcinfo libs.RPCInfo, txid string) (*libs.GetTxResult, error)
- func Initiate(testnet bool, rpcinfo libs.RPCInfo, params libs.InitiateParams) (*libs.InitiateResult, error)
- func Participate(testnet bool, rpcinfo libs.RPCInfo, params libs.ParticipateParams) (*libs.ParticipateResult, error)
- func PingRPC(testnet bool, rpcinfo libs.RPCInfo) error
- func Publish(testnet bool, rpcinfo libs.RPCInfo, tx string) (string, error)
- func Redeem(testnet bool, rpcinfo libs.RPCInfo, params libs.RedeemParams) (*libs.RedeemResult, error)
- func Refund(testnet bool, rpcinfo libs.RPCInfo, params libs.RefundParams) (*libs.RefundResult, error)
- type Amount
- type AmountUnit
Constants ¶
const ( // SatoshiPerBitcent is the number of satoshi in one bitcoin cent. SatoshiPerBitcent = 1e6 // SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC). SatoshiPerBitcoin = 1e8 // MaxSatoshi is the maximum transaction amount allowed in satoshi. MaxSatoshi = 21e6 * SatoshiPerBitcoin )
Variables ¶
This section is empty.
Functions ¶
func AuditContract ¶
func AuditContract(testnet bool, params libs.AuditParams) (*libs.AuditResult, error)
AuditContract command
func ExtractSecret ¶
ExtractSecret returns a secret from the scriptSig of a transaction redeeming a contract
func GetNewAddress ¶
GetNewAddress gets a new address from the controlled wallet
func Initiate ¶
func Initiate(testnet bool, rpcinfo libs.RPCInfo, params libs.InitiateParams) (*libs.InitiateResult, error)
Initiate command builds a P2SH contract and a transaction to fund it
func Participate ¶
func Participate(testnet bool, rpcinfo libs.RPCInfo, params libs.ParticipateParams) (*libs.ParticipateResult, error)
Participate command builds a P2SH contract and a transaction to fund it
func Redeem ¶
func Redeem(testnet bool, rpcinfo libs.RPCInfo, params libs.RedeemParams) (*libs.RedeemResult, error)
Redeem command builds a transaction to redeem a contract
func Refund ¶
func Refund(testnet bool, rpcinfo libs.RPCInfo, params libs.RefundParams) (*libs.RefundResult, error)
Refund command builds a refund transaction for an unredeemed contract
Types ¶
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.
func NewAmount ¶
NewAmount creates an Amount from a floating point value representing some value in bitcoin. NewAmount errors if f is NaN or +-Infinity, but does not check that the amount is within the total amount of bitcoin producible as f may not refer to an amount at a single moment in time.
NewAmount is for specifically for converting XZC to Satoshi. For creating a new Amount with an int64 value which denotes a quantity of Satoshi, do a simple type conversion from type int64 to Amount. See GoDoc for example: http://godoc.org/github.com/btcsuite/xzcutil#example-Amount
func (Amount) Format ¶
func (a Amount) Format(u AmountUnit) string
Format formats a monetary amount counted in bitcoin base units as a string for a given unit. The conversion will succeed for any unit, however, known units will be formated with an appended label describing the units with SI notation, or "Satoshi" for the base unit.
func (Amount) MulF64 ¶
MulF64 multiplies an Amount by a floating point value. While this is not an operation that must typically be done by a full node or wallet, it is useful for services that build on top of bitcoin (for example, calculating a fee by multiplying by a percentage).
func (Amount) ToUnit ¶
func (a Amount) ToUnit(u AmountUnit) float64
ToUnit converts a monetary amount counted in bitcoin base units to a floating point value representing an amount of bitcoin.
type AmountUnit ¶
type AmountUnit int
AmountUnit describes a method of converting an Amount to something other than the base unit of a bitcoin. The value of the AmountUnit is the exponent component of the decadic multiple to convert from an amount in bitcoin to an amount counted in units.
const ( AmountMegaXZC AmountUnit = 6 AmountKiloXZC AmountUnit = 3 AmountXZC AmountUnit = 0 AmountMilliXZC AmountUnit = -3 AmountMicroXZC AmountUnit = -6 AmountSatoshi AmountUnit = -8 )
These constants define various units used when describing a bitcoin monetary amount.
func (AmountUnit) String ¶
func (u AmountUnit) String() string
String returns the unit as a string. For recognized units, the SI prefix is used, or "Satoshi" for the base unit. For all unrecognized units, "1eN XZC" is returned, where N is the AmountUnit.