Giter VIP home page Giter VIP logo

bramblpy's Introduction

Brambl-Py

A Python API wrapper to communicate with the Topl blockchain via requests made using the requests module. (Recommended for use with Python 3.x)

Installation & Usage

To install from pip run "pip install brambl" in your project directory

----------------------------------------------------------------------

Create an instance of Brambl-Py in your Python application by using:

  • from brambl import Brambl;

Create an instance of the Requests module in your Python application by using:

  • from brambl.modules import Requests

Create an instance of the KeyManager module in your Python application by using:

  • from brambl.modules import KeyManager

Most of the functions return jsons loaded from requests made using the requests module. Example usage:

  • from brambl.modules import Requests
  • BramblObj = Requests.Requests();
  • print(BramblObj.getMempool());

----------------------------------------------------------------------

Getting a response once a transaction is confirmed and included in a block:

  • BramblObj.createAssets({'issuer': "6sYyiTguyQ455w2dGEaNbrwkAWAEYV1Zk6FtZMknWDKQ", 'assetCode': "testAssets", 'recipient': "6sYyiTguyQ455w2dGEaNbrwkAWAEYV1Zk6FtZMknWDKQ", 'amount': 10, 'fee': 0, 'data': ""});

Setting the 'onConfirm' field to be True in certain requests (those that generate transactions) returns a response once that transaction is confirmed and included in a block instead of once it is created and sent to the mempool. The 'interval' parameter can be defined to specify the interval in seconds before repeating the findTransactionById request contained within the function and the 'repeats' field can be defined to specify the number of times the findTransactionById request should be repeated at the specified interval. Both these fields assume a default value of 3 if not explicitly specified. Leaving out these 3 fields initiates a transaction without awaiting confirmation.

The following methods extend the onConfirm functionality:

  • createAssets
  • transferAssets
  • transferPolys
  • transferArbits
  • transferArbitsByPublicKey

----------------------------------------------------------------------

See the Requests.py file for various other methods that can be invoked by your Brambl-Py instance to communicate with the Topl blockchain.

Api-Key protection

To api-key protect your node and requests follow these steps:

  1. Choose an api-key (some string)
  2. Find the Blake2b256 hash of this string (can be found using the blakeHash function in this module)
  3. Set the "apiKeyHash" field in the settings file of your node to be the blakeHash of your chosen api-key as found in the previous step
  4. Use the setApiKey function in this module to set your chosen api-key for all requests made using a Brambl-Py instance in your application

License

Brambl-Py is licensed under the Mozilla Public License version 2.0 (MPL 2.0), also included in our repository in the LICENSE file.

bramblpy's People

Contributors

arjunmehta01 avatar c-georgen avatar dependabot[bot] avatar scasplte2 avatar yamir1995 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.