Skip to content

Commit 3ff308c

Browse files
committed
Add quickstart tutorial
1 parent 4992696 commit 3ff308c

File tree

4 files changed

+59
-10
lines changed

4 files changed

+59
-10
lines changed

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
python-version: [3.7, 3.8, 3.9, '3.10']
14+
python-version: [3.9]
1515
os: [ubuntu-latest]
1616
runs-on: ${{ matrix.os }}
1717
steps:

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
## PyCardano
22

3+
[![PyPi version](https://badgen.net/pypi/v/pycardano)](https://pypi.python.org/pypi/pycardano/)
4+
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pycardano)](https://pypi.python.org/pypi/pycardano/)
5+
[![PyPi license](https://badgen.net/pypi/license/pycardano)](https://pypi.python.org/pypi/pycardano/)
6+
37
[![PyCardano](https://github.com/cffls/pycardano/actions/workflows/main.yml/badge.svg)](https://github.com/cffls/pycardano/actions/workflows/main.yml)
48
[![codecov](https://codecov.io/gh/cffls/pycardano/branch/main/graph/badge.svg?token=62N0IL9IMQ)](https://codecov.io/gh/cffls/pycardano)
59
[![Documentation Status](https://readthedocs.org/projects/pycardano/badge/?version=latest)](https://pycardano.readthedocs.io/en/latest/?badge=latest)
610

7-
[![Linux](https://svgshare.com/i/Zhy.svg)](https://svgshare.com/i/Zhy.svg)
8-
[![macOS](https://svgshare.com/i/ZjP.svg)](https://svgshare.com/i/ZjP.svg)
9-
1011

1112
PyCardano is a Cardano library written in Python. It allows users to create and sign transactions without
1213
depending on third-party Cardano serialization tools, such as
@@ -23,9 +24,9 @@ could be beneficial for faster R&D iterations.
2324
- [PyCardano](#pycardano)
2425
- [Features](#features)
2526
- [Installation](#installation)
27+
- [Documentation](#documentation)
2628
- [Examples](#examples)
2729
- [Transaction creation and signing](#transaction-creation-and-signing)
28-
- [Documentations](#documentations)
2930
- [Development](#development)
3031
- [Workspace setup](#workspace-setup)
3132
- [Test](#test)
@@ -56,7 +57,13 @@ could be beneficial for faster R&D iterations.
5657

5758
### Installation
5859

59-
The library is still under development. The first release will be published to PyPI soon.
60+
Install the library using [pip](https://pip.pypa.io/en/stable/):
61+
62+
`pip install pycardano`
63+
64+
### Documentation
65+
66+
https://pycardano.readthedocs.io/en/latest/
6067

6168
### Examples
6269

@@ -151,10 +158,6 @@ context.submit_tx(signed_tx.to_cbor())
151158

152159
See more usages under [examples](https://github.com/cffls/pycardano/tree/main/examples).
153160

154-
### Documentations
155-
156-
https://pycardano.readthedocs.io/en/latest/
157-
158161

159162
-----------------
160163

docs/source/index.rst

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ PyCardano is a standalone Cardano client written in Python. The library is able
1010
without depending on third-party Cardano serialization tools, such as cardano-cli and cardano-serialization-lib,
1111
making it a light-weight library that is easy and fast to set up in all kinds of environments.
1212

13+
.. toctree::
14+
:maxdepth: 1
15+
:caption: Get Started
16+
17+
tutorial
18+
1319
.. toctree::
1420
:maxdepth: 1
1521
:caption: Usage Guides

docs/source/tutorial.rst

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
==========
2+
Quickstart
3+
==========
4+
5+
------------
6+
Installation
7+
------------
8+
9+
PyCardano could be installed using ``pip`` as follows:
10+
11+
.. code-block:: shell
12+
13+
$ pip install pycardano
14+
15+
16+
---------------
17+
Using PyCardano
18+
---------------
19+
20+
Create a payment key and a payment address::
21+
22+
>>> from pycardano import Address, Network, PaymentSigningKey, PaymentVerificationKey
23+
24+
>>> payment_signing_key = PaymentSigningKey.generate()
25+
>>> payment_signing_key.save("payment.skey")
26+
>>> payment_verification_key = PaymentVerificationKey.from_signing_key(payment_signing_key)
27+
>>> payment_verification_key.save("payment.vkey")
28+
29+
>>> network = Network.TESTNET
30+
>>> address = Address(payment_part=payment_verification_key.hash(), network=network)
31+
>>> address
32+
'addr_test1vr2p8st5t5cxqglyjky7vk98k7jtfhdpvhl4e97cezuhn0cqcexl7'
33+
34+
35+
Fund the address with some tADA (test ADA) through the
36+
`faucet <https://testnets.cardano.org/en/testnets/cardano/tools/faucet/>`_ here.
37+
38+
With the address and key created above, you can now create and sign transactions, and submit the
39+
transaction to Cardano network. `Transaction usage guide <guides/transaction.html>`_ provides detailed steps about
40+
transaction creation and signing.

0 commit comments

Comments
 (0)