knishioclient


Nameknishioclient JSON
Version 0.1.52 PyPI version JSON
download
home_pagehttps://github.com/WishKnish/KnishIO-Client-Python
SummaryKnish.IO Python API Client
upload_time2024-06-25 13:29:48
maintainerNone
docs_urlNone
authorYuri Kizilov
requires_python>=3.6.0
licenseLICENSE
keywords wishknish knishio blockchain dag client
VCS
bugtrack_url
requirements libnacl numpy base58 setuptools aiohttp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Knish.IO Python Client
This is an experimental Python implementation of the Knish.IO API client. Its purpose is to expose class libraries for building and signing Knish.IO Molecules, composing Atoms (presently "A", "C", "M", "U", "I", "T" and "V" isotopes are supported), and generating Wallet addresses (public keys) and private keys as per the Knish.IO Technical Whitepaper.

# Getting Started
1. `pip install knishio-client-python`
2. Inside your application code, `from knishioclient.models import Molecule, Wallet`
3. Build a 2048-character user secret via your preferred methodology (random string?).
4. Initialize a wallet with `wallet = Wallet(secret, token)`

You can also specify a third, optional `position` argument represents the private key index (hexadecimal), and must NEVER be used more than once. It will be generated randmly if not provided.

A fourth argument, `salt_length`, helps tweak the length of the random `position`, if the parameter is not provided.

The `token` argument (string) is the slug for the token being transacted with. Knish.IO anticipates user's personal metadata being kept under the `USER` token.

# Building Your Molecule
1. Build your molecule with `molecule = Molecule(secret, source_wallet, remainder_wallet, cell_slug)` The `cell_slug` argument represents the slug for your Knish.IO cell. It's meant to segregate molecules of one use case from others. Leave it null if not sure.
2. For a "M"-type molecule, build your metadata as an array of objects, for example:
```python
data = [
  {
    'key': 'name',
    'value': 'foo'
  },
  {
    'key': 'email',
    'value': 'bar'
  },
  #...
]
```
or
```python
data = {
  'name': 'foo',
  'email': 'bar',
  #...
}
```
3. Initialize the molecule as "M"-type: `molecule.init_meta(data, meta_type, meta_id)` The `meta_type` and `meta_id` arguments represent a polymorphic key to whatever asset you are attaching this metadata to.
4. Sign the molecule with the user secret: `molecule.sign()`
5. Make sure everything checks out by verifying the molecule:
```python
from knishioclient.models import Molecule, Wallet

source_wallet = Wallet(secret, token)
remainder_wallet = Wallet(secret, token)

molecule = Molecule(secret, source_wallet, remainder_wallet, cell_slug)

molecule.init_meta(data, meta_type, meta_id)
molecule.sign()

if molecule.check():
  #...  Do stuff? Send the molecule to a Knish.IO node, maybe?
```

# Broadcasting
1. Knish.IO nodes use GraphQL to receive new molecules as a Mutation. The code for the mutation is as follows:
```
  mutation MoleculeMutation($molecule: MoleculeInput!) {
    ProposeMolecule(
      molecule: $molecule,
    ) {
      molecularHash,
      height,
      depth,
      status,
      reason,
      reasonPayload,
      createdAt,
      receivedAt,
      processedAt,
      broadcastedAt
    }
  }
```
2. Use your favorite GraphQL client to send the mutation to a Knish.IO node with the molecule you've signed as the only parameter.
3. The `status` field of the response will indicate whether the molecule was accepted or rejected, or if it's pending further processing. The `reason` and `reasonPayload` fields can help further diagnose and handle rejections.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/WishKnish/KnishIO-Client-Python",
    "name": "knishioclient",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6.0",
    "maintainer_email": null,
    "keywords": "wishknish, knishio, blockchain, dag, client",
    "author": "Yuri Kizilov",
    "author_email": "y.kizilov.sev@yandex.ru",
    "download_url": "https://files.pythonhosted.org/packages/8c/85/88b7df2642af033e21b301a9f76e553dcfb621ee29c284107ee4d1605050/knishioclient-0.1.52.tar.gz",
    "platform": "all",
    "description": "# Knish.IO Python Client\nThis is an experimental Python implementation of the Knish.IO API client. Its purpose is to expose class libraries for building and signing Knish.IO Molecules, composing Atoms (presently \"A\", \"C\", \"M\", \"U\", \"I\", \"T\" and \"V\" isotopes are supported), and generating Wallet addresses (public keys) and private keys as per the Knish.IO Technical Whitepaper.\n\n# Getting Started\n1. `pip install knishio-client-python`\n2. Inside your application code, `from knishioclient.models import Molecule, Wallet`\n3. Build a 2048-character user secret via your preferred methodology (random string?).\n4. Initialize a wallet with `wallet = Wallet(secret, token)`\n\nYou can also specify a third, optional `position` argument represents the private key index (hexadecimal), and must NEVER be used more than once. It will be generated randmly if not provided.\n\nA fourth argument, `salt_length`, helps tweak the length of the random `position`, if the parameter is not provided.\n\nThe `token` argument (string) is the slug for the token being transacted with. Knish.IO anticipates user's personal metadata being kept under the `USER` token.\n\n# Building Your Molecule\n1. Build your molecule with `molecule = Molecule(secret, source_wallet, remainder_wallet, cell_slug)` The `cell_slug` argument represents the slug for your Knish.IO cell. It's meant to segregate molecules of one use case from others. Leave it null if not sure.\n2. For a \"M\"-type molecule, build your metadata as an array of objects, for example:\n```python\ndata = [\n  {\n    'key': 'name',\n    'value': 'foo'\n  },\n  {\n    'key': 'email',\n    'value': 'bar'\n  },\n  #...\n]\n```\nor\n```python\ndata = {\n  'name': 'foo',\n  'email': 'bar',\n  #...\n}\n```\n3. Initialize the molecule as \"M\"-type: `molecule.init_meta(data, meta_type, meta_id)` The `meta_type` and `meta_id` arguments represent a polymorphic key to whatever asset you are attaching this metadata to.\n4. Sign the molecule with the user secret: `molecule.sign()`\n5. Make sure everything checks out by verifying the molecule:\n```python\nfrom knishioclient.models import Molecule, Wallet\n\nsource_wallet = Wallet(secret, token)\nremainder_wallet = Wallet(secret, token)\n\nmolecule = Molecule(secret, source_wallet, remainder_wallet, cell_slug)\n\nmolecule.init_meta(data, meta_type, meta_id)\nmolecule.sign()\n\nif molecule.check():\n  #...  Do stuff? Send the molecule to a Knish.IO node, maybe?\n```\n\n# Broadcasting\n1. Knish.IO nodes use GraphQL to receive new molecules as a Mutation. The code for the mutation is as follows:\n```\n  mutation MoleculeMutation($molecule: MoleculeInput!) {\n    ProposeMolecule(\n      molecule: $molecule,\n    ) {\n      molecularHash,\n      height,\n      depth,\n      status,\n      reason,\n      reasonPayload,\n      createdAt,\n      receivedAt,\n      processedAt,\n      broadcastedAt\n    }\n  }\n```\n2. Use your favorite GraphQL client to send the mutation to a Knish.IO node with the molecule you've signed as the only parameter.\n3. The `status` field of the response will indicate whether the molecule was accepted or rejected, or if it's pending further processing. The `reason` and `reasonPayload` fields can help further diagnose and handle rejections.\n",
    "bugtrack_url": null,
    "license": "LICENSE",
    "summary": "Knish.IO Python API Client",
    "version": "0.1.52",
    "project_urls": {
        "Docs": "https://docs.knish.io",
        "GitHub: issues": "https://github.com/WishKnish/KnishIO/issues",
        "GitHub: source": "https://github.com/WishKnish/KnishIO",
        "GitHub: wiki": "https://github.com/WishKnish/KnishIO/wiki",
        "Homepage": "https://knish.io"
    },
    "split_keywords": [
        "wishknish",
        " knishio",
        " blockchain",
        " dag",
        " client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6038910d4718227053f5b59db086f28869f937c741fd808797fca9f334df0393",
                "md5": "4e8efa5f9fcdf0ead1000a227ef2e259",
                "sha256": "fdff70bd511bb6bc9d1cceacb3918fe0d6b7cf5c07bb3c9289cd60a34672acb1"
            },
            "downloads": -1,
            "filename": "knishioclient-0.1.52-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4e8efa5f9fcdf0ead1000a227ef2e259",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.0",
            "size": 39879,
            "upload_time": "2024-06-25T13:29:47",
            "upload_time_iso_8601": "2024-06-25T13:29:47.128811Z",
            "url": "https://files.pythonhosted.org/packages/60/38/910d4718227053f5b59db086f28869f937c741fd808797fca9f334df0393/knishioclient-0.1.52-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c8588b7df2642af033e21b301a9f76e553dcfb621ee29c284107ee4d1605050",
                "md5": "a40126a20c5e0c4217778b881fb47d25",
                "sha256": "6a571a1bb8aa1c20181116e9a9fe52f1e87ddbb43601ef5728c262c06797c9c6"
            },
            "downloads": -1,
            "filename": "knishioclient-0.1.52.tar.gz",
            "has_sig": false,
            "md5_digest": "a40126a20c5e0c4217778b881fb47d25",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 37781,
            "upload_time": "2024-06-25T13:29:48",
            "upload_time_iso_8601": "2024-06-25T13:29:48.431249Z",
            "url": "https://files.pythonhosted.org/packages/8c/85/88b7df2642af033e21b301a9f76e553dcfb621ee29c284107ee4d1605050/knishioclient-0.1.52.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-25 13:29:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "WishKnish",
    "github_project": "KnishIO-Client-Python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "libnacl",
            "specs": [
                [
                    ">=",
                    "2.1.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "base58",
            "specs": [
                [
                    ">=",
                    "2.1.1"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "70.0.0"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    ">=",
                    "3.9.5"
                ]
            ]
        }
    ],
    "lcname": "knishioclient"
}
        
Elapsed time: 0.29808s