Skip to main content

An SDK for interacting with the Kadena Blockchain

Project description

To Use

from kadena_sdk import KadenaSdk, KeyPair

# Create your keypair and setup the SDK with the endpoint you desire in life.
key_pair = KeyPair(type='json',
  priv_key='5e8b125c89ed409f2cfcc6e863e8aafd60b9d80a4d2333a12592f7a961a62bf8',
  pub_key='ad273a54460305767e2e36f41d1a5fe78c48474a6e3bc18624d53fbbbb5974bb')
kadena = KadenaSdk('https://api.testnet.chainweb.com', 
  'testnet04', 
  key_pair=key_pair)

# Very open ended: Work directly with the payload.
payload = {
  "exec": {
    "data": {},
    "code": '(format "Test {}" ["hello"])'
  }
}

# SDK works with whichever chains you choose!
chain_ids = ['0', '1']

# Commands is a dictionary where each key is the chain id and the value
# is the command to be sent
cmds = kadena.build_command(payload, chain_ids)

# You can use local or send to dirty read or commit respectively.
# These are the /local and /send endpoints.
res = kadena.local(cmds)

# Responses are in a dictionary with keys being the chains 
# that were interacted with
print(res['0'].json())

# You can also listen to commands. This is a blocking command.
# Pass in the transaction id and the chain you want to listen on.
kadena.listen('tx_id', '0')

To Build and Deploy

python3 -m build
python3 -m twine upload dist/*

To Test

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kadena_sdk-2.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kadena_sdk-2.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file kadena_sdk-2.0.1.tar.gz.

File metadata

  • Download URL: kadena_sdk-2.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for kadena_sdk-2.0.1.tar.gz
Algorithm Hash digest
SHA256 75c95f541fd2dc75a4a5c5c07b3597218b5e3ac7daec4be8bca7aa9e45ae98e3
MD5 433375a329d4509caae53e74ac500222
BLAKE2b-256 aae23234c7f8b8c0af8d56a41ed6e3dca01120731c102f386c7b91a0ecbf2542

See more details on using hashes here.

File details

Details for the file kadena_sdk-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: kadena_sdk-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for kadena_sdk-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa9924aa567a31258300661198b52b840acc1d119c1cfd4619d24c798b33cf77
MD5 75e28fc61a7720cf6618feda28d7b568
BLAKE2b-256 7e5195c0c1e9a3589478da1e1042023a4af53f0dc1f4dbea95de2544cffbdd57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page