Documentation ¶
Index ¶
- Constants
- Variables
- func BitcoindRegtest() (closeChan chan struct{}, err error)
- func CliAddmultisigaddress(cmd btcjson.AddMultisigAddressCmd) (btcjson.CreateMultiSigResult, error)
- func CliCreatemultisig(nRequired uint8, keys []string, addressType *string) (btcjson.CreateMultiSigResult, error)
- func CliCreaterawtransaction(cmd btcjson.CreateRawTransactionCmd) (string, error)
- func CliDecoderawtransaction(cmd btcjson.DecodeRawTransactionCmd) (*btcjson.DecodeRawTransactionResult, error)
- func CliDecodescript(hex string) (btcjson.DecodeScriptResult, error)
- func CliDumpprivkey(addr string) (string, error)
- func CliGeneratetoaddress(nBlocks uint, address string, maxtriesPtr *uint) ([]string, error)
- func CliGetAddressInfo(addr string) (*btcjson.GetAddressInfoResp, error)
- func CliGetWalletInfo() map[string]interface{}
- func CliGetbestblockhash() (string, error)
- func CliGetblock(hash string, verbosity int) (*string, *btcjson.GetBlockResultV1, *btcjson.GetBlockResultV2, error)
- func CliGetblockcount() (int, error)
- func CliGetblockhash(height int) (string, error)
- func CliGetnewaddress(labelPtr, addressTypePtr *string) (hexedAddress string, err error)
- func CliGetrawtransaction(cmd btcjson.GetRawTransactionCmd) (*btcjson.RawTx, error)
- func CliGetreceivedbyaddress(addr string, minconf int) (string, error)
- func CliGettransaction(txid string, includeWatchonly bool) (*btcjson.GetTransactionResult, error)
- func CliImportaddress(cmd btcjson.ImportAddressCmd) error
- func CliImportprivkey(cmd btcjson.ImportPrivKeyCmd) error
- func CliImportpubkey(cmd btcjson.ImportPubKeyCmd) error
- func CliListunspent(minconf, maxconf int, addresses []string, includeUnsafe *bool, ...) ([]btcjson.ListUnspentResult, error)
- func CliSendrawtransaction(cmd btcjson.SendRawTransactionCmd) (string, error)
- func CliSendtoaddress(cmd *btcjson.SendToAddressCmd) (string, error)
- func CliSignrawtransactionwithkey(cmd btcjson.SignRawTransactionCmd) (btcjson.SignRawTransactionResult, error)
- func IfOrString(flag bool, trueS, falseS string) string
- func ToJson(i interface{}) string
- func ToJsonIndent(i interface{}) string
- type Addr
- type ValidateAddressResp
Constants ¶
const ( RPCUser = "rpcusr" RPCPasswd = "233" RPCPortRegtest = 18443 BitcoinBinPathEnv = "BITCOIN_BIN_PATH" CmdParamRegtest = "-regtest" )
固定常量
Variables ¶
var ( BasePath = "/Users/some_user/Applications/bitcoin/bin" //see init() CmdBitcoind = BasePath + "/bitcoind" CmdBitcoinCli = BasePath + "/bitcoin-cli" )
bitcoin bin path
var (
PrintCmdOut = true
)
global vars
Functions ¶
func BitcoindRegtest ¶
func BitcoindRegtest() (closeChan chan struct{}, err error)
BitcoindRegtest 启动bitcoind -regtest 用以测试,
func CliAddmultisigaddress ¶
func CliAddmultisigaddress(cmd btcjson.AddMultisigAddressCmd) (btcjson.CreateMultiSigResult, error)
func CliCreatemultisig ¶
func CliCreatemultisig(nRequired uint8, keys []string, addressType *string) (btcjson.CreateMultiSigResult, error)
CliCreatemultisig https://bitcoin.org/en/developer-reference#createmultisig
func CliCreaterawtransaction ¶
func CliCreaterawtransaction(cmd btcjson.CreateRawTransactionCmd) (string, error)
CliCreaterawtransaction https://bitcoin.org/en/developer-reference#createrawtransaction
func CliDecoderawtransaction ¶
func CliDecoderawtransaction(cmd btcjson.DecodeRawTransactionCmd) (*btcjson.DecodeRawTransactionResult, error)
CliDecoderawtransaction https://bitcoin.org/en/developer-reference#decoderawtransaction
func CliDecodescript ¶
func CliDecodescript(hex string) (btcjson.DecodeScriptResult, error)
CliDecodescript https://bitcoin.org/en/developer-reference#decodescript
func CliDumpprivkey ¶
CliDumpprivkey https://bitcoin.org/en/developer-reference#dumpprivkey
func CliGeneratetoaddress ¶
CliGeneratetoaddress https://bitcoin.org/en/developer-reference#generatetoaddress
func CliGetAddressInfo ¶
func CliGetAddressInfo(addr string) (*btcjson.GetAddressInfoResp, error)
func CliGetWalletInfo ¶
func CliGetWalletInfo() map[string]interface{}
func CliGetbestblockhash ¶
func CliGetblock ¶
func CliGetblock(hash string, verbosity int) (*string, *btcjson.GetBlockResultV1, *btcjson.GetBlockResultV2, error)
CliGetblock https://bitcoin.org/en/developer-reference#getblock
func CliGetblockcount ¶
func CliGetblockhash ¶
func CliGetnewaddress ¶
CliGetnewaddress https://bitcoin.org/en/developer-reference#getnewaddress
func CliGetrawtransaction ¶
func CliGetrawtransaction(cmd btcjson.GetRawTransactionCmd) (*btcjson.RawTx, error)
CliGetrawtransaction .
func CliGetreceivedbyaddress ¶
CliGetreceivedbyaddress https://bitcoin.org/en/developer-reference#getreceivedbyaddress
func CliGettransaction ¶
func CliGettransaction(txid string, includeWatchonly bool) (*btcjson.GetTransactionResult, error)
CliGettransaction https://bitcoin.org/en/developer-reference#gettransaction
func CliImportaddress ¶
func CliImportaddress(cmd btcjson.ImportAddressCmd) error
CliImportaddress .
func CliImportprivkey ¶
func CliImportprivkey(cmd btcjson.ImportPrivKeyCmd) error
CliImportprivkey https://bitcoin.org/en/developer-reference#importprivkey
func CliImportpubkey ¶
func CliImportpubkey(cmd btcjson.ImportPubKeyCmd) error
CliImportpubkey https://bitcoin.org/en/developer-reference#importpubkey
func CliListunspent ¶
func CliListunspent(minconf, maxconf int, addresses []string, includeUnsafe *bool, query *btcjson.ListUnspentQueryOptions) ([]btcjson.ListUnspentResult, error)
CliListunspent https://bitcoin.org/en/developer-reference#listunspent
func CliSendrawtransaction ¶
func CliSendrawtransaction(cmd btcjson.SendRawTransactionCmd) (string, error)
CliSendrawtransaction https://bitcoin.org/en/developer-reference#sendrawtransaction
func CliSendtoaddress ¶
func CliSendtoaddress(cmd *btcjson.SendToAddressCmd) (string, error)
CliSendtoaddress https://bitcoin.org/en/developer-reference#sendtoaddress
func CliSignrawtransactionwithkey ¶
func CliSignrawtransactionwithkey(cmd btcjson.SignRawTransactionCmd) (btcjson.SignRawTransactionResult, error)
CliSignrawtransactionwithkey https://bitcoin.org/en/developer-reference#signrawtransactionwithkey
func IfOrString ¶
IfOrString if flag return s ,or s2
func ToJsonIndent ¶
func ToJsonIndent(i interface{}) string
Types ¶
type Addr ¶
func CliToolGetSomeAddrs ¶
CliToolGetSomeAddrs 一次获取n个地址(包含pub-priv key)
type ValidateAddressResp ¶
type ValidateAddressResp struct { Isvalid bool `json:"isvalid"` Address string `json:"address"` ScriptPubKey string `json:"scriptPubKey"` Isscript bool `json:"isscript"` Iswitness bool `json:"iswitness"` WitnessVersion string `json:"witness_version"` // version (numeric, optional) The version number of the witness program WitnessProgram string `json:"witness_program"` // "hex" (string, optional) The hex value of the witness program }
ValidateAddressResp .
func CliValidateaddress ¶
func CliValidateaddress(addr string) (ValidateAddressResp, error)
CliValidateaddress .