SDK Explorer

Getting Started with Smart Contract Platform - Python

Use the Python SDK to interact with Smart Contract Platform APIs, which allow you interact with smart contracts on the blockchain using the Developer Services platform.

This page provides short examples of how to install and use the Smart Contract Platform SDK. For complete examples, see the Sample Projects page. For more information see the Smart Contract Platform documentation.

Although not a requirement for using the SDK, Circle recommends that you use a virtual environment for development. A Python virtual environment is an isolated environment that you can use to silo your project from the global Python environment.

Use the following command to install the SDK with pip:

Shell
pip install circle-smart-contract-platform

To start using the SDK, you first need to configure a client and initialize it with your API key and entity secret.

The following example shows how to import the client and configure it to use your API key and entity secret:

Python
from circle.web3 import utils

client = utils.init_smart_contract_platform_client(
  api_key="Your API KEY",
  entity_secret="Your entity secret"
)

The following example shows how to import a smart contract using the client:

Python
from circle.web3 import smart_contract_platform

api_instance = smart_contract_platform.DeployImportApi(client)

# import contract
try:
    request = smart_contract_platform.ImportContractRequest.from_dict({
        "name": "UChildERC20Proxy",
        "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
        "blockchain": "MATIC"
    })
    response = api_instance.import_contract(request)
    print(response)
except smart_contract_platform.ApiException as e:
    print("Exception when calling DeployImportApi->import_contract: %s\n" % e)

The client for the Smart Contract Platform SDK accepts the following configuration parameters:

OptionRequired?Description
api_keyYesThe API key used to authenticate requests to the Circle API.
entity_secretYesYour configured entity secret.
hostNoThe base URL that overrides the default API URL of https://api.circle.com/v1/w3s.
user_agentNoCustom user agent request header. If provided, it's added before the default user agent header.
Did this page help you?
© 2023-2025 Circle Technology Services, LLC. All rights reserved.