Skip to content

Commit a0e90a8

Browse files
committed
fix: Rename to iroha2 and add build CI
Signed-off-by: Sam H. Smith <[email protected]>
1 parent 8cf76fb commit a0e90a8

20 files changed

+116
-68
lines changed

.github/workflows/main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Iroha 2 main branch workflow
2+
on:
3+
push:
4+
branches: [main]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [ 3.12 ]
11+
steps:
12+
- name: Set up Python ${{ matrix.python-version }}
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: ${{ matrix.python-version }}
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
- name: Install correct rust version
19+
run: rustup install nightly-2024-09-09 && rustup component add rust-src --toolchain nightly-2024-09-09
20+
- name: Set toolchain
21+
run: rustup default nightly-2024-09-09
22+
- name: Maturin build
23+
run: |
24+
maturin build
25+
mkdir dist
26+
cp target/wheels/* dist/
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: python-package-distributions
31+
path: dist/
32+
33+
publish-to-pypi:
34+
name: >-
35+
Publish Python 🐍 distribution 📦 to PyPI
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/project/iroha2/
42+
permissions:
43+
id-token: write # IMPORTANT: mandatory for trusted publishing
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
- name: Publish distribution 📦 to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[lib]
8-
name = "iroha"
8+
name = "iroha2"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]

docs-recipes/2.1.1.key-pair.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import iroha
1+
import iroha2
22

3-
key_pair1 = iroha.KeyPair.from_json("""
3+
key_pair1 = iroha2.KeyPair.from_json("""
44
{
55
"public_key": "ed01205113952DCE80063E467AFEE17D95363A558982A5AE250D221E29933CE73B79FE",
66
"private_key": "80262082E3965D74D8244C8D3CD4EE9C8C4D6C1959B051ECB48B07DE425329F94AD295"
77
}
88
""")
99

10-
key_pair2 = iroha.KeyPair.random()
10+
key_pair2 = iroha2.KeyPair.random()
1111

1212
print("kp1 =", key_pair1)
1313
print("kp2 =", key_pair2)
1414

15-
key_pair3 = iroha.KeyPair.from_hex_seed("001122")
15+
key_pair3 = iroha2.KeyPair.from_hex_seed("001122")
1616

17-
key_pair4 = iroha.KeyPair.from_private_key(key_pair2.private_key)
17+
key_pair4 = iroha2.KeyPair.from_private_key(key_pair2.private_key)
1818

1919
# kp2 and kp4 should have the same value
2020

@@ -24,7 +24,7 @@
2424

2525
# Different algorithms are supported
2626

27-
print("kp using Ed25519 =", iroha.KeyPair.random_with_algorithm("Ed25519"))
28-
print("kp using Secp256k1 =", iroha.KeyPair.random_with_algorithm("Secp256k1"))
29-
print("kp using BlsNormal =", iroha.KeyPair.random_with_algorithm("BlsNormal"))
30-
print("kp using BlsSmall =", iroha.KeyPair.random_with_algorithm("BlsSmall"))
27+
print("kp using Ed25519 =", iroha2.KeyPair.random_with_algorithm("Ed25519"))
28+
print("kp using Secp256k1 =", iroha2.KeyPair.random_with_algorithm("Secp256k1"))
29+
print("kp using BlsNormal =", iroha2.KeyPair.random_with_algorithm("BlsNormal"))
30+
print("kp using BlsSmall =", iroha2.KeyPair.random_with_algorithm("BlsSmall"))

docs-recipes/2.3.client.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
import iroha
1+
import iroha2
22

3-
key_pair = iroha.KeyPair.from_json("""
3+
key_pair = iroha2.KeyPair.from_json("""
44
{
5-
"public_key": "ed01207233BFC89DCBD68C19FDE6CE6158225298EC1131B6A130D1AEB454C1AB5183C0",
6-
"private_key": {
7-
"algorithm": "ed25519",
8-
"payload": "9ac47abf59b356e0bd7dcbbbb4dec080e302156a48ca907e47cb6aea1d32719e7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
9-
}
5+
"public_key": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03",
6+
"private_key": "802620CCF31D85E3B32A4BEA59987CE0C78E3B8E2DB93881468AB2435FE45D5C9DCD53"
107
}
118
""")
129

13-
account_id = "alice@wonderland"
10+
account_id = "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland"
1411
web_login = "mad_hatter"
1512
password = "ilovetea"
1613
api_url = "http://127.0.0.1:8080/"
1714
telemetry_url = "http://127.0.0.1:8180/"
1815
chain_id = "00000000-0000-0000-0000-000000000000"
1916

20-
client = iroha.Client.create(
17+
client = iroha2.Client.create(
2118
key_pair,
2219
account_id,
2320
web_login,

docs-recipes/3.register-domain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import iroha
1+
import iroha2
22

3-
key_pair = iroha.KeyPair.from_json("""
3+
key_pair = iroha2.KeyPair.from_json("""
44
{
55
"public_key": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03",
66
"private_key": "802620CCF31D85E3B32A4BEA59987CE0C78E3B8E2DB93881468AB2435FE45D5C9DCD53"
@@ -14,7 +14,7 @@
1414
telemetry_url = "http://127.0.0.1:8180/"
1515
chain_id = "00000000-0000-0000-0000-000000000000"
1616

17-
client = iroha.Client.create(
17+
client = iroha2.Client.create(
1818
key_pair,
1919
account_id,
2020
web_login,
@@ -31,7 +31,7 @@
3131
if "looking_glass" in domains:
3232
print("'looking_glass' domain already exists.")
3333

34-
register = iroha.Instruction.register_domain("looking_glass")
34+
register = iroha2.Instruction.register_domain("looking_glass")
3535

3636
client.submit_executable([register])
3737

docs-recipes/4.register-account.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import iroha
1+
import iroha2
22

3-
key_pair = iroha.KeyPair.from_json("""
3+
key_pair = iroha2.KeyPair.from_json("""
44
{
55
"public_key": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03",
66
"private_key": "802620CCF31D85E3B32A4BEA59987CE0C78E3B8E2DB93881468AB2435FE45D5C9DCD53"
@@ -14,15 +14,15 @@
1414
telemetry_url = "http://127.0.0.1:8180/"
1515
chain_id = "00000000-0000-0000-0000-000000000000"
1616

17-
client = iroha.Client.create(
17+
client = iroha2.Client.create(
1818
key_pair,
1919
account_id,
2020
web_login,
2121
password,
2222
api_url,
2323
chain_id)
2424

25-
# new_account_key_pair = iroha.KeyPair.random() TODO(Sam): easy account_id from public key and domain util function
25+
# new_account_key_pair = iroha2.KeyPair.random() TODO(Sam): easy account_id from public key and domain util function
2626
new_account_id = "ed01206EA0DD4252E4EAE48F60159CE2DBDAA5F324B34C09840CC0897FCD27DD47FED4@wonderland"
2727

2828
accounts = client.query_all_accounts_in_domain("wonderland")
@@ -34,7 +34,7 @@
3434
if new_account_id in accounts:
3535
print("'ed01206EA0DD4252E4EAE48F60159CE2DBDAA5F324B34C09840CC0897FCD27DD47FED4@wonderland' domain already exists.")
3636

37-
register = iroha.Instruction.register_account(new_account_id)
37+
register = iroha2.Instruction.register_account(new_account_id)
3838

3939
client.submit_executable([register])
4040

docs-recipes/5.register-and-mint.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import iroha
1+
import iroha2
22

3-
key_pair = iroha.KeyPair.from_json("""
3+
key_pair = iroha2.KeyPair.from_json("""
44
{
55
"public_key": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03",
66
"private_key": "802620CCF31D85E3B32A4BEA59987CE0C78E3B8E2DB93881468AB2435FE45D5C9DCD53"
@@ -14,7 +14,7 @@
1414
telemetry_url = "http://127.0.0.1:8180/"
1515
chain_id = "00000000-0000-0000-0000-000000000000"
1616

17-
client = iroha.Client.create(
17+
client = iroha2.Client.create(
1818
key_pair,
1919
account_id,
2020
web_login,
@@ -35,9 +35,9 @@
3535
if "time##ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" in assets:
3636
print("'ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland' already has asset 'time'.")
3737

38-
register_definition = iroha.Instruction.register_asset_definition(asset_definition_id, iroha.AssetType.numeric_fractional(0))
38+
register_definition = iroha2.Instruction.register_asset_definition(asset_definition_id, iroha2.AssetType.numeric_fractional(0))
3939

40-
mint = iroha.Instruction.mint_asset(5, asset_id)
40+
mint = iroha2.Instruction.mint_asset(5, asset_id)
4141

4242
client.submit_executable([register_definition, mint])
4343

examples/sign_email.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Import dependency
2-
import iroha
2+
import iroha2
33

44
# Example ed25519 key pair
5-
key_pair = iroha.KeyPair.from_json("""
5+
key_pair = iroha2.KeyPair.from_json("""
66
{
77
"public_key": "ed01207233BFC89DCBD68C19FDE6CE6158225298EC1131B6A130D1AEB454C1AB5183C0",
88
"private_key": {
@@ -13,7 +13,7 @@
1313
""")
1414

1515
# Hash the user's email address:
16-
hashed_email = iroha.hash(b"email@address")
16+
hashed_email = iroha2.hash(b"email@address")
1717

1818
# Sign the user's email address:
1919
signature = key_pair.sign(bytes(hashed_email))

examples/sign_tx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Import dependency
2-
import iroha
2+
import iroha2
33

44
# Example signed transaction, encoded with SCALE codec and represented as hex string:
55
encoded_transaction = "010400807233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c00101b65301ad504ea1430c171379ed45226bfc5fe770a216815654e20491626bbf857247bee73f6790314f892ed1a3e4c18cc6815ce9ff85ce956e0f9ab46605bc093962fb8f8e01000028776f6e6465726c616e6414616c6963650008000d09020c786f7228776f6e6465726c616e6401000000020d1402000000000000000002000000000000000d08030c786f7228776f6e6465726c616e6428776f6e6465726c616e6414616c69636501a0860100000000000000"
66

77
# Example ed25519 key pair
8-
key_pair = iroha.KeyPair.from_json("""
8+
key_pair = iroha2.KeyPair.from_json("""
99
{
1010
"public_key": "ed0120BA85186D0F8C995F8DEA6C95B3EDA321C88C983D4F6B28E079CC121B40AA8E00",
1111
"private_key": {
@@ -16,7 +16,7 @@
1616
""")
1717

1818
# Decode the transaction:
19-
transaction = iroha.SignedTransaction.decode_hex(encoded_transaction)
19+
transaction = iroha2.SignedTransaction.decode_hex(encoded_transaction)
2020

2121
# Sign the transaction with the provided private key:
2222
transaction.append_signature(key_pair)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["maturin>=1.3,<2.0"]
33
build-backend = "maturin"
44

55
[project]
6-
name = "iroha"
6+
name = "iroha2"
77
requires-python = ">=3.7"
88
classifiers = [
99
"Programming Language :: Rust",

0 commit comments

Comments
 (0)