planetmint-abci


Nameplanetmint-abci JSON
Version 0.8.4 PyPI version JSON
download
home_pagehttps://github.com/eckelj/py-abci
SummaryPython based ABCI Server for Tendermint
upload_time2023-06-21 07:23:32
maintainer
docs_urlNone
authorDave Bryson
requires_python>=3.9
licenseApache 2.0
keywords blockchain tendermint abci
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            [![pypi](https://img.shields.io/pypi/v/abci.svg)](https://pypi.python.org/pypi/abci)
[![build](https://travis-ci.org/davebryson/py-abci.svg?branch=master)](https://https://travis-ci.org/davebryson/py-abci)
[![codecoverage](https://codecov.io/gh/davebryson/py-abci/branch/master/graph/badge.svg)](https://codecov.io/gh/davebryson/py-abci)

# Py-ABCI
Build Tendermint blockchain applications in Python.  It's fun.  This library provides the core functionality needed to create Tendermint ABCI applications.

## Supported Tendermint Version
* Tendermint *0.34.24*
* ABCI *0.17.0*

## Installation
Requires Python >= 3.9

`pip install abci`

You'll need a binary version of the Tendermint engine. 
Available here: https://github.com/tendermint/tendermint/releases

**Make sure the Tendermint version you download matches the current support version of this library**

## Quick Start - demo

A very simple demo application is included and available from the command line as `counter`. You can find the code here: https://github.com/davebryson/py-abci/blob/master/src/example/counter.py

To try it out:
1. Make sure you have the Tendermint binary setup locally and in your path.  To test it's working
open a terminal window and type:
```text
>> tendermint version
```
It should output your version of Tendermint that should match the currently supported version 
of this library.

2. Next, initialize Tendermint by running:
```text
>> tendermint init
```

3. Start the Tendermint node:
```text
>> tendermint node
```
The node will start, but will be waiting for you application to start.

4. Open another terminal, and start the `counter` application. The `counter` will be available
from within the Python environment where you installed `abci`
```text
>> counter
```
You'll see the application start, and in the Tendermint terminal, you'll see the output of 
blocks being produced

5. Now, open a 3rd terminal window to send some transaction to the blockchain.  To do this we'll
use the `curl` application to send transaction to the local blockchain over http. For example:
```text
>> curl http://localhost:26657/broadcast_tx_commit?tx=0x01
>> curl http://localhost:26657/broadcast_tx_commit?tx=0x02
```
The counter application expects you to send `transactions` as numbers encoded as hex in order: 1,2,3...
It will reject and out-of-order numbers.  You can always see the latest accepted value by sending the
request:
```text
>> curl http://localhost:26657/abci_query
```

To shut down the application enter `CTRL-C`

## Get Started
To start building your own application:
1. Extend the `abci.application.BaseApplication` class
2. Implement the Tendermint ABCI callbacks - see https://docs.tendermint.com/v0.34/spec/abci for details on how they work
3. Start it:
```python
from abci.server import ABCIServer

app = ABCIServer(app=MyApplication())
app.run()
```
See the ``counter.py`` application in the ``example`` directory https://github.com/davebryson/py-abci/blob/master/src/example/counter.py for a full example.


## Developing on the code base
If you're working directly on the code base.  Install a local editable version:

`pip install --editable '.[test]'`

## Updating Protobuf code

**You should only re-generate the protobuf code if you're updating the associated protobuf files, 
and/or contributing to this code base.  You do not need to rebuild protos to create apps.**  

A note on protobuf:  The primary code directory is `abci`, but you'll notice additional 
directories: `gogoproto`, `tendermint`, and `protos`. 

The `gogoproto` and `tendermint` directories are the protobuf generated code used by ``abci``. It adds proper Python modules and preserves all the import statements used by Tendermint for the various protobuf files spread 
across their codebase.  The ``protos`` directory is the source .proto files.

To (re)build the protobuf files:

1. Install `protoc` so it's available in your PATH as a command
2. Run `make update-proto`



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eckelj/py-abci",
    "name": "planetmint-abci",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "blockchain,tendermint,abci",
    "author": "Dave Bryson",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/33/71/30836decf40732b0e199c6f435fa7f9fa8df2614c954ee03340090e1fdfb/planetmint-abci-0.8.4.tar.gz",
    "platform": "unix",
    "description": "[![pypi](https://img.shields.io/pypi/v/abci.svg)](https://pypi.python.org/pypi/abci)\n[![build](https://travis-ci.org/davebryson/py-abci.svg?branch=master)](https://https://travis-ci.org/davebryson/py-abci)\n[![codecoverage](https://codecov.io/gh/davebryson/py-abci/branch/master/graph/badge.svg)](https://codecov.io/gh/davebryson/py-abci)\n\n# Py-ABCI\nBuild Tendermint blockchain applications in Python.  It's fun.  This library provides the core functionality needed to create Tendermint ABCI applications.\n\n## Supported Tendermint Version\n* Tendermint *0.34.24*\n* ABCI *0.17.0*\n\n## Installation\nRequires Python >= 3.9\n\n`pip install abci`\n\nYou'll need a binary version of the Tendermint engine. \nAvailable here: https://github.com/tendermint/tendermint/releases\n\n**Make sure the Tendermint version you download matches the current support version of this library**\n\n## Quick Start - demo\n\nA very simple demo application is included and available from the command line as `counter`. You can find the code here: https://github.com/davebryson/py-abci/blob/master/src/example/counter.py\n\nTo try it out:\n1. Make sure you have the Tendermint binary setup locally and in your path.  To test it's working\nopen a terminal window and type:\n```text\n>> tendermint version\n```\nIt should output your version of Tendermint that should match the currently supported version \nof this library.\n\n2. Next, initialize Tendermint by running:\n```text\n>> tendermint init\n```\n\n3. Start the Tendermint node:\n```text\n>> tendermint node\n```\nThe node will start, but will be waiting for you application to start.\n\n4. Open another terminal, and start the `counter` application. The `counter` will be available\nfrom within the Python environment where you installed `abci`\n```text\n>> counter\n```\nYou'll see the application start, and in the Tendermint terminal, you'll see the output of \nblocks being produced\n\n5. Now, open a 3rd terminal window to send some transaction to the blockchain.  To do this we'll\nuse the `curl` application to send transaction to the local blockchain over http. For example:\n```text\n>> curl http://localhost:26657/broadcast_tx_commit?tx=0x01\n>> curl http://localhost:26657/broadcast_tx_commit?tx=0x02\n```\nThe counter application expects you to send `transactions` as numbers encoded as hex in order: 1,2,3...\nIt will reject and out-of-order numbers.  You can always see the latest accepted value by sending the\nrequest:\n```text\n>> curl http://localhost:26657/abci_query\n```\n\nTo shut down the application enter `CTRL-C`\n\n## Get Started\nTo start building your own application:\n1. Extend the `abci.application.BaseApplication` class\n2. Implement the Tendermint ABCI callbacks - see https://docs.tendermint.com/v0.34/spec/abci for details on how they work\n3. Start it:\n```python\nfrom abci.server import ABCIServer\n\napp = ABCIServer(app=MyApplication())\napp.run()\n```\nSee the ``counter.py`` application in the ``example`` directory https://github.com/davebryson/py-abci/blob/master/src/example/counter.py for a full example.\n\n\n## Developing on the code base\nIf you're working directly on the code base.  Install a local editable version:\n\n`pip install --editable '.[test]'`\n\n## Updating Protobuf code\n\n**You should only re-generate the protobuf code if you're updating the associated protobuf files, \nand/or contributing to this code base.  You do not need to rebuild protos to create apps.**  \n\nA note on protobuf:  The primary code directory is `abci`, but you'll notice additional \ndirectories: `gogoproto`, `tendermint`, and `protos`. \n\nThe `gogoproto` and `tendermint` directories are the protobuf generated code used by ``abci``. It adds proper Python modules and preserves all the import statements used by Tendermint for the various protobuf files spread \nacross their codebase.  The ``protos`` directory is the source .proto files.\n\nTo (re)build the protobuf files:\n\n1. Install `protoc` so it's available in your PATH as a command\n2. Run `make update-proto`\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Python based ABCI Server for Tendermint",
    "version": "0.8.4",
    "project_urls": {
        "Homepage": "https://github.com/eckelj/py-abci",
        "Source": "https://github.com/eckelj/py-abci"
    },
    "split_keywords": [
        "blockchain",
        "tendermint",
        "abci"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "337130836decf40732b0e199c6f435fa7f9fa8df2614c954ee03340090e1fdfb",
                "md5": "0ef895b7fee78ce224bacf1335665eed",
                "sha256": "1e969da0a10d0e5ceb82993645d0cd92076c2a7df03b701fd17837c63ace1f57"
            },
            "downloads": -1,
            "filename": "planetmint-abci-0.8.4.tar.gz",
            "has_sig": false,
            "md5_digest": "0ef895b7fee78ce224bacf1335665eed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 37030,
            "upload_time": "2023-06-21T07:23:32",
            "upload_time_iso_8601": "2023-06-21T07:23:32.338951Z",
            "url": "https://files.pythonhosted.org/packages/33/71/30836decf40732b0e199c6f435fa7f9fa8df2614c954ee03340090e1fdfb/planetmint-abci-0.8.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-21 07:23:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eckelj",
    "github_project": "py-abci",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "lcname": "planetmint-abci"
}
        
Elapsed time: 0.10468s