All Projects → MikeHibbert → arweave-python-client

MikeHibbert / arweave-python-client

Licence: MIT license
This client allows you to integrate your python apps with the Arweave network allowing you to perform wallet operations and transactions

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to arweave-python-client

simple-mpesa
A simple example of how MPESA works. Works with all 3 types of customers i.e. Agents, Merchants and Subscribers. Allows you to configure a tariff and apply it to transactions. The project follows DDD principles.
Stars: ✭ 31 (-64.37%)
Mutual labels:  transaction, wallet
goar
Arweave http client and wallet implemented in go, Arweave SDK
Stars: ✭ 60 (-31.03%)
Mutual labels:  wallet, arweave
trading-post
💸 Verto's decentralised exchange mediator
Stars: ✭ 18 (-79.31%)
Mutual labels:  wallet, arweave
Web Wallet
Stars: ✭ 261 (+200%)
Mutual labels:  transaction, wallet
Coinbin
Javascript Bitcoin Wallet. Supports Multisig, Stealth, HD, SegWit, Bech32, Time Locked Addresses, RBF and more!
Stars: ✭ 694 (+697.7%)
Mutual labels:  transaction, wallet
Web3swift
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions on Ethereum network.
Stars: ✭ 462 (+431.03%)
Mutual labels:  transaction, wallet
minter-go-sdk
Minter Blockchain Golang SDK, 💳 wallet, 🧾 transactions, gRPC and HTTP clients 🌐 https://t.me/MinterGoSDK
Stars: ✭ 12 (-86.21%)
Mutual labels:  transaction, wallet
Blockchain Wallet
区块链钱包技术指南
Stars: ✭ 205 (+135.63%)
Mutual labels:  transaction, wallet
SimpleCoin
A simple cryptocurrency application for educational purposes only.
Stars: ✭ 13 (-85.06%)
Mutual labels:  transaction, wallet
alpha-interface
✨ Token Exchange App for Arweave Profit Sharing Tokens
Stars: ✭ 34 (-60.92%)
Mutual labels:  arweave
tokenomia
Tokenomia is built for the Cardashift ICO, it aims to simplify the use of Native Tokens and Smart Contracts above the Cardano Platform. Cardashift is a community-driven startup platform that raises funds, builds and accelerates startups that solve social and environmental problems.
Stars: ✭ 84 (-3.45%)
Mutual labels:  wallet
orchestrate-node
This Orchestrate library provides convenient access to the Orchestrate API from applications written in server-side NodeJS
Stars: ✭ 19 (-78.16%)
Mutual labels:  transaction
KuiBaDB
Another OLAP database
Stars: ✭ 297 (+241.38%)
Mutual labels:  transaction
ddal
DDAL(Distributed Data Access Layer) is a simple solution to access database shard.
Stars: ✭ 33 (-62.07%)
Mutual labels:  transaction
cryptoplease-dart
Dart and Flutter apps and libraries maintained by Espresso Cash (Formerly Crypto Please) team for Solana.
Stars: ✭ 188 (+116.09%)
Mutual labels:  wallet
unity3d-blockchain-wallet
Create wallets and perform transactions on custom ERC20 tokens via Unity3D
Stars: ✭ 33 (-62.07%)
Mutual labels:  wallet
hexa
Hexa Wallet. A simple bitcoin wallet made to be used with Friends and Family. Lightning. Gifts and more.
Stars: ✭ 85 (-2.3%)
Mutual labels:  wallet
indexeddb-orm
Indexed DB ORM
Stars: ✭ 53 (-39.08%)
Mutual labels:  transaction
cardano wallet sdk
Targeting Flutter apps, the Cardano Wallet SDK is a high-level Dart library for managing cryptocurrency accounts & executing transactions on the blockchain.
Stars: ✭ 31 (-64.37%)
Mutual labels:  wallet
ergo-wallet-app
Ergo Wallet App
Stars: ✭ 80 (-8.05%)
Mutual labels:  wallet

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:

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:

import arweave


wallet_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:

import arweave

wallet_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:

import arweave


wallet_file_path = "/some/folder/on/your/system"
wallet = arweave.Wallet(wallet_file_path)

transaction = arweave.Transaction(wallet, quantity=0.3, to='<some wallet address')
transaction.sign()
transaction.send()

#####ATTENTION! quantity is in AR and is automatically converted to Winston before sending

Uploading large files

Uploading large data files is now possible! you can now upload data larger than your physical memory or maximum transaction size (12MB) in the following way

from arweave.arweave_lib import Wallet, Transaction
from arweave.transaction_uploader import get_uploader

wallet = Wallet(jwk_file)

with open("my_mahoosive_file.dat", "rb", buffering=0) as file_handler:
    tx = Transaction(wallet, file_handler=file_handler, file_path="/some/path/my_mahoosive_file.dat")
    tx.add_tag('Content-Type', 'application/dat')
    tx.sign()

    uploader = get_uploader(tx, file_handler)

    while not uploader.is_complete:
        uploader.upload_chunk()

        logger.info("{}% complete, {}/{}".format(
            uploader.pct_complete, uploader.uploaded_chunks, uploader.total_chunks
        ))

NOTE: When uploading you only need to supply a file handle with buffering=0 instead of reading in the data all at once. The data will be read progressively in small chunks

To check the status of a transaction after sending:

status = transaction.get_status()

To check the status much later you can store the transaction.id and reload it:

transaction = Transaction(wallet, id='some id you stored')
status = transaction.get_status()

Storing data

As you know Arweave allows you to permanently store data on the network and you can do this by supplying data to the transaction as a string object:

wallet = Wallet(jwk_file)

with open('myfile.pdf', 'r') as mypdf:
    pdf_string_data = mypdf.read()

    transaction = Transaction(wallet, data=pdf_string_data)
    transaction.sign()
    transaction.send()

Retrieving transactions/data

To get the information about a transaction you can create a transaction object with the ID of that transaction:

tx = Transaction(wallet, id=<your tx id>)
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:

from arweave.arweave_lib import arql

wallet_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

import arweave

wallet_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"
    })
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].