-
Notifications
You must be signed in to change notification settings - Fork 0
LWS webApi Document
LWS(Light wallet service) is an extendable light wallet service platform. As the middle service layer between BigBang core network and IOT devices, for convenient docking with applications, it offers webapi port.
Download the latest release of LWS and webapi.tar.7z. Unzip them to a suitable directory
sudo -u pip3 install pymysql
sudo -u pip3 install requests
sudo -u pip3 install flask
vim conf.py # Edit way of database connection and node connection in the configuration files
python3 api.py
Check UTXO lists of assigned addresses under the certain branch.
Return json data as illustrated below
{
"sum": 68301930.52,
"unspents": [
{
"amount": 68301930.52,
"lockuntil": 0,
"out": 0,
"time": 1591440281,
"txid": "5edb7399b0d87ceb06a98f9aedf2f5c6da394dbb9d7480b9aaa1b653d1967bb1"
}]
}
It means at this address under a certain branch, aggregate UTXO sum is 68301930.52. The specific number is a UTXO Sum of the transfer is 68301930.52 with no locked block height("lockuntil": 0), it is a direct transfer("out": 0), transaction timestamp of when this UTXO is produced is 1591440281.The transaction’s txid is: 5edb7399b0d87ceb06a98f9aedf2f5c6da394dbb9d7480b9aaa1b653d1967bb1;
Check transaction id lists of assigned address under certain branches(including transfer-ins and transfer-outs)
Return json data as illustrated below
[
{
"txid": "5ed4c041cf8728a5354d637a9e77ca891270a0a971f83ac9e8deed417ea84a5c"
},
{
"txid": "5ed4c758e18ea39a598620ac59d2e2f9096bbe907b45c6f6a4e4e771b854b7ac"
},
{
"txid": "5ed4cc3f3310e569d8cbe1464088c142051dc47cb65c510eb25b46fa801a7a9d"
}
]
There are totally three transactions at this address under the certain branch
Check detailed information of a certain transaction id
Return json data as illustrated below
{
"id": 1,
"jsonrpc": "2.0",
"result":
{
"transaction":
{
"amount": 100000.0,
"anchor": "0000000006854ebdc236f48dbbe5c87312ea0abd7398888374b5ee9a5eb1d291",
"blockhash": "000038a068ca5ab79d86b7e958c4b513fa61c58ee164fea96bc97a7bf70af5b3",
"confirmations": 10122,
"data":"010000ff9cb3d45eac1254540751c7be85a2a7b9f53352cafe6b7b15b14a77737b13cb39723800000000000000000000000000000000000000000000000000000000000000000000858001000000e10d42696742616e6743616d657261e204434349434301a40000c16ff2862300a540420f0000000000a610270000000000008700000000e82101498b63009dfb70f7ee0902ba95cc171f7d7a97ff16d89fd96e1f1b9e7d5f91dac991d2b15e9aeeb57483889873bd0aea1273c8e5bb8df436c2bd4e8506000000008a72380000010000019cb3d45e0000000000000000000000000000000000000000000000000000000000000000000000000001498b63009dfb70f7ee0902ba95cc171f7d7a97ff16d89fd96e1f1b9e7d5f91da0000c16ff286230000000000000000000d42696742616e6743616d657261000040dd411f943895c76c17615ab11b12e1301909df35c848f879575dfa26ca2817255d0d736bed516b5b80017e2417f3eb27ebdc7ff0f726141c9194e441a9d05100",
"fork": "0000000006854ebdc236f48dbbe5c87312ea0abd7398888374b5ee9a5eb1d291",
"lockuntil": 0,
"sendfrom": "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"sendto": "20c0519nhpsnma9kchat82ddjpb4z72hcp2xefy3deg3thfv4m1wzd5qe",
"sig": "35a9e84a23bcb0487bf4baeb94e1dac3147153c5e5e3293bfd76c89a3fb50265a2d80e38f71cee87b81011fcb8078e22996cfddb6dcfc1faa5afeb285425b503",
"time": 1591000566,
"txfee": 0.05,
"txid": "5ed4bdf64fecd6db769f34de0eded820b22d89d660638123908bf4271f686c66",
"type": "token",
"version": 1,
"vin": [
{
"txid": "5ed4b9a7eb1d8d5355d6948e07f5a854a44c27ced1efad1a93c2343993dfb627",
"vout": 1
}]
}
}
}
This transaction means 1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm transfers 100000.0BBC to 20c0519nhpsnma9kchat82ddjpb4z72hcp2xefy3deg3thfv4m1wzd5qe, with a sum of commission at 0.05BBC. This transaction has already been confirmed 10122 heights.
broadcast transactions. Hexdata is the hexadecimal data if transactions. Return to transaction id after successful broadcast. If broadcast is not successful, return error code and description of error.
Return json data as illustrated below
{
"id": 5,
"state": "success"
}
A new piece of data has been added successfully
Acquire data of a certain ID
{
"data": "hello camera",
"state": "success"
}
Successfully return data of which the id is 5, data content is hello camera