11Personal API
22============
33
4- .. py :module :: web3.personal
4+ There are 2 objects that expose methods to interact with the RPC APIS
5+ under the ``personal_ `` namespace, each supporting the endpoints
6+ implemented in the respective clients.
57
6- .. py :class :: Personal
8+ - ``web3.geth.personal ``
9+ - ``web3.parity.personal ``
710
8- The ``web3.personal `` object exposes methods to interact with the RPC APIs
9- under the ``personal_ `` namespace.
1011
12+ .. py :module :: web3.geth.personal
1113
12- Properties
13- ----------
14+ Geth Methods
15+ ------------
1416
15- The following properties are available on the ``web3.personal `` namespace.
17+ The following methods are available on the ``web3.geth .personal `` namespace.
1618
17- .. py :attribute :: listAccounts
19+ .. py :method :: listAccounts
1820
1921 * Delegates to ``personal_listAccounts `` RPC Method
2022
2123 Returns the list of known accounts.
2224
2325 .. code-block :: python
2426
25- >> > web3.personal.listAccounts
27+ >> > web3.geth. personal.listAccounts()
2628 [' 0xd3cda913deb6f67967b99d67acdfa1712c293601' ]
2729
2830
29- Methods
30- -------
31-
32- The following methods are available on the ``web3.personal `` namespace.
33-
3431 .. py :method :: importRawKey(self , private_key, passphrase)
3532
3633 * Delegates to ``personal_importRawKey `` RPC Method
@@ -40,7 +37,7 @@ The following methods are available on the ``web3.personal`` namespace.
4037
4138 .. code-block :: python
4239
43- >> > web3.personal.importRawKey(some_private_key, ' the-passphrase' )
40+ >> > web3.geth. personal.importRawKey(some_private_key, ' the-passphrase' )
4441 ' 0xd3cda913deb6f67967b99d67acdfa1712c293601'
4542
4643
@@ -53,7 +50,7 @@ The following methods are available on the ``web3.personal`` namespace.
5350
5451 .. code-block :: python
5552
56- >> > web3.personal.newAccount(' the-passphrase' )
53+ >> > web3.geth. personal.newAccount(' the-passphrase' )
5754 ' 0xd3cda913deb6f67967b99d67acdfa1712c293601'
5855
5956
@@ -65,7 +62,7 @@ The following methods are available on the ``web3.personal`` namespace.
6562
6663 .. code-block :: python
6764
68- >> > web3.personal.lockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' )
65+ >> > web3.geth. personal.lockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' )
6966
7067
7168 .. py :method :: unlockAccount(self , account, passphrase, duration = None )
@@ -78,9 +75,77 @@ The following methods are available on the ``web3.personal`` namespace.
7875
7976 .. code-block :: python
8077
81- >> > web3.personal.unlockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' , ' wrong-passphrase' )
78+ >> > web3.geth. personal.unlockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' , ' wrong-passphrase' )
8279 False
83- >> > web3.personal.unlockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' , ' the-passphrase' )
80+ >> > web3.geth.personal.unlockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' , ' the-passphrase' )
81+ True
82+
83+ .. py :method :: sendTransaction(self , transaction, passphrase)
84+
85+ * Delegates to ``personal_sendTransaction `` RPC Method
86+
87+ Sends the transaction.
88+
89+
90+ .. py :module :: web3.parity.personal
91+
92+ Parity Methods
93+ --------------
94+
95+ The following methods are available on the ``web3.parity.personal `` namespace.
96+
97+ .. py :method :: listAccounts
98+
99+ * Delegates to ``personal_listAccounts `` RPC Method
100+
101+ Returns the list of known accounts.
102+
103+ .. code-block :: python
104+
105+ >> > web3.parity.personal.listAccounts()
106+ [' 0xd3cda913deb6f67967b99d67acdfa1712c293601' ]
107+
108+
109+ .. py :method :: importRawKey(self , private_key, passphrase)
110+
111+ * Delegates to ``personal_importRawKey `` RPC Method
112+
113+ Adds the given ``private_key `` to the node's keychain, encrypted with the
114+ given ``passphrase ``. Returns the address of the imported account.
115+
116+ .. code-block :: python
117+
118+ >> > web3.parity.personal.importRawKey(some_private_key, ' the-passphrase' )
119+ ' 0xd3cda913deb6f67967b99d67acdfa1712c293601'
120+
121+
122+ .. py :method :: newAccount(self , password)
123+
124+ * Delegates to ``personal_newAccount `` RPC Method
125+
126+ Generates a new account in the node's keychain encrypted with the
127+ given ``passphrase ``. Returns the address of the created account.
128+
129+ .. code-block :: python
130+
131+ >> > web3.parity.personal.newAccount(' the-passphrase' )
132+ ' 0xd3cda913deb6f67967b99d67acdfa1712c293601'
133+
134+
135+ .. py :method :: unlockAccount(self , account, passphrase, duration = None )
136+
137+ * Delegates to ``personal_unlockAccount `` RPC Method
138+
139+ Unlocks the given ``account `` for ``duration `` seconds. If ``duration `` is
140+ ``None `` then the account will remain unlocked indefinitely. Returns
141+ boolean as to whether the account was successfully unlocked.
142+
143+ .. code-block :: python
144+
145+ # Invalid call to personal_unlockAccount on Parity currently returns True, due to Parity bug
146+ >> > web3.parity.personal.unlockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' , ' wrong-passphrase' )
147+ True
148+ >> > web3.parity.personal.unlockAccount(' 0xd3cda913deb6f67967b99d67acdfa1712c293601' , ' the-passphrase' )
84149 True
85150
86151 .. py :method :: sendTransaction(self , transaction, passphrase)
0 commit comments