A library for creating 1Sat Ordinals NFTs on BSV blockchain
Project description
Yenpoint 1Sat Ordinals
A Python library for creating 1Sat Ordinals NFTs on the BSV blockchain.
Installation
pip install yenpoint_1satordinals
Usage
- Preparing Ordinal NFT outputs
Use the add_1sat_outputs function. You need three arguments, ordinal address, data, and change address.
ordinal_address: the destination address of inscribing 1 sat ordinal NFT
data: it can take text strings or your file path to the data that you want to inscribe.
change_address: the address to recieve your change ammount
An example of Inscribing texts
from yenpoint_1satordinals import add_1sat_outputs
from pathlib import Path
outputs = add_1sat_outputs(
ordinal_address="your_ordinal_address",
data="Hello, World!",
change_address="your_change_address"
)
or
An example of Inscribing data You should define the path to the file that you want to inscribe first
from yenpoint_1satordinals import add_1sat_outputs
data_path = Path("data/image1.jpeg")
outputs = add_1sat_outputs(
ordinal_address="1HZqesnTJK8HK4Uypvvt7FgHoBdosBvTiS",
data=data_path,
change_address="1MWLhxkoucmstD5VGLZeiaq5YMdDRMn9oS"
)
Preparing the Transaction
from bsv.transaction_input import TransactionInput
from bsv.transaction import Transaction
from bsv import PrivateKey
from bsv.script import P2PKH
# Here adding the code of creating ordinal outputs
tx_input = TransactionInput(
source_transaction=previous_tx,
source_txid=previous_tx.txid(),
source_output_index=previous_tx_vout,
unlocking_script_template=P2PKH().unlock(sender_private_key)
)
tx = Transaction([tx_input], outputs)
tx.fee()
tx.sign()
Example of customising the Transaction, adding an additional output
from bsv.transaction_input import TransactionInput
from bsv.transaction_output import TransactionOutput
from bsv.transaction import Transaction
from bsv import PrivateKey
from bsv.script import P2PKH
# Here adding the code of creating ordinal outputs
tx_input = TransactionInput(
source_transaction=previous_tx,
source_txid=previous_tx.txid(),
source_output_index=previous_tx_vout,
unlocking_script_template=P2PKH().unlock(sender_private_key)
)
Additional_output = TransactionOutput(
locking_script=P2PKH().lock("1QnWY1CWbWGeqobBBoxdZZ3DDeWUC2VLn"),
satoshis=33,
change=False
)
tx = Transaction([tx_input], outputs + [Additional_output])
tx.fee()
tx.sign()
Do you async & await for the transaction broadcast.
import asyncio
async def main():
try:
# All other codes
await tx.broadcast()
except Exception as e:
print(f"Error occurred: {str(e)}")
if __name__ == "__main__":
asyncio.run(main())
- It automaticaly creates an oridnal, fee, and change outputs.
- The fee of inscription is less than 0.1 cent, 998 satoshi. (The commarcial license for cheaper fee rate.)
- You also have to pay the mining fee for miners, 1 satoshi/ kb of data.
License
This library is available for individual use. For commercial use, including metadata, and parsing features, an Enterprise license is required. See LICENSE.md for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yenpoint_1satordinals-0.1.0.tar.gz.
File metadata
- Download URL: yenpoint_1satordinals-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
987025207fe7f255d086d06dfecb43d99b67bbec215bc70c1dfcb363e52306b8
|
|
| MD5 |
614185de06574275082e20cceb2fba35
|
|
| BLAKE2b-256 |
d813e2595edc1536e2fab1b0092329300dd3499295b9772832850e899ac71b22
|
File details
Details for the file yenpoint_1satordinals-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yenpoint_1satordinals-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c81081326a38de1a6280bb6489ee78d8612405f3657b2f786f374f4d4a7c909
|
|
| MD5 |
155210fa27f064a3e70fa44c2c954c04
|
|
| BLAKE2b-256 |
a20dbbeab0f3d500993e80c399ab0104dba1ed30c14b8ba44e8221c5eb088eff
|