Closed 0xp3gasus closed 2 years ago
New RPC method getTransactions over getTransactionMethod
Fixes #80 (issue)
Test A GetTransaction en ETH
curl --location --request POST 'http://localhost:80/eth/regtest/rpc' \ --header 'Content-Type: application/json' \ --data-raw '{ "id": 1609070896412, "method": "getTransactions", "params": { "txHashes": [ "0x5d06077597d8035d8f7acc05c12aeec00817da5163571c4025480ddbbcc7c848", "0x048ac0ce21eb0779dcb3fa7921f142c867bb3554326d55a82feb74861b9f3b30" ] }, "jsonrpc": "2.0" }'
{ "id": 1609070896412, "jsonrpc": "2.0", "result": { "transactions": [ { "transaction": { "txHash": "0x5d06077597d8035d8f7acc05c12aeec00817da5163571c4025480ddbbcc7c848", "fee": "420000000000000", "blockHash": "0xfbb7bbdb90760145bb211286c4fd4434813f850ebdf2efca650c8e1620871d26", "blockNumber": "1", "data": { "hash": "0x5d06077597d8035d8f7acc05c12aeec00817da5163571c4025480ddbbcc7c848", "nonce": "0x0", "blockHash": "0xfbb7bbdb90760145bb211286c4fd4434813f850ebdf2efca650c8e1620871d26", "blockNumber": "0x1", "transactionIndex": "0x0", "from": "0x26363cff12536ce34de80dafe7257b2b13bf3f54", "to": "0x26363cff12536ce34de80dafe7257b2b13bf3f54", "value": "0xde0b6b3a7640000", "gas": "0x5208", "gasPrice": "0x4a817c800", "input": "0x", "v": "0xa95", "r": "0x9150e36f65c8a047f54291094d9adc9055e6c9fc1ba538eeefcb4f6ee290f5d2", "s": "0x56511cdac212e6ab22ba6f9ef6a3931e55388515314214058582ad8e6f0b834a" }, "inputs": [ { "address": "0x26363cff12536ce34de80dafe7257b2b13bf3f54", "amount": "1000000000000000000" } ], "outputs": [ { "address": "0x26363cff12536ce34de80dafe7257b2b13bf3f54", "amount": "1000000000000000000" } ] } }, { "transaction": { "txHash": "0x048ac0ce21eb0779dcb3fa7921f142c867bb3554326d55a82feb74861b9f3b30", "fee": "420000000000000", "blockHash": "0x64b8755d0c7ccbc5337f7a9b5acdaf3162b87138c3956c16474fadefadaa8ab1", "blockNumber": "2", "data": { "hash": "0x048ac0ce21eb0779dcb3fa7921f142c867bb3554326d55a82feb74861b9f3b30", "nonce": "0x0", "blockHash": "0x64b8755d0c7ccbc5337f7a9b5acdaf3162b87138c3956c16474fadefadaa8ab1", "blockNumber": "0x2", "transactionIndex": "0x0", "from": "0xe71138fbd824a7d3685fb00e462ff2a9e9e1872c", "to": "0x26363cff12536ce34de80dafe7257b2b13bf3f54", "value": "0xd02ab486cedc0000", "gas": "0x5208", "gasPrice": "0x4a817c800", "input": "0x", "v": "0xa96", "r": "0x13b37fcd33144ef465188867a25592d1d04766b62ce7950d975a6a21a65a2122", "s": "0x2babfbe4e2d1c95674ff735d95b9701a58c01657ba229f9c60f772804b6a951" }, "inputs": [ { "address": "0xe71138fbd824a7d3685fb00e462ff2a9e9e1872c", "amount": "15000000000000000000" } ], "outputs": [ { "address": "0x26363cff12536ce34de80dafe7257b2b13bf3f54", "amount": "15000000000000000000" } ] } } ] } }
Test B GetTransactions en BTC Regtest
curl --location --request POST 'http://localhost:80/btc/regtest/rpc' \ --header 'Content-Type: application/json' \ --data-raw '{ "id": 1609070896412, "method": "getTransactions", "params": { "txHashes": [ "06a839ad325562a2785367ff270ae2d2c30576ffdea56c99c3218edfb791c941", "dd8d396fcaa88f04e131bf90c82363062b05cfc18c91238c24ae03fbd9a31cff" ] }, "jsonrpc": "2.0" }'
{ "id": 1609070896412, "jsonrpc": "2.0", "result": { "transactions": [ { "transaction": { "txId": "06a839ad325562a2785367ff270ae2d2c30576ffdea56c99c3218edfb791c941", "txHash": "6b89dfe1402c711e7ecb54973c9c3d6d28fee9321976607e629d52e5b102f7fc", "blockNumber": "1223", "fee": "705", "inputs": [ { "amount": "78125000", "address": "bcrt1qtylthjgpnk03w3j7ypse9mz0sg07uutcpz0ssz" }, { "amount": "0", "address": null } ], "outputs": [ { "amount": "295", "address": "bcrt1qlfdnrzmg9y52t474xyexc2vep8hkdp7jg02mj0" }, { "amount": "78124000", "address": "bcrt1qj4svfwrxxsjxzfvtsvmzzd0vvglc8r09q0csrg" } ], "data": { "txid": "06a839ad325562a2785367ff270ae2d2c30576ffdea56c99c3218edfb791c941", "hash": "6b89dfe1402c711e7ecb54973c9c3d6d28fee9321976607e629d52e5b102f7fc", "version": 2, "size": 222, "vsize": 141, "weight": 561, "locktime": 0, "vin": [ { "txid": "7e1879cc8f7f6ff6571be46ce1c1b2ba3fcdfdaa32dd0de50d0add86fd840904", "vout": 0, "scriptSig": { "asm": "", "hex": "" }, "txinwitness": [ "304402201c97da21c54d752567d828838b887e2072fe3d3a1652284d02dc35e634b534e4022009a114945c80bf3b1b4fe1b70e80a23da717d202e2bb1a0cc6ec050c39adb5ba01", "03b27695cfbe671b7495a35d0ab06f145a4caa774222bd8bbaf28829aabd2f5e14" ], "sequence": 4294967293 } ], "vout": [ { "value": 2.95e-06, "n": 0, "scriptPubKey": { "asm": "0 fa5b318b682928a5d7d531326c299909ef6687d2", "hex": "0014fa5b318b682928a5d7d531326c299909ef6687d2", "reqSigs": 1, "type": "witness_v0_keyhash", "addresses": [ "bcrt1qlfdnrzmg9y52t474xyexc2vep8hkdp7jg02mj0" ] } }, { "value": 0.78124, "n": 1, "scriptPubKey": { "asm": "0 9560c4b866342461258b83362135ec623f838de5", "hex": "00149560c4b866342461258b83362135ec623f838de5", "reqSigs": 1, "type": "witness_v0_keyhash", "addresses": [ "bcrt1qj4svfwrxxsjxzfvtsvmzzd0vvglc8r09q0csrg" ] } } ], "hex": "02000000000101040984fd86dd0a0de50ddd32aafdcd3fbab2c1e16ce41b57f66f7f8fcc79187e0000000000fdffffff022701000000000000160014fa5b318b682928a5d7d531326c299909ef6687d2e013a804000000001600149560c4b866342461258b83362135ec623f838de50247304402201c97da21c54d752567d828838b887e2072fe3d3a1652284d02dc35e634b534e4022009a114945c80bf3b1b4fe1b70e80a23da717d202e2bb1a0cc6ec050c39adb5ba012103b27695cfbe671b7495a35d0ab06f145a4caa774222bd8bbaf28829aabd2f5e1400000000", "blockhash": "2d17efcb49b81c4956dcd6e6ed1f1623ee822f349556150945f06aae9434e8d4", "confirmations": 2, "time": 1646591571, "blocktime": 1646591571 } } }, { "transaction": { "txId": "dd8d396fcaa88f04e131bf90c82363062b05cfc18c91238c24ae03fbd9a31cff", "txHash": "eb654ea62835954c551bdd9949dd4f12723b7f8b932b2b7ad59ea3dc372ebc9c", "blockNumber": "1222", "fee": "705", "inputs": [ { "amount": "78125000", "address": "bcrt1qtylthjgpnk03w3j7ypse9mz0sg07uutcpz0ssz" }, { "amount": "0", "address": null } ], "outputs": [ { "amount": "295", "address": "bcrt1qlfdnrzmg9y52t474xyexc2vep8hkdp7jg02mj0" }, { "amount": "78124000", "address": "bcrt1qj4svfwrxxsjxzfvtsvmzzd0vvglc8r09q0csrg" } ], "data": { "txid": "dd8d396fcaa88f04e131bf90c82363062b05cfc18c91238c24ae03fbd9a31cff", "hash": "eb654ea62835954c551bdd9949dd4f12723b7f8b932b2b7ad59ea3dc372ebc9c", "version": 2, "size": 222, "vsize": 141, "weight": 561, "locktime": 0, "vin": [ { "txid": "bf2fcb54241609b5e5cbdf7a908f3c01dff1df16897e5b0de9aa906019203801", "vout": 0, "scriptSig": { "asm": "", "hex": "" }, "txinwitness": [ "3044022067df87ba791554133c7e30a272636138beedcf3a82ae7f062b261c9f7b4462e0022077c43104e901729f035082ebcfb47fe2483ae8289a0f18f656da4b4fda979a4301", "03b27695cfbe671b7495a35d0ab06f145a4caa774222bd8bbaf28829aabd2f5e14" ], "sequence": 4294967293 } ], "vout": [ { "value": 2.95e-06, "n": 0, "scriptPubKey": { "asm": "0 fa5b318b682928a5d7d531326c299909ef6687d2", "hex": "0014fa5b318b682928a5d7d531326c299909ef6687d2", "reqSigs": 1, "type": "witness_v0_keyhash", "addresses": [ "bcrt1qlfdnrzmg9y52t474xyexc2vep8hkdp7jg02mj0" ] } }, { "value": 0.78124, "n": 1, "scriptPubKey": { "asm": "0 9560c4b866342461258b83362135ec623f838de5", "hex": "00149560c4b866342461258b83362135ec623f838de5", "reqSigs": 1, "type": "witness_v0_keyhash", "addresses": [ "bcrt1qj4svfwrxxsjxzfvtsvmzzd0vvglc8r09q0csrg" ] } } ], "hex": "02000000000101013820196090aae90d5b7e8916dff1df013c8f907adfcbe5b509162454cb2fbf0000000000fdffffff022701000000000000160014fa5b318b682928a5d7d531326c299909ef6687d2e013a804000000001600149560c4b866342461258b83362135ec623f838de502473044022067df87ba791554133c7e30a272636138beedcf3a82ae7f062b261c9f7b4462e0022077c43104e901729f035082ebcfb47fe2483ae8289a0f18f656da4b4fda979a43012103b27695cfbe671b7495a35d0ab06f145a4caa774222bd8bbaf28829aabd2f5e1400000000", "blockhash": "4a9ae5ab91aa69c7c92c960bb689ff038549767bcd9e782bee11eeaee544162f", "confirmations": 3, "time": 1646591571, "blocktime": 1646591571 } } } ] } }
Test Configuration:
cat /etc/os-release
uname -sr
uname -m
Docs PR related # Other PR related #
Description
New RPC method getTransactions over getTransactionMethod
Fixes #80 (issue)
Dependencies (if any)
Type of change
How Has This Been Tested?
Test A GetTransaction en ETH
Test B GetTransactions en BTC Regtest
Test Configuration:
cat /etc/os-release
):uname -sr
):uname -m
):Related PR or Docs PR
Docs PR related # Other PR related #
Good practices to consider