Git Product home page Git Product logo

codechain-sdk-python's Introduction

CodeChain SDK for Python

A Python SDK for CodeChain.

API Documentation (For SDK users)

Not prepared

Getting Started (For SDK developers)

Submitting patches

  • Use Black to autoformat your code. This should be done for you as a git pre-commit hook.

First time setup

  • Clone your GitHub fork locally:
  • Add the main repository as a remote to update later:
  • Create a virtualenv using pipenv:
$ make init
  • Install the pre-commit hooks:
$ pre-commit install --install-hooks

Add dependency

  • Install the dependency using pipenv
  1. In the test environment
$ pipenv install [package] --dev
  1. In the production
$ pip3 install [package]

and specify it to the setup.py

  • lock the dependency
$ pipenv lock

Run test cases

$ make test

Usage

#!/usr/bin/python3
from codechain import SDK

sdk = SDK("http://localhost:8080", "tc")

ACCOUNT_SECRET = "ede1d4ccb4ec9a8bbbae9a13db3f4a7b56ea04189be86ac3a6a439d9a0a1addd"
ACCOUNT_ADDRESS = "tccq9h7vnl68frvqapzv3tujrxtxtwqdnxw6yamrrgd"
ACCOUNT_PASSPHRASE = "satoshi"

address = sdk.rpc.account.import_raw(ACCOUNT_SECRET, ACCOUNT_PASSPHRASE)
address = "tcaqyqckq0zgdxgpck6tjdg4qmp52p2vx3qaexqnegylk"

tx = sdk.core.create_mint_asset_transaction(
    address,
    None,
    None,
    None,
    0,
    {"name": "Silver Coin", "description": "...", "icon_url": "..."},
    None,
    None,
    None,
    100000000,
)

tx_hash = sdk.rpc.chain.send_transaction(tx, ACCOUNT_ADDRESS, ACCOUNT_PASSPHRASE)

result = sdk.rpc.chain.contains_transaction(tx_hash)

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.