Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f2b516a
feat: add solana key type
felipeserrano05 Jan 11, 2025
60eae0f
feat: aadd solana key type in set private key
felipeserrano05 Jan 11, 2025
ea54344
feat: sign and verify for solana key type
felipeserrano05 Jan 11, 2025
7d3be72
feat: solana sign fn
felipeserrano05 Jan 11, 2025
6f89d56
fix: change pubkey to bytes type
felipeserrano05 Jan 12, 2025
9b11ced
fix: verify signature
felipeserrano05 Jan 13, 2025
b505e2f
test: add solana key type
felipeserrano05 Jan 13, 2025
f9aeea3
ref: define constant
felipeserrano05 Jan 15, 2025
525ef82
ref: add base key class
felipeserrano05 Jan 15, 2025
f52fac2
ref: add sr25519 key for polkadot
felipeserrano05 Jan 15, 2025
7455a77
ref: add ed25519 key for polkadot
felipeserrano05 Jan 15, 2025
48f78b6
ref: add ecdsa key for ethereum
felipeserrano05 Jan 15, 2025
36112f4
ref: add solana key
felipeserrano05 Jan 15, 2025
e691cc5
ref: add utils
felipeserrano05 Jan 15, 2025
88186f2
chore: define init file
felipeserrano05 Jan 15, 2025
a207f9b
chore: change key import
felipeserrano05 Jan 15, 2025
8411412
chore: change key import
felipeserrano05 Jan 15, 2025
2abd4ca
ref: test all key types
felipeserrano05 Jan 15, 2025
93af431
ref: remove origin key file
felipeserrano05 Jan 15, 2025
850d1b6
ref: commune key module
felipeserrano05 Jan 16, 2025
52e4c88
ref: reconstruct network module
felipeserrano05 Jan 16, 2025
91b7711
ref: ref: reconstruct server module
felipeserrano05 Jan 16, 2025
ddbeb77
ref: reonstruct subspace module
felipeserrano05 Jan 16, 2025
165229a
ref: reconstruct validator module
felipeserrano05 Jan 16, 2025
f764527
chore: use modular approach with folder
felipeserrano05 Jan 16, 2025
2f4fdf8
test: use decentralized tests
felipeserrano05 Jan 16, 2025
7badd7a
Merge branch 'main' into feat/solana-key
felipeserrano05 Jan 17, 2025
590a0c9
fix: some errors occured by conflict
felipeserrano05 Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions commune/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
from .module import Module # the module module

M = c = Block = Agent = Module # alias c.Module as c.Block, c.Lego, c.M
from .vali.vali import Vali # the vali module
from .server.server import Server # the server module
from .server.client import Client # the client module
from .key.key import Key # the key module


from .module import Module # the module module
M = c = Block = Agent = Module # alias c.Module as c.Block, c.Lego, c.M
from .vali import Vali # the vali module
from .server import Server, Client # the server module
from .key import Key # the key module
# set the module functions as globalsw
c.add_to_globals(globals())
network = c.network

v = Vali
s = Server
k = Key
# set the module functions as globals
key = c.get_key # override key function with file key in commune/key.py TODO: remove this line with a better solution
key = (
c.get_key
) # override key function with file key in commune/key.py TODO: remove this line with a better solution

32 changes: 32 additions & 0 deletions commune/key/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from ecdsa.curves import SECP256k1

SS58_FORMAT = 42

ERROR_INVALID_KEY = "Invalid key provided."
ERROR_KEY_GENERATION_FAILED = "Key generation failed."
ERROR_KEY_VALIDATION_FAILED = "Key validation failed."

DEV_PHRASE = 'bottom drive obey lake curtain smoke basket hold race lonely fit walk'

JUNCTION_ID_LEN = 32
RE_JUNCTION = r'(\/\/?)([^/]+)'

NONCE_LENGTH = 24
SCRYPT_LENGTH = 32 + (3 * 4)
PKCS8_DIVIDER = bytes([161, 35, 3, 33, 0])
PKCS8_HEADER = bytes([48, 83, 2, 1, 1, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32])
PUB_LENGTH = 32
SALT_LENGTH = 32
SEC_LENGTH = 64
SEED_LENGTH = 32

SCRYPT_N = 1 << 15
SCRYPT_P = 1
SCRYPT_R = 8

BIP39_PBKDF2_ROUNDS = 2048
BIP39_SALT_MODIFIER = "mnemonic"
BIP32_PRIVDEV = 0x80000000
BIP32_CURVE = SECP256k1
BIP32_SEED_MODIFIER = b"Bitcoin seed"
ETH_DERIVATION_PATH = "m/44'/60'/0'/0"
Loading