Code Samples
info
The code samples in this section are tested with Python 3.9
Prerequisites
The following series of guides demonstrate how to perform common Rosetta API use-cases.
All code samples are written in Python and require the requests
library to be installed on your Python environment.
This can be done with a following command:
pip3 install requests
The source code for all code samples is available on the official Mina Documentation Github page and should be used only for demonstration purposes.
Set up sample project
Start with the required imports and define constants:
import json
from subprocess import run, PIPE
from time import sleep
from requests import post
BASE_URL = "http://localhost:3087"
SIGNER_PATH = 'path/to/signer.exe'
MAINNET_NETWORK_IDENTIFIER = {
"network_identifier": {
"blockchain": "mina",
"network": "mainnet"
}
}
MINA_TOKEN_ID = "1"
MINA_DECIMALS = 9
MINA_SYMBOL = "MINA"
MINA_CURVE_TYPE = "pallas"
MINA_SIGNATURE_TYPE = "schnorr_poseidon"