Skip to main content

Transactions

At the heart of decentralized ledger systems lies the concept of blockchain transactions. These transactions are the lifeblood of this technology, serving as the conduit for the seamless exchange of assets, information, or value between parties. However, the significance of blockchain transactions goes far beyond mere exchange; they are a genuine game-changer.

As we navigate through the following sections, you'll discover how the ULedger SDK empowers you to create, manage, and optimize transactions within the blockchain. Whether you are a seasoned blockchain developer, a data analyst, or an enthusiastic newcomer, these pages will serve as your compass in the fascinating realm of blockchain transactions, enabling you to harness their full potential.

Creating Transactions

note

This section assumes that you already have a wallet registered on the blockchain. If not, please visit: Wallets page.

Your wallet is a gateway to transacting on the ULedger Network. To create a transaction, you can use your wallet to sign and send data securely. Here's how you can create a transaction using your wallet:

node_url = "some_node_url"
blockchain_id = "some_blockchain_id"
node_id = "some_node_id"

response = blockchain.create_transaction(
node_address=node_url,
blockchain_id=blockchain_id,
node_id=node_id,
to="another_wallet_address",
payload={"data": "informational transaction being sent here"},
wallet=my_wallet
)

print("Creating a transaction:", response)

Searching for a Transaction by ID

In this section, we delve into the process of searching for a specific transaction using its unique ID. This function is valuable for locating and examining specific transactions within the blockchain.

transaction = blockchain.search_transaction("transaction_id", False)
print(response)

By specifying the transaction_id as a string and trim as a boolean, you can call the search_transaction() function, which will locate and retrieve detailed information about the desired transaction.

Retrieving Transactions in a Blockchain

In this step, we focus on retrieving transactions from a specific blockchain. This process is crucial for accessing and analyzing transaction data within a particular blockchain.

response = blockchain.list_transactions("blockchaind_id")
print(response)

By calling the list_transactions() function with the specific blockchain_id (string) and optional parameters such as limit (integer), offset (integer), sort (boolean) and trim (boolean), we can access the transactions within that blockchain and print the response.

info

Default values for optional parameters are: limit=10, offset=0, sort=True, trim=True.

Getting Transactions from a Specific Block

This segment of the guide explains how to obtain transactions that are associated with a particular block. By doing this, you can access transaction data within a specific context.

block_id = "some_block_id"
response = blockchain.block_transactions(block_id)
print(response)

To achieve this, you must specify the block_id (string) and optional parameters such as limit (integer), offset (integer), sort (boolean) and trim (boolean). Upon calling the block_transactions() function, you will receive a response containing the transactions associated with the specified block.

info

Default values for optional parameters are: limit=10, offset=0, sort=True, trim=True.

Fetching Public Transactions

This part of the guide illustrates how to retrieve public transactions, even without specifying a particular blockchain. This can be useful for accessing transactions that are publicly accessible.

response = blockchain.list_transactions()
print(response)

By simply calling the list_transactions() function without providing a blockchain_id, you can obtain public transactions and display the response.

These sections provide a comprehensive guide for working with transactions within the ULedger blockchain, whether it's retrieving transactions from specific blockchains, accessing public transactions, or searching for specific transactions by their IDs.

© 2023 ULedger Inc. All rights reserved