Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MikeHibbert/arweave-python-client
This client allows you to integrate your python apps with the Arweave network allowing you to perform wallet operations and transactions
https://github.com/MikeHibbert/arweave-python-client
arweave cryptocurrency python transaction wallet
Last synced: about 2 months ago
JSON representation
This client allows you to integrate your python apps with the Arweave network allowing you to perform wallet operations and transactions
- Host: GitHub
- URL: https://github.com/MikeHibbert/arweave-python-client
- Owner: MikeHibbert
- License: mit
- Created: 2020-01-18T18:20:17.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-06T10:23:03.000Z (4 months ago)
- Last Synced: 2024-10-30T11:20:14.926Z (3 months ago)
- Topics: arweave, cryptocurrency, python, transaction, wallet
- Language: Python
- Homepage:
- Size: 1.18 MB
- Stars: 102
- Watchers: 6
- Forks: 45
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-arweave - arweave-python-client - This client allows you to integrate your python apps with the Arweave network allowing you to perform wallet operations and transactions. (Tools ⚙️)
README
# arweave-python-client
This client allows you to integrate your python apps with the Arweave network allowing you to got wallet operations and transactions## Installing
To use the library simply install it:
```buildoutcfg
pip install arweave-python-client
```## Using your wallet
Once installed you can import it and supply the wallet object with the path to your wallet JSON file:
```buildoutcfg
import arweavewallet_file_path = "/some/folder/on/your/system"
wallet = arweave.Wallet(wallet_file_path)balance = wallet.balance
last_transaction = wallet.get_last_transaction_id()
```## Loading your wallet
If your wallet data is stored in a secret manager or anywhere other than a file, you can load it with the `from_data` classmethod:
```buildoutcfg
import arweavewallet_data = // Load from cloud storage or wherever
wallet = arweave.Wallet.from_data(wallet_data)balance = wallet.balance
```## Transactions
To send a transaction you will need to open your wallet, create a transaction object, sign the transaction and then finally post the transaction:
```buildoutcfg
import arweavewallet_file_path = "/some/folder/on/your/system"
wallet = arweave.Wallet(wallet_file_path)transaction = arweave.Transaction(wallet, quantity=0.3, to=')
tx.get_transaction()
```In addition you may want to get the data attached to this transaction once you've decided you need it:
```
tx.get_data()
print(tx.data)
> "some data"
```## Sending to a specific Node
You can specify a specific node by setting the api_url of the wallet/transaction object:
```
wallet = Wallet(jwk_file)
wallet.api_url = 'some specific node ip/address and port'Or
transaction = Transaction(wallet, data=pdf_string_data)
transaction.api_url = 'some specific node ip/address and port'```
## Arql
You can now perform searches using the arql method:
```buildoutcfg
from arweave.arweave_lib import arqlwallet_file_path = "/some/folder/on/your/system"
wallet = arweave.Wallet(wallet_file_path)transaction_ids = arql(
wallet,
{
"op": "equals",
"expr1": "from",
"expr2": "Some owner address"
})
```Alternatively, you can use a the helper method arql_with_transaction_data() to get all transaction ids as well as all the data stored in the blockchain
```buildoutcfg
import arweavewallet_file_path = "/some/folder/on/your/system"
wallet = arweave.Wallet(wallet_file_path)transactions = aweave.arql_with_transaction_data(
wallet,
{
"op": "equals",
"expr1": "from",
"expr2": "Some owner address"
})
```