jrosendo
7a960f7d00
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
Retrieve Transaction In and Out
A Bitcoin transaction consists of one or several inputs and one or several outputs. The sum of the inputs is slightly superior to the sum of the output to take into account the fee. One transaction per block, called "coinbase", pays miners and does not have a valid input. For some transactions, outputs might be null too.
This model is referred to as UTXO
for "Unspent Transaction Outputs", as there is a ongoing list of unspent outputs.
A simple transaction
-> In | Out -> |
---|---|
0.50 | 0.30 |
0.19 |
+ 0.01 fee
Instructions
Using a local Bitcoin node RPC API, create a function retrieveTxValue()
that takes as input a hash of a simple transaction, and returns an object with an array of inputs values and an array outputs values in this transaction.
The Bitcoin node RPC interface is expected to be running with the following parameters:
rpcallowip=127.0.0.1
rpcport=18443
rpcuser=leeloo
rpcpassword=multipass
Usage
txHash = "d030023d96b9170af9ec2fe5d9b62a5eacbcbf144c68f3f45d68bca72d1d3649";
retrieveTxData(txHash);
/* Expected :
{
in: [ 0.18075094 ],
out: [ 0.001, 0.1797493 ]
}
*/