A python-jvm wrapper for interacting with the Ergo blockchain.

Related tags

Cryptography ergpy
Overview

ergpy

A python-jvm wrapper for interacting with the Ergo blockchain.

Usage

  • Requires Java 8 or higher to be installed on system
pip install JPype1
pip install ergpy
  • There are helper methods created to do simple transactions
    • Please checkout the examples.py (on github) to see how to use them.
    • Simple Send is available
      • Allows sending ERG to one address or multiple addresses in ONE transactions
    • Get wallet addresses is available
      • This gives derivations of wallet addresses given the mnemonic
      • If specified 2, a list of two addresses will be printed in the console
    • Get Box Info is available
      • Given the index and address, the selected box will be printed
    • Send Token is available
      • Allows sending token(s) to one or multiple addresses
      • The token id paramter must be given as a 2D array
      • Remember that tokens/nfts are seen as the same when transacting with them
    • Create NFT is available
      • Allows creating NFTs
      • One mint is one transaction
      • There are helper methods as well to get the sha-256 hash required while minting
        • SHA256 caster
          • Put the hash as a string and this will be converted into bytes
        • String Hasher
          • Input a string and this will be converted into a hash (only for testing purposes)
        • File Hasher
          • Input the file name and the hash will be generateed
    • Create Token is available
      • Allows a token to be minted
    • Custom
      • A bit more customization is available using methods from appkit.py
      • To truly have custom transactions appkit.py must be edited

Github usage

git clone https://github.com/mgpai22/ergpy && cd ergpy
pip3 install -r requirements.txt
python -m stubgenj --convert-strings --classpath "ergo.jar" org.ergoplatform java
  • If using an ide such as pycharm , make sure the root folder is ergpy
    • This allows code completion via stubgenj to work properly
  • This method is recommended for developer as it allows for direction customizations in appkit.py

Roadmap

  • This is the begining of python support for Ergo! Contributions are essential for this to continue.
  • Ergoscript support.
  • Better documentation and packaging (first time creating a package).
    • Would love some help with this!

Credits

Comments
  • Restructuring repository

    Restructuring repository

    Hi, I was looking for repositories I could contribute to so I discovered this one here.

    I am creating this issue in order to restructure it a bit the repo and you will tell me what you think about it.

    enhancement 
    opened by rafidini 12
  • PEP 8 – Style for Python Code

    PEP 8 – Style for Python Code

    Is your feature request related to a problem? Please describe. As this project is meant to become a Python package, it is highly recommended to make it follow the PEP 8 - Style Guide for Python Code.

    Source : PEP 8 – Style Guide for Python Code

    Describe the solution you'd like Make all source code more PEP 8-friendly.

    Additional context

    A python-jvm wrapper for interacting with the Ergo blockchain.

    So we have to be careful of not following Java standards (at least try not to).

    enhancement 
    opened by rafidini 7
  • Console does not exit

    Console does not exit

    Whenever the code is run I notice that something does not properly exit.

    Try this code out:

    from ergpy import helper_functions, appkit
    
    node_url: str = "http://213.239.193.208:9052/"  # MainNet or TestNet
    ergo = appkit.ErgoAppKit(node_url=node_url)
    wallet_mnemonic = "what stadium typical spell rate truly pen tongue fuel intact fluid strike vibrant city shine"
    receiver_addresses = [
        "3WwdXmYP39DLmDWJ6grH9ArXbWuCt2uGAh46VTfeGPrHKJJY6cSJ",
        "3WwuG9amNVDwkJdgT5Ce7aJCfeoafVmd9tag9AEiAZwgPi7pYX3w",
        "3Wxk5oofZ3Laq2CpFW4Fi9YQiaep9bZr6QFg4s4xpzz4bi9tZq2U"
    ]
    
    amount = [0.22, 0.33, 0.11]
    
    tx = helper_functions.simple_send(ergo=ergo, amount=amount, wallet_mnemonic=wallet_mnemonic, receiver_addresses=receiver_addresses)
    
    data = f'Transaction: {str(tx)}'
    with open('demo.text', 'w') as file:
        file.write(data)
    print("wrote to file")
    
    

    This will write the txid to file and print to console. However if you want to exit to run other commands in the console you must exit with ctrl + c. I tried including sys.exit(0) and quit() in the code but it does not help.

    Any ideas @rafidini ?

    Thank you

    bug 
    opened by mgpai22 5
  • No more than 16384 headers can be requested

    No more than 16384 headers can be requested

    Hello @mgpai22, let us go back on track 🚀

    I committed some changes to the logs issue (#11), for now, it is very simple and I only added it to a new example (example_7_*.py) to make sure the feature works properly.

    But I have an issue running the example, this is my output:

    Screenshot 2022-09-18 at 13 22 40

    I'll create a new issue to separate it from this feature 🔧

    Originally posted by @rafidini in https://github.com/mgpai22/ergpy/issues/11#issuecomment-1250249078

    bug wontfix 
    opened by rafidini 3
  • More admin rights

    More admin rights

    Hi, can you please give me more admin rights to make this repo alive? I would like to add many things such as :

    • Actions to automate tests
    • Discussions to create polls and decide on the direction of this repo
    • ... (still thinking of the rest)

    You can also consider transforming your account into an organization.

    question 
    opened by rafidini 3
  • Merge `issue/11/logging` into `dev`

    Merge `issue/11/logging` into `dev`

    ✨ Add a logs package: format the logging and set the logging level to info (for now) ✅ Add a test for the logs feature 🩹 fix the issue about connecting to testnet

    fix #11 link #21

    opened by rafidini 1
  • Automated tests

    Automated tests

    Is your feature request related to a problem? Please describe. In order to validate our developments, tests are needed and if they are automated it would be the best

    Describe the solution you'd like GitHub Actions allows us to execute code on runners hosted by GitHub.

    We can write some tests in a /tests folder in order to validate the whole behavior of the package by writing deterministic code and checking with assert statements.

    Additional context

    • GitHub Actions : https://github.com/features/actions
    • Python 3.8 assert documentation : https://docs.python.org/3.8/reference/simple_stmts.html#the-assert-statement
    enhancement 
    opened by rafidini 1
  • Logging

    Logging

    I tested everything with various scenarios and they work well!

    I am thinking of adding some sort of optional parameter to the ergo connection object to enable or disable logging. What do you think @rafidini ?

    Originally posted by @mgpai22 in https://github.com/mgpai22/ergpy/issues/4#issuecomment-1140520529

    enhancement 
    opened by rafidini 1
  • Merge `issue/11/logging` into `dev`

    Merge `issue/11/logging` into `dev`

    ✨ Add a logs package: format the logging and set the logging level to info (for now) ✅ Add a test for the logs feature 🩹 fix the issue about connecting to testnet 🐛 Changed returned value structure

    fix #22 #11 link #21

    opened by rafidini 0
  • Dev/1 restructuring repository

    Dev/1 restructuring repository

    Here @mgpai22 try this, I did not change much but here is what you have to do for testing purposes :

    # Build the package
    make build
    
    # Install the package
    make install
    
    # Launch the test
    python examples/example_1.py
    
    

    Notes:

    • make is associated to the Makefile, it defines a set of instructions to launch in your terminal
    • The last line should output a list with this form : ["...", "...", "..."]
    • I develop on MacOS so it might compatible with Linux distros but I do not know about Windows

    Ref: #1

    opened by rafidini 0
  • Command-line interface

    Command-line interface

    Is your feature request related to a problem? Please describe. In order to make it easy to interact with the package, a CLI might be needed.

    Describe the solution you'd like Call CLI like the following examples :

    • ergpy send simple <addr1> <addr2>
    • ergpy send token <id> <addr1> <addr2>
    • ergpy get wallet-addresses --no-addresses 2
    • ergpy get box-info <index> <addr>

    Warning @mgpai22 I will need your help defining the commands' behavior.

    Additional context

    • argparse — Parser for command-line options, arguments and sub-commands
    enhancement 
    opened by rafidini 0
Owner
mgpai
mgpai
Learn Blockchains by Building One, A simple Blockchain in Python using Flask as a micro web framework.

Blockchain ✨ Learn Blockchains by Building One Yourself Installation Make sure Python 3.6+ is installed. Install Flask Web Framework. Clone this repos

Vaibhaw 46 Jan 5, 2023
Python implementation of a blockchain.

The goal of this project is to explain and to make clearer how is a blockchain structured at the very core. It's not built with the intention to replicate an advanced blockchain like Bitcoin or Ethereum

Rahul raikwar 5 Jan 28, 2022
Blockchain Python Implementation

Blockchain Python Implementation

0918nobita 2 Nov 21, 2021
This is simple Blockchain ,miner and wallet to send crypto using python

pythonBlockchain-SImple This is simple Blockchain ,miner and wallet to send crypto using python It is simple Blocchain so it can only dobasic work usi

null 3 Nov 22, 2022
A simple Python tool to help anyone use Liquidity Pools on the BitShares blockchain.

ACCOUNT AND ACTIVE KEY ARE NOT PERSISTENT, YOU WILL NEED TO ENTER THEM EACH TIME YOU LAUNCH THE APP (but not every transaction. that's a win). If / wh

Brendan Jensen 17 Jun 15, 2022
Python repo to create blockchain CSVs

staketaxcsv Python repo to create blockchain CSVs for Terra (LUNA), Solana (SOL), and Cosmos (ATOM). CSV codebase for stake.tax Community contribution

null 187 Dec 31, 2022
Simple crypto & blockchain implementation written in Python

JaamoCoin - simple Python blockchain example This is a very simple blockchain example written in Python. Based on this tutorial: https://medium.com/co

Jaakko Alajoki 1 Jan 7, 2022
Ethereum ETL lets you convert blockchain data into convenient formats like CSVs and relational databases.

Python scripts for ETL (extract, transform and load) jobs for Ethereum blocks, transactions, ERC20 / ERC721 tokens, transfers, receipts, logs, contracts, internal transactions.

Blockchain ETL 2.3k Jan 1, 2023
Tools for running airdrop and token distribution campaigns on the Solana blockchain.

Overview This repository contains some of the scripts we have used for running our airdrop campaigns and other distributions. Initially, all of these

null 147 Nov 17, 2022
seno-blockchain is just a fork of Chia, designed to be efficient, decentralized, and secure

seno-blockchain https://seno.uno Seno is just a fork of Chia, designed to be efficient, decentralized, and secure. Here are some of the features and b

Denis Erygin 27 Jul 2, 2022
Ceres is a combine harvester designed to harvest plots for Chia blockchain and its forks using proof-of-space-and-time(PoST) consensus algorithm.

Ceres Combine-Harvester Ceres is a combine harvester designed to harvest plots for Chia blockchain and its forks using proof-of-space-and-time(PoST) c

null 38 Nov 14, 2022
blockchain address database

Blockchain Address Ownership Database The database is in data/addresses.db This is a SQLite database of addresses from several blockchains. It's obtai

null 37 Nov 26, 2022
A repository for Algogenous Smart Contracts created on the Algorand Blockchain.

Smart Contacts Alogrand Smart Contracts using Choice Coin. Read Docs for how to implement Algogenous Smart Contracts for your own applications. Smart

Choice Coin 3 Dec 20, 2022
A repository for Algogenous Smart Contracts created on the Algorand Blockchain.

Smart Contacts This Repository is dedicated to code for Alogrand Smart Contracts using Choice Coin. Read Docs for how to implement Algogenous Smart Co

Choice Coin 3 Dec 20, 2022
High Performance Blockchain Deserializer

bitcoin_explorer is an efficient library for reading bitcoin-core binary blockchain file as a database (utilising multi-threading).

Congyu 2 Dec 28, 2021
An BlockChain Based solution for storing the medical records

Blockchain-based Medical Records ?? Abstract Blockchain has the ability to keep an incorruptible, decentralized, and transparent log of all patient da

Yuvraj Singh Deora 3 Jan 14, 2022
A little side-project API for me to learn about Blockchain and Tokens

BlockChain API I built this little side project to learn more about Blockchain and Tokens. It might be maintained and implemented to other projects bu

Loïk Mallat 1 Nov 16, 2021
A workshop to build an NFT smart contract on the polygon blockchain

Polygon NFT Workshop This is an interactive workshop that guides you through the steps to deploy an NFT smart contract on the Polygon blockchain. By t

Banjo Obayomi 56 Oct 14, 2022
Accounting Cycle Program with Blockchain Component

In the first iteration of my accounting cycle program, I talked about adding in a blockchain component that allows the user to verify the inegrity of

J. Brandon Walker 1 Nov 29, 2021