🎉 ⏱ Ready to build? Get early access now!⏱ 🎉
Create your own token with Python
In this guide we will create tokens that can be used as your own currency with the thirdweb Python SDK
Intro
This guide explains how to create your own currency. We need to create a project in the dashboard and create a Token module inside our project. We also need to connect a wallet. So if you don't have a wallet, make sure to sign up with MetaMask or CoinWallet. If you don't have a MetaMask wallet, you can follow our guide.
Dashboard setup
The first thing we need to do is head over to the dashboard and create a project and a Token module. if you don't know how to do this, check out this guide.
Once your Token module has been created, it's time to mint our own currency, but we don't need the dashboard for that! For use cases where the interaction has a high frequency and requires conditions, using the sdk is more efficient.

The code
1. Create a Python file and fire up a virtual environment
Go ahead and create a new Python file. Let's call it currency.py
and open it in your favourite code editor. We'll use Visual Studio Code.

Next up use the following code in your terminal to create a virtual environment and install the ThirdWeb SDK!
Virtual-env
#create a virtual environment python3 -m venv ./myenv #activate virtual environment source ./myenv/bin/activate #install the thirdweb sdk pip install thirdweb-sdk
Conda
#create a virtual environment conda create -n "thirdweb" python=3.9 #activate virtual environment conda activate thirdweb #install the thirdweb sdk pip install thirdweb-sdk
2. Import the SDK
Let's take the code step by step. At the end we'll include a full code snippet.
Import the following classes from the SDK.
We will use the dotenv library for our private key in a bit.
# Importing stuff from thirdweb import ThirdwebSdk, SdkOptions, MintArg from dotenv import load_dotenv import os
In order to make use of our SDK, you need to establish a connection to a blockchain. Click here to learn how to connect to the blockchain and instantiate our SDK.
For this guide, you will need to instantiate the SDK following these steps, using your own signer with thirdweb.
3. Define which module to use
Now we need to define which module we want to use. This is the module we just created inside our project Making your own currency. We called the module Raza Coin. This module has an address. We need to pass the address here. You can find the address here, under Raza Coin:
In our currency.py
we include the following code. First we define a variable currency_smart_contract_address and store our module address in here.
Then we create an object that uses the token module inside the SDK with our address.

#pick your module and enter the smart contract address currency_smart_contract_address = "0xdd25FAEE772FbB1bcB7ba0b2cEE6387A8F82f032" token_module = sdk.get_currency_module(currency_smart_contract_address)
4. Time to mint the coins (tokens)!
The arguments passed over here are the same as minting the tokens inside the dashboard. If you want to familiarize yourself with the process, check out the dashboard! Ethereum deals with 18 decimals, so we need to adjust the input figure.
#Mint tokens on your smartcontract input_amount = 1000 converted_amount = amount* (10**18) token_module.mint(converted_amount)
5. Results
Get the balance to check it out or head over to the dashboard.
#check your balance to check your coins! print(token_module.balance())
So the only thing left is to run our code! Open a terminal and paste the following:
# Runs the python file python python_nft.py
That's it!
Congratulations! You have now created your own currency using only Python code! The next step is spending it!