examples package

Submodules

examples.create_mnemonic_wallet module

examples.create_mnemonic_wallet.create_mnemonic_wallet()

examples.create_public_key module

examples.create_public_key.create_public_key()

examples.listen_ws2p module

examples.listen_ws2p.listen_ws2p()

Main code

examples.load_binary_encrypted_message module

examples.load_binary_encrypted_message.load_binary_encrypted_message(signed_message_path=None)

examples.load_binary_signed_message module

examples.load_binary_signed_message.load_binary_signed_message(signed_message_path=None)

examples.load_cleartext_ascii_armor_message module

examples.load_cleartext_ascii_armor_message.load_cleartext_ascii_armor_message()

examples.load_credentials_file module

examples.load_credentials_file.load_credentials_file(signing_key_instance=None)

examples.load_encrypted_ascii_armor_message module

examples.load_encrypted_ascii_armor_message.load_encrypted_ascii_armor_message()

examples.load_local_blockchain module

examples.load_local_blockchain.load_local_blockchain()

this example lets you load a local copy of duniter blockchain into duniterpy objects by default, it looks in: $HOME/.config/duniter/duniter_default/g1/

examples.load_scuttlebutt_file module

examples.load_scuttlebutt_file.load_scuttlebutt_file(signing_key_insance=None)

examples.request_available_nodes module

examples.request_available_nodes.request_available_nodes()

examples.request_data module

examples.request_data.request_data()

Main code (synchronous requests)

examples.request_data_async module

async examples.request_data_async.coroutine(function, *args, **kwargs)
async examples.request_data_async.print_response(request)
async examples.request_data_async.request_data_async()

Main code (asynchronous requests) You can send one millions request with aiohttp: https://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.html But don’t do that on one server, it’s DDOS!

examples.request_data_elasticsearch module

examples.request_data_elasticsearch.request_data_elasticsearch()

Main code (synchronous requests)

examples.request_data_graphql module

examples.request_data_graphql.request_data_graphql()

examples.request_web_socket_block module

examples.request_web_socket_block.request_web_socket_block()

Main code

examples.request_ws2p module

examples.request_ws2p.request_ws2p()

Main code

examples.request_ws2p.send(ws: WSConnection, request: str, request_id: str, schema: dict) Any

Send a WS2P request

Return type:

Any

Parameters:
  • ws – WSConnection instance

  • request – Request string to send

  • request_id – Unique request id

  • schema – Validation schema

examples.save_and_load_private_key_file module

examples.save_and_load_private_key_file.save_and_load_private_key_file()

examples.save_and_load_private_key_file_ewif module

examples.save_and_load_private_key_file_ewif.save_and_load_private_key_file_ewif()

examples.save_and_load_private_key_file_pubsec module

examples.save_and_load_private_key_file_pubsec.save_and_load_private_key_file_pubsec()

examples.save_and_load_private_key_file_wif module

examples.save_and_load_private_key_file_wif.save_and_load_private_key_file_wif()

examples.save_binary_encrypted_message module

examples.save_binary_encrypted_message.save_binary_encrypted_message()

examples.save_binary_signed_message module

examples.save_binary_signed_message.save_binary_signed_message()

examples.save_cleartext_ascii_armor_message module

examples.save_cleartext_ascii_armor_message.save_cleartext_ascii_armor_message()

examples.save_encrypted_ascii_armor_message module

examples.save_encrypted_ascii_armor_message.save_encrypted_ascii_armor_message()

examples.save_revoke_document module

examples.save_revoke_document.get_identity_document(client: Client, current_block: dict, pubkey: str) Identity | None

Get the identity document of the pubkey

Parameters:
  • client – Client to connect to the api

  • current_block – Current block data

  • pubkey – UID/Public key

Return type:

Identity

examples.save_revoke_document.get_signed_raw_revocation_document(identity: Identity, salt: str, password: str) str

Generate account revocation document for given identity

Parameters:
  • identity – Self Certification of the identity

  • salt – Salt

  • password – Password

Return type:

str

examples.save_revoke_document.save_revoke_document()

Main code

examples.send_certification module

examples.send_certification.get_certification_document(current_block: dict, identity: Identity, signing_key: SigningKey) Certification

Create and return a Certification document

Parameters:
  • current_block – Current block data

  • identity – Identity document instance

  • signing_key – Signing key of the certifier

Return type:

Certification

examples.send_certification.get_identity_document(client: Client, current_block: dict, pubkey: str) Identity | None

Get the identity document of the pubkey

Parameters:
  • client – Client to connect to the api

  • current_block – Current block data

  • pubkey – UID/Public key

Return type:

Identity

examples.send_certification.send_certification()

Main code

examples.send_identity module

examples.send_identity.get_identity_document(current_block: dict, uid: str, key: SigningKey) Identity

Get an Identity document

Parameters:
  • current_block – Current block data

  • uid – Unique IDentifier

  • key – cryptographic key to sign documents

Return type:

Identity

examples.send_identity.send_identity()

Main code

examples.send_membership module

examples.send_membership.get_membership_document(current_block: dict, identity: dict, key: SigningKey, membership_type: str = 'IN') Membership

Get a Membership document

Parameters:
  • current_block – Current block data

  • identity – identity card from /wot/lookup

  • key – cryptographic key to sign documents

  • membership_type – “IN” to ask for membership or “OUT” to cancel membership. Default “IN”

Return type:

Membership

examples.send_membership.send_membership()

Main code

examples.send_transaction module

examples.send_transaction.get_transaction_document(current_block: dict, source: dict, from_pubkey: str, to_pubkey: str, signing_keys: SigningKey | List[SigningKey]) Transaction

Return a Transaction document

Parameters:
  • current_block – Current block infos

  • source – Source to send

  • from_pubkey – Public key of the issuer

  • to_pubkey – Public key of the receiver

  • signing_key – Signing key of the issuer

Returns:

Transaction

examples.send_transaction.send_transaction()

Main code

Module contents