Skip to main content

ArchEthic Python SDK

Project description

ArchEthic SDK for Python

This repo aims to provide a Python SDK for the ArchEthic project.
It is based on the official javascript sdk.

Installation

pip install archethic

Example

import archethic

api = archethic.Api("https://testnet.archethic.net")

# make sure you have funds in your wallet !
seed = 'mySuperSeed'
ref_index = api.get_transaction_index(archethic.derive_address(seed, 0))

rx_address = archethic.derive_address("rx_address", 0)

tx = archethic.TransactionBuilder('transfer')
tx.add_uco_transfer(rx_address, 10.102)
tx.build(seed, ref_index)
tx.origin_sign(archethic.ORIGIN_PRIVATE_KEY)

transaction_fee = api.get_transaction_fee(tx)
print(f"fee : {transaction_fee['fee']} UCOs")
response = api.send_tx(tx)
print(response)

# prints :
# fee : 0.12413171 UCOs
# {'status': 'pending', 'transaction_address': '00008808978E67F37E0AFF023682AAB48843CF5B340A00B1F1C0668B003EC21E358F'}

Contribution

Thank you for considering to help out with the source code. We welcome contributions from anyone and are grateful for even the smallest of improvement.

Please to follow this workflow:

  1. Fork it!
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

(copied from archethic-foundation)

TODOs

Utils

  • Implementation of utils

Cryptographic functions

  • get_originKey()
  • derive_keypair()
  • derive_address()
  • ec_encrypt()
  • aes_encrypt()

Transaction building

  • create TransactionBuilder class (TB)
  • TB.set_code()
  • TB.set_content()
  • TB.add_ownership()
  • TB.add_UCO_transfer()
  • TB.add_TOKEN_transfer()
  • TB.add_recipient()
  • TB.build()
  • TB.origin_sign()
  • TB.toJSON()
  • Interacting with other signer
    • TB.previous_signature_payload()
    • TB.set_previous_signature_and_previous_public_key()
    • TB.set_address()
    • TB.origin_signature_payload()
    • TB.set_origin_sign()

Remote Endpoint calls

  • addOriginKey()
  • TB.send_transaction()
  • wait_confirmations()
  • get_transaction_index()
  • get_storage_nonce_public_key()
  • get_transaction_fee()
  • get_transaction_ownerships()

Keychain / Wallet management

comming soon

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archethic-0.0.1.2.tar.gz (17.4 kB view hashes)

Uploaded Source

Built Distribution

archethic-0.0.1.2-py3-none-any.whl (18.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page