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.
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:
pip install moralis
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",
"to_block": 1.2,
}
result = evm_api.balance.get_native_balance(
api_key=api_key,
params=params,
)
print(result)
- π Quick start
- π§ Table of Contents
- βοΈ Star us
- π€ Need help
- π Examples
- π References
- π§ββοΈ Community
If this JS SDK helps you build your dapps faster - please star this project, every star makes us very happy!
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.
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",
"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_streams.get_streams(
api_key=api_key,
params=params,
)
print(result)
For more info see the live docs, or the docs pages