Parity API

The web3.parity object exposes modules that enable you to interact with the JSON-RPC endpoints supported by Parity that are not defined in the standard set of Ethereum JSONRPC endpoints according to EIP 1474.


The following methods are available on the web3.parity.personal namespace.

  • Delegates to personal_listAccounts RPC Method

Returns the list of known accounts.

>>> web3.parity.personal.list_accounts()


Deprecated: This method is deprecated in favor of list_accounts()

web3.parity.personal.import_raw_key(self, private_key, passphrase)
  • Delegates to personal_importRawKey RPC Method

Adds the given private_key to the node’s keychain, encrypted with the given passphrase. Returns the address of the imported account.

>>> web3.parity.personal.import_raw_key(some_private_key, 'the-passphrase')
web3.parity.personal.importRawKey(self, private_key, passphrase)


Deprecated: This method is deprecated in favor of import_raw_key()

web3.parity.personal.new_account(self, password)
  • Delegates to personal_newAccount RPC Method

Generates a new account in the node’s keychain encrypted with the given passphrase. Returns the address of the created account.

>>> web3.parity.personal.new_account('the-passphrase')
web3.parity.personal.newAccount(self, password)


Deprecated: This method is deprecated in favor of new_account()

web3.parity.personal.unlock_account(self, account, passphrase, duration=None)
  • Delegates to personal_unlockAccount RPC Method

Unlocks the given account for duration seconds. If duration is None then the account will remain unlocked indefinitely. Returns boolean as to whether the account was successfully unlocked.

# Invalid call to personal_unlockAccount on Parity currently returns True, due to Parity bug
>>> web3.parity.personal.unlock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'wrong-passphrase')
>>> web3.parity.personal.unlock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'the-passphrase')
web3.parity.personal.unlockAccount(self, account, passphrase, duration=None)


Deprecated: This method is deprecated in favor of unlock_account()

web3.parity.personal.send_transaction(self, transaction, passphrase)
  • Delegates to personal_sendTransaction RPC Method

Sends the transaction.

web3.parity.personal.sendTransaction(self, account, passphrase, duration=None)


Deprecated: This method is deprecated in favor of send_transaction()

web3.parity.personal.sign_typed_data(self, jsonMessage, account, passphrase)
  • Delegates to personal_signTypedData RPC Method

Please note that the jsonMessage argument is the loaded JSON Object and NOT the JSON String itself.

Signs the Structured Data (or Typed Data) with the passphrase of the given account

web3.parity.personal.signTypedData(self, jsonMessage, account, passphrase)


Deprecated: This method is deprecated in favor of sign_typed_data()


The web3.parity.shh object exposes methods to interact with the RPC APIs under the shh_` namespace.

Full documentation for Parity-supported endpoints can be found here.


The Whisper protocol is in flux, with incompatible versions supported by different major clients.

Returns the Whisper statistics for diagnostics.

{'memory': 240, 'messages': 0, 'targetMemory': 102485760}, message)
  • Creates a whisper message and injects it into the network for distribution.

  • Parameters:
    • to: The receiver of the message. Can be omitted for a broadcast message. Use one of the following two fields.
      • public: The public key of the recipient.

      • identity: The identity of the recipient key on your local node.

    • from: Asymmetric identity to sign the message with, or null.

    • topics: Array of topics for the message. Should be non-empty.

    • payload: Payload to be encrypted.

    • padding: Optional padding. Up to 2^24 -1 bytes.

    • priority: How many milliseconds to spend doing POW.

    • ttl: Time-to-live (in seconds) of the message before expiry.

  • Returns True if the message was succesfully sent, otherwise False

Shh.newMessageFilter(self, criteria)
  • Return the filter ID that can be used with ShhFilter to poll for new messages that match the set of criteria.

  • Parameters:
    • decryptWith: 32 bytes - Identity of key used for description. Null if listening for broadcasts.

    • from: 64 bytes - If present, only accept messages signed by this key.

    • topics: Array of possible topics (or partial topics). Should be non-empty.

  • Returns the newly created filter id.

>>> web3.parity.shh.newMessageFilter({'topic': '0x12340000', 'privateKeyID': recipient_private})
Shh.deleteMessageFilter(self, filter_id)
  • Deletes a message filter in the node.

  • Returns True if the filter was sucesfully uninstalled, otherwise False

>>> web3.parity.shh.deleteMessageFilter('0xea7120c5408c72cfd7e0e1d2ff62df8e208d9a1f85d2ed54a4a3e1ad6daeb6f9')
Shh.getMessages(self, filter_id)
  • Retrieve messages that match the filter criteria and are received between the last time this function was called and now.

  • Returns all new messages since the last invocation

>>> web3.parity.shh.getMessages('0xea7120c5408c72cfd7e0e1d2ff62df8e208d9a1f85d2ed54a4a3e1ad6daeb6f9')
    'ttl': 50,
    'timestamp': 1524497850,
    'topics': HexBytes('0x13370000'),
    'payload': HexBytes('0x74657374206d657373616765203a29'),
    'padding': HexBytes('0x50ab643f1b23bc6df1b1532bb6704ad947c2453366754aade3e3597553eeb96119f4f4299834d9989dc4ecc67e6b6470317bb3f7396ace0417fc0d6d2023900d3'),
    'recipient': HexBytes('0x047d36c9e45fa82fcd27d35bc7d2fd41a2e41e512feec9e4b90ee4293ab12dcac'),
Shh.subscribe(self, filter_id)
  • Open a subscription to a filter. Subscription calls are only supported on the websocket transport.

  • Returns True if the filter was sucesfully subscribed to, otherwise False

>>> web3.parity.shh.subscribe('0xea7120c5408c72cfd7e0e1d2ff62df8e208d9a1f85d2ed54a4a3e1ad6daeb6f9')
Shh.unsubscribe(self, filter_id)
  • Close a subscribed filter.

  • Returns True if the filter subscription was sucesfully closed, otherwise False

>>> web3.parity.shh.unsubscribe('0xea7120c5408c72cfd7e0e1d2ff62df8e208d9a1f85d2ed54a4a3e1ad6daeb6f9')

Asymmetric Keys

  • Generates a new cryptographic identity for the client, and injects it into the known identities for message decryption

  • Returns the new key pair’s identity

>>> web3.parity.shh.newKeyPair()
Shh.addPrivateKey(self, key)
  • Stores a key pair derived from a private key, and returns its ID.

  • Returns the added key pair’s ID

>>> web3.parity.shh.addPrivateKey('0x7b8190d96cd061a102e551ee36d08d4f3ca1f56fb0008ef5d70c56271d8c46d0')
Shh.getPublicKey(self, id)
  • Returns the public key associated with the key pair.

>>> web3.parity.shh.getPublicKey('86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb')
Shh.getPrivateKey(self, id)
  • Returns the private key associated with the key pair.

>>> web3.parity.shh.getPrivateKey('86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb')

Symmetric Keys

  • Generates a random symmetric key and stores it under id, which is then returned. Will be used in the future for session key exchange

  • Returns the new key pair’s identity

>>> web3.parity.shh.newSymKey()
Shh.addSymKey(self, key)
  • Stores the key, and returns its ID.

  • Returns the new key pair’s identity

>>> web3.parity.shh.addSymKey('0x58f6556e56a0d41b464a083161377c8a9c2e95156921f954f99ef97d41cebaa2')
Shh.getSymKey(self, id)
  • Returns the symmetric key associated with the given ID.

  • Returns the public key associated with the key pair

>>> web3.parity.shh.getSymKey('6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c')
Shh.deleteKey(self, id)
  • Deletes the symmetric key associated with the given ID.

  • Returns True if the key pair was deleted, otherwise False

>>> web3.parity.shh.deleteKey('6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c')