Skip to main content

The official Moralis Python SDK

Project description

Moralis JS SDK

Moralis Python SDK

Join the Moralis DAO on Discord Check the docs Discourse posts
npm

A library that gives you access to the powerful Moralis Server backend from your Python app.


Features:

  • Web3 authentication
  • Make Evm api and Solana api calls
  • Stream realtime blockchain data

... and much more. Check the official Moralis docs for more details.

🚀 Quick start

If you're new to Moralis, check the quickstart guide in the official docs on how to get started.

If you're already familiar with Moralis and have your account registered. Then follow along to connect your SDK:

1. Install Moralis

pip install moralis

2. Call your methods

Import the correct module from the SDK and call the method you need. For a full reference of all the methods available, check the references section.

from moralis import evm_api

api_key = "YOUR_API_KEY"
params = {
    "address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e", 
    "chain": "eth", 
    "providerUrl": "", 
    "to_block": 1.2, 
}

result = evm_api.balance.get_native_balance(
    api_key=api_key,
    params=params,
)

print(result)

🧭 Table of Contents

⭐️ Star us

If this JS SDK helps you build your dapps faster - please star this project, every star makes us very happy!

🤝 Need help

If you need help with setting up the boilerplate or have other questions - don't hesitate to write in our community forum and we will check asap. Forum link. The best thing about this SDK is the super active community ready to help at any time! We help each other.

👀 Examples

Example getting native balance of an address via the EVM balance API

from moralis import evm_api

api_key = "YOUR_API_KEY"
params = {
    "address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e", 
    "chain": "eth", 
    "providerUrl": "", 
    "to_block": 1.2, 
}

result = evm_api.balance.get_native_balance(
    api_key=api_key,
    params=params,
)

print(result)

Example getting native balance of an address via the SOL account API

from moralis import sol_api

api_key = "YOUR_API_KEY"
params = {
    "network": "", 
    "address": "", 
}

result = sol_api.account.balance(
    api_key=api_key,
    params=params,
)

print(result)

Example getting authentication message via the Auth API

from moralis import auth

api_key = "YOUR_API_KEY"
body = {
    "domain": "defi.finance", 
    "chainId": "1", 
    "address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B", 
    "statement": "Please confirm", 
    "uri": "https://defi.finance/", 
    "expirationTime": "2020-01-01T00:00:00.000Z", 
    "notBefore": "2020-01-01T00:00:00.000Z", 
    "resources": ['https://docs.moralis.io/'], 
    "timeout": 15, 
}

result = auth.challenge.request_challenge_evm(
    api_key=api_key,
    body=body,
)

print(result)

Example getting stream via the Streams API

from moralis import streams

api_key = "YOUR_API_KEY"
params = {
    "limit": 1.2, 
    "cursor": "", 
}

result = streams.evm.get_streams(
    api_key=api_key,
    params=params,
)

print(result)

📚 References

For more info see the live docs, or the docs pages

evm_api

sol_api

auth

streams

🧙‍♂️ Community

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

moralis-0.1.8.tar.gz (257.8 kB view details)

Uploaded Source

Built Distribution

moralis-0.1.8-py3-none-any.whl (612.2 kB view details)

Uploaded Python 3

File details

Details for the file moralis-0.1.8.tar.gz.

File metadata

  • Download URL: moralis-0.1.8.tar.gz
  • Upload date:
  • Size: 257.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for moralis-0.1.8.tar.gz
Algorithm Hash digest
SHA256 9773920b454075285ed18dd7d268ce1a195ba4401f0d5b2ed83e115797e10b4d
MD5 342bb27b0bd4399538184c42b611196e
BLAKE2b-256 77f23463780cabfe68192ac3d9881adbadf2a86c7a0ff5e5606cdd2a69ec7340

See more details on using hashes here.

File details

Details for the file moralis-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: moralis-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 612.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for moralis-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 8f92d51c8baeb488722ec981bfe29588efd9e27d34a8a576553054ce68683135
MD5 6776d65caf8192bd40f9848c59b46ff2
BLAKE2b-256 e6334f98a0c2db94f1310e2e02ae377db8ebd82a6b9ea211b052313c891168e0

See more details on using hashes here.

Supported by

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