TransferChain Docs
  • Introduction to TransferChain
    • Why TransferChain
    • Who is using TransferChain
    • About
  • Client & SDKs
    • Getting Started
      • Introduction to TransferChain SDKs
      • FAQ
    • Python
    • Go
    • Javascript
    • TransferChain SDK Standard
    • Prerequisites
  • CLI
    • About
    • Quickstart
    • Using TransferChain CLI
      • Initialize
      • Storage
      • Blockchain
    • Authentication and Access Credentials
    • Prerequisites
  • Core Concepts
    • Understanding TransferChain
    • Cryptography
      • Authentication & Authorization
      • Encryption
      • Elliptic-Curve
      • Address Generation
    • Blockchain
      • Decentralization
      • Architecture
    • gRPC
    • Data Distribution
    • Immutability
    • Data Redundancy
    • Multi Region Availability
    • Secure Messaging
    • Overview of TransferChain System Components
  • Management & Roles
    • TransferChain Management Portal
    • User Roles
  • Billing & Payment
    • Developer Plan
  • Resources
    • Blog
    • Support Center
    • Knowledge Base
    • Community
Powered by GitBook
On this page
  • Getting Started
  • Initialize TransferChain
  • Add Master User
  • Add User
  • Get User
  • Restore Master User
  1. Client & SDKs

Python

TransferChain Python SDK

PreviousFAQNextGo

Last updated 11 months ago

The TransferChain Infrastructure SDK for Python enables you to write code to manage TransferChain Infrastructure resources.

Getting Started

  • To Start building the your product, please go ahead and check out

  • For further information on documentation and technical specs, please visit

  • API token and Secret needs to be requested from TransferChain via or please contact your customer success manager to obtain them.

Initialize TransferChain

```python
# Import the TransferChain class from the SDK
from transferchain.client import TransferChain

# Initialize TransferChain
tc = TransferChain()
```

Add Master User

```python
# Import the TransferChain class from the SDK
from transferchain.client import TransferChain

# Initialize TransferChain
tc = TransferChain()

# When the SDK is initialized for the first time, creating a master user for that SDK is facilitated by using the 'add_master_user' operation.
# Example: Create a Master User
result_add_master_user = tc.add_master_user()
master_user = result_add_master_user.data
print(f"Master User created: {master_user.id}")
```

Add User

```python
# Import the TransferChain class from the SDK
from transferchain.client import TransferChain

# Initialize TransferChain
tc = TransferChain()

# Example: Add a User
result_add_user = tc.add_user()
added_user = result_add_user.data
print(f"User added: {added_user.id}")
```

Get User

```python
# Import the TransferChain class from the SDK
import os
from transferchain.client import TransferChain

# Initialize TransferChain
tc = TransferChain()

# Get TRANSFERCHAIN_USER_ID variable from env
user_id = os.environ.get('TRANSFERCHAIN_USER_ID')

# When any storage or transfer operation is desired, a user is required, and the 'get_user' method provides the necessary information related to the required user.
# Example: Get a User
user_id_to_get = user_id
user_info = tc.get_user(user_id_to_get)
print(f"User information: {user_info.id}")
```

Restore Master User

```python
# Import the TransferChain class from the SDK
from transferchain.client import TransferChain

# Initialize TransferChain
tc = TransferChain()

# It writes the addresses of the master and user in the blockchain to the SDK database using the mnemonics found in the environment, and returns all transactions found to the SDK user.
# Example: Restore a Master User
result_restore_master_user = tc.restore_master_user()
restored_master_user = result_restore_master_user.data
print(f"Master User restored: {restored_master_user}")
```

https://github.com/TransferChain/transferchain-python-sdk
https://transferchain-python-sdk.readthedocs.io/
support@transferchain.io