基于网页接口 Bitcoin API JSON-RPC

生成多重签名地址命令: createmultisig B

这个createmultisig RPC命令用来生成 P2SH(Pay To Script Hash)多重签名地址。多重签名地址是以3开头的地址,若妥善使用会比1开头的地址更加安全。

Parameter #1—the number of signatures required
输入参数 #1- 需要多少个签名
Parameter #2—the full public keys, or addresses for known public keys
输入参数 #2- 各公钥字串,或已公开公钥的地址
Result—P2SH address and hex-encoded redeem script
输出结过 - P2SH地址和16进制的类似公钥的脚本字串

填写需要多少个私钥来花费 M-of-N 多重签名地址里的币。不要超过下面的公钥数N。
点击 "+" 号来增加公钥数, "-" 来移除减少。公钥字串可在"脑钱包信息"的最后面找到,公钥字串与地址类似不需保密,发过币的已经公开。故不怕ChainQuery记录提交的公钥。
{
	"result": {
		"address": "3Hh2YV5iWpHZRzLfAXw92ncYtr1VNkMaw2",
		"redeemScript": "514104ee55e0937e8115edd6bbafbbc660dc4a915b5e9db6a7529a579049802199706e5040dc45f0842a831acb926737fcbc796f4e654ba5fb777117405a4d68f94ab651ae"
	},
	"error": null,
	"id": null
}
createmultisig nrequired ["key",...]

Creates a multi-signature address with n signature of m keys required.
It returns a json object with the address and redeemScript.

Arguments:
1. nrequired      (numeric, required) The number of required signatures out of the n keys or addresses.
2. "keys"       (string, required) A json array of keys which are bitcoin addresses or hex-encoded public keys
     [
       "key"    (string) bitcoin address or hex-encoded public key
       ,...
     ]

Result:
{
  "address":"multisigaddress",  (string) The value of the new multisig address.
  "redeemScript":"script"       (string) The string value of the hex-encoded redemption script.
}

Examples:

Create a multisig address from 2 addresses
> bitcoin-cli createmultisig 2 "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]"

As a json rpc call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createmultisig", "params": [2, "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/