-
Notifications
You must be signed in to change notification settings - Fork 2
Base module
hihiben edited this page Jan 30, 2018
·
4 revisions
-
GETtransaction/[:tx_id] -
GETtransaction/prepare -
POSTtransaction/send -
POSTgeneral-transaction/prepare
-
GETbalance/[:address]
-
GETaddresses/[:address]/utxo
Get transaction information.
None
{
"hash": "7235f671b50a2965f95b55e713ab365657264d0a5b4c42a41531cf50c2228138",
"blockhash": "000006a3c4709a92b48229f43b6ffccdf9ade3c698bd9c7039621c51a65f7588",
"hex": "02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510103ffffffff0200f2052a01000000232103e3e8f17d8a39e4b541713534ddf4e1c826a874b888e00a8d8a3b2f892a03150fac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf900000000",
"vouts": [
{
"scriptPubKey":
{
"regSigs": 1,
"hex": "2103e3e8f17d8a39e4b541713534ddf4e1c826a874b888e00a8d8a3b2f892a03150fac",
"addresses": ["1Q8HJw4JNa83nv68GdtKCWsy97ZvC5TkCV"],
"asm": "03e3e8f17d8a39e4b541713534ddf4e1c826a874b888e00a8d8a3b2f892a03150f OP_CHECKSIG",
"type": "pubkey"
},
"value": "50.00000000",
"n": 0
},
{
"scriptPubKey":
{
"type": "nulldata",
"hex": "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
"asm": "OP_RETURN aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9"
},
"value": "0E-8", "n": 1
}
],
"blocktime": 1510911092,
"version": 2,
"confirmations": 2932,
"time": 1510911092,
"locktime": 0,
"vsize": 145,
"vins": [
{
"coinbase": "510103",
"sequence": 4294967295
}
],
"size": 145
}
Create a simple raw transaction that sends an amount of bitcoin to another address.
| Field | Type | Description |
|---|---|---|
| from_address | str | address |
| to_address | str | address |
| amount | str | amount |
| op_return_data (optional) | str | op return data (max 80 bytes) |
{
"raw_tx": "02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510103ffffffff0200f2052a01000000232103e3e8f17d8a39e4b541713534ddf4e1c826a874b888e00a8d8a3b2f892a03150fac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf900000000"
}
Broadcast transaction.
raw_tx
{
"tx_id": "c0daefcf66be12f4e3f426c8b08babf437d7945e70bacee492df2c4a04b801e1"
}
Create a general raw transaction that sends bitcoin from multiple addresses to others.
Each sender should decide the amount and fee they want to provide.
op_return_data is optional for recording extra information on chain.
{
"tx_in": # (required)
[
{
"from_address": "", # (required)
"amount": "", # (required)
"fee": "" # (optional)
},
......
],
"tx_out": # (required)
[
{
"to_address": "", # (required)
"amount": "" # (required)
},
......
],
"op_return_data": "Hello blockchain." # (optional)
}
{
"raw_tx": "01000000017e0b0880b36a7519be9ffccced0a37d100de2bbae13c41d415b683a7318cb11f00000000232103be54b29ee3ced0e6866e58469c5c0a9b7b485cadaa21cb711d5821c72185fdd0acffffffff0200e1f505000000001976a9144dbb7f813bc7899ae6a4f6b549abe7821b0e2d9088ac570400000000000000000000f76a4cf437323131303131303039373436353733373435663665363136643635313736343635373336333732363937303734363936663665356636383635366336633666356637373666373236633634303436653666366536353031303030303030303030303030303030303030303030303030303436653666366536353030303030303030303030303030303030303030303030303030306637373737373732653635373836313664373036633635326536333666366430303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030570400000000000002000000"
}
Get balance information (in BTC).
None
{
"balance": "<amount>"
}
{
"balance": "433.55999999"
}
Get the UTXOs of an address.
[
{
"scriptPubKey": "2102aa807427661f42517c12c230baf5af9035ece89f2312432c18063e164dab0b6cac",
"value": "1.00000000",
"vout": 1,
"txid": "13fc90bf70cee8367860c615dc261e82d0666ada72c9aa6785e23dfba5b56e00"
},
{
"scriptPubKey": "2102aa807427661f42517c12c230baf5af9035ece89f2312432c18063e164dab0b6cac",
"value": "1.00000000",
"vout": 1,
"txid": "fcd0c7ba379b97c156a0bd78c8d3f2b9acdd42416011d0b4ccede219c2850801"
}
]