nanopy¶
- class nanopy.Account(network=Network(name='nano', prefix='nano_', difficulty='ffffffc000000000', send_difficulty='fffffff800000000', receive_difficulty='fffffe0000000000', exp=30, rpc_url='http://localhost:7076', std_unit='Ӿ'), addr='')¶
- Parameters:
network (
Network
) – network of this account
- change_rep(rep, work='')¶
Construct a signed change StateBlock with work
- Parameters:
- Return type:
- Returns:
a signed change StateBlock
- receive(digest, raw_amt, rep=None, work='')¶
Construct a signed receive StateBlock with work
- send(to, raw_amt, rep=None, work='')¶
Construct a signed send StateBlock with work
- class nanopy.Network(name='nano', prefix='nano_', difficulty='ffffffc000000000', send_difficulty='fffffff800000000', receive_difficulty='fffffe0000000000', exp=30, rpc_url='http://localhost:7076', std_unit='Ӿ')¶
- Parameters:
name (
str
) – name of the networkprefix (
str
) – prefix for accounts in the networkdifficulty (
str
) – base difficultysend_difficulty (
str
) – difficulty for send/change blocksreceive_difficulty (
str
) – difficulty for receive/open blocksexp (
int
) – exponent to convert between raw and base currency unitrpc_url (
str
) – default RPC url for the networkstd_unit (
str
) – symbol or label for the default currency unit
- from_multiplier(multiplier)¶
Get difficulty from multiplier
- from_pk(pk)¶
Get account address from public key
- from_raw(raw, exp=0)¶
Divide raw by 10^exp
- to_multiplier(difficulty)¶
Get multiplier from difficulty
- to_pk(addr)¶
Get public key from account address
- class nanopy.StateBlock(acc, rep, bal, prev, link, sig='', work='')¶
State block
- Parameters:
- verify_signature()¶
Verify signature for block
- Return type:
- Returns:
True if valid, False otherwise
- work_generate(difficulty)¶
Compute work
- nanopy.deterministic_key(seed, i=0)¶
Derive deterministic private key from seed based on index i
- nanopy.generate_mnemonic(strength=256, language='english')¶
Generate a BIP39 type mnemonic. Requires mnemonic