Skip to main content

HELP NEEDED

...with my dissertation. It is only 11 questions. As this package is part of my thesis it would be much appreciated if you spent a few moments on filling out these 11 anonymous questions. Thanks!

PyGeth

PyGeth is a Python library for a quick setup of an Ethereum blockchain using Geth and for fast prototyping of contracts with truffle.

Installation

Prerequisites

To be able to run this package, please install Geth and Npm (5.2.0 or higher) and add them to your Path. Note: This has solely been tested on Windows.

Use the package manager pip to install python-geth.

pip install python-geth

Usage

Node

from python_geth.node import Node

node1 = Node(datadir="C:\\Users\\macutko\\Desktop\\node01")
node1.start_node()

This creates a geth node that allows interaction with it via the web3 library.

node1.w3.geth.miner.start(1)

To add a node on the chain do as follows. It requires the same genesis file.

node2 = Node(datadir="C:\\Users\\macutko\\Desktop\\node02", genesis_file="C:\\Users\\macutko\\Desktop\\node01\\config\\genesisjson")
node2.start_node()
node1.add_node(node2.w3.geth.admin.node_info()['enode'])

Contracts

To be able to quickly deploy contracts and interact with them first configure truffle.

node1.configure_truffle()

To deploy a contract unlock an account, create a Contract Interface instance and deploy a contract. highly recommended to wrap deployment into a try and accept block. This is to prevent zombie processes.

account, password = node1.get_first_account()
node1.w3.geth.personal.unlock_account(account, password)

CI = ContractInterface(w3=node1.w3, datadir="C:\\Users\\macutko\\Desktop\\node01")
try:
    m_con = CI.deploy_contract(contract_file="C:\\Users\\macutko\\Desktop\\GUID.sol",constructor_params=['2265072m'])[0]
except:
    node1.stop_node()

Example Contract

Example contract:

pragma solidity ^0.4.24;

contract HelloWorld {

    string saySomething;

    constructor() public  {
        saySomething = "Hello World!";
    }

    function speak() public constant returns(string itSays) {
        return saySomething;
    }

    function saySomethingElse(string newSaying) public  returns(bool success) {
        saySomething = newSaying;
        return true;
    }

}

After deploying, to get the saySomething variable.

print(m_con.functions.speack.call())

And to set a new message.

tx_hash = m_con.functions.saySomethingElse("Not Hello World").transact()
tx_receipt = CI.w3.eth.waitForTransactionReceipt(tx_hash)

Pipeline

  • BUG: Fix the start of an already created node
  • TEST:Connection from different device

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Metadata

Release files for python-geth 1.7.54

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-geth 1.7.54
File Size Uploaded Provenance
python_geth-1.7.54.tar.gz 10.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for python-geth 1.7.54
File Interpreter ABI Platform
python_geth-1.7.54-py3-none-any.whl Python 3 none any Details

Total release size: 22.1 kB

Release files / python_geth-1.7.54.tar.gz

Download URL python_geth-1.7.54.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
59d9a51a1a718b1687f34745e02635b4e5d8cffadcbb87c43d15de3b7fc7f72e
BLAKE2b-256 checksum
How to use checksums
0dfcd68fe4decc567ad93ab4d58da44aebe48b268f0b97f68addd618ca0b1088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5

Release files / python_geth-1.7.54-py3-none-any.whl

Download URL python_geth-1.7.54-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dad3cea8a88dc1ab603ca9080fb4d3345862294650168107da90eca3d9be07f5
BLAKE2b-256 checksum
How to use checksums
4459a0cb4041f7b7899ef837ae8178a023b035a09c07a7b0122482906fde2a7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5

Security for python-geth 1.7.54

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.7.54 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page