@@ -529,364 +529,3 @@ The following methods are available on the ``web3.geth.txpool`` namespace.
529
529
}
530
530
}
531
531
}
532
-
533
- GethShh
534
- ~~~~~~~
535
-
536
- The ``web3.geth.shh `` object exposes methods to interact with the RPC APIs under the
537
- ``shh_ `` namespace.
538
-
539
- Full documentation for Geth-supported endpoints can be found `here <https://github.com/ethereum/go-ethereum/wiki/Whisper-v6-RPC-API >`_.
540
-
541
- .. warning :: The Whisper protocol is in flux, with incompatible versions supported
542
- by different major clients.
543
-
544
- .. py :method :: Shh.version()
545
-
546
- Returns the Whisper version this node offers.
547
-
548
- .. code-block :: python
549
-
550
- >> > web3.geth.shh.version()
551
- 6.0
552
-
553
- .. py :method :: Shh.info()
554
-
555
- Returns the Whisper statistics for diagnostics.
556
-
557
- .. code-block :: python
558
-
559
- >> > web3.geth.shh.info()
560
- {' maxMessageSize' : 1024 , ' memory' : 240 , ' messages' : 0 , ' minPow' : 0.2 }
561
-
562
- .. py :method :: Shh.post(self , message)
563
-
564
- * Creates a whisper message and injects it into the network for distribution.
565
-
566
- * Parameters:
567
- * ``symKeyID ``: When using symmetric key encryption, holds the symmetric key ID.
568
- * ``pubKey ``: When using asymmetric key encryption, holds the public key.
569
- * ``ttl ``: Time-to-live in seconds.
570
- * ``sig (optional) ``: ID of the signing key.
571
- * ``topic ``: Message topic (four bytes of arbitrary data).
572
- * ``payload ``: Payload to be encrypted.
573
- * ``padding (optional) ``: Padding (byte array of arbitrary length).
574
- * ``powTime ``: Maximal time in seconds to be spent on prrof of work.
575
- * ``powTarget ``: Minimal PoW target required for this message.
576
- * ``targetPeer (optional) ``: Peer ID (for peer-to-peer message only).
577
-
578
- * Returns ``True `` if the message was succesfully sent, otherwise ``False ``
579
-
580
- .. code-block :: python
581
-
582
- >> > web3.geth.shh.post({' payload' : web3.toHex(text = " test_payload" ), ' pubKey' : recipient_public, ' topic' : ' 0x12340000' , ' powTarget' : 2.5 , ' powTime' : 2 })
583
- True
584
-
585
- .. py :method :: Shh.newMessageFilter()
586
-
587
- .. warning :: Deprecated: This method is deprecated in favor of
588
- :meth: `~web3.geth.shh.new_message_filter() `
589
-
590
- .. py :method :: Shh.new_message_filter(self , criteria)
591
-
592
- * Create a new filter id. This filter id can be used with ``ShhFilter `` to poll for new messages that match the set of criteria.
593
-
594
- * Parameters:
595
- * ``symKeyID ``: When using symmetric key encryption, holds the symmetric key ID.
596
- * ``privateKeyID ``: When using asymmetric key encryption, holds the private key ID.
597
- * ``sig ``: Public key of the signature.
598
- * ``minPoW ``: Minimal PoW requirement for incoming messages.
599
- * ``topic ``: Array of possible topics (or partial topics).
600
- * ``allowP2P ``: Indicates if this filter allows processing of direct peer-to-peer messages.
601
-
602
-
603
- .. code-block :: python
604
-
605
- >> > web3.geth.shh.new_message_filter({' topic' : ' 0x12340000' , ' privateKeyID' : recipient_private})
606
- ' b37c3106cfb683e8f01b5019342399e0d1d74e9160f69b27625faba7a6738554'
607
-
608
- .. py :method :: Shh.deleteMessageFilter()
609
-
610
- .. warning :: Deprecated: This method is deprecated in favor of
611
- :meth: `~web3.geth.shh.delete_message_filter() `
612
-
613
-
614
- .. py :method :: Shh.delete_message_filter(self , filter_id)
615
-
616
- * Deletes a message filter in the node.
617
-
618
- * Returns ``True `` if the filter was sucesfully uninstalled, otherwise ``False ``
619
-
620
- .. code-block :: python
621
-
622
- >> > web3.geth.shh.delete_message_filter(' b37c3106cfb683e8f01b5019342399e0d1d74e9160f69b27625faba7a6738554' )
623
- True
624
-
625
- .. py :method :: Shh.getMessages()
626
-
627
- .. warning :: Deprecated: This method is deprecated in favor of
628
- :meth: `~web3.geth.shh.get_filter_messages() `
629
-
630
- .. py :method :: Shh.get_filter_messages(self , filter_id)
631
-
632
- * Retrieve messages that match the filter criteria and are received between the last time this function was called and now.
633
-
634
- * Returns all new messages since the last invocation
635
-
636
- .. code-block :: python
637
-
638
- >> > web3.geth.shh.get_filter_messages(' b37c3106cfb683e8f01b5019342399e0d1d74e9160f69b27625faba7a6738554' )
639
- [{
640
- ' ttl' : 50 ,
641
- ' timestamp' : 1524497850 ,
642
- ' topic' : HexBytes(' 0x13370000' ),
643
- ' payload' : HexBytes(' 0x74657374206d657373616765203a29' ),
644
- ' padding' : HexBytes(' 0x50ab643f1b23bc6df1b1532bb6704ad947c2453366754aade3e3597553eeb96119f4f4299834d9989dc4ecc67e6b6470317bb3f7396ace0417fc0d6d2023900d3' ),
645
- ' pow' : 6.73892030848329 ,
646
- ' hash' : HexBytes(' 0x7418f8f0989655ed2f4f9b496e6b1d9be51ef9f0f5ad89f6f750b0eee268b02f' ),
647
- ' recipientPublicKey' : HexBytes(' 0x047d36c9e45fa82fcd27d35bc7d2fd41a2e41e512feec9e4b90ee4293ab12dc2cfc98250a6f5689b07650f8a5ca3a6e0fa8808cd0ce1a1962f2551354487a8fc79' )
648
- }]
649
-
650
- .. py :method :: Shh.setMaxMessageSize()
651
-
652
- .. warning :: Deprecated: This method is deprecated in favor of
653
- :meth: `~web3.geth.shh.set_max_message_size() `
654
-
655
- .. py :method :: Shh.set_max_message_size(self , size)
656
-
657
- * Sets the maximal message size allowed by this node. Incoming and outgoing messages with a larger size will be rejected. Whisper message size can never exceed the limit imposed by the underlying P2P protocol (10 Mb).
658
-
659
- * Returns ``True `` if the filter was sucesfully uninstalled, otherwise ``False ``
660
-
661
- .. code-block :: python
662
-
663
- >> > web3.geth.shh.set_max_message_size(1024 )
664
- True
665
-
666
- .. py :method :: Shh.setMinPoW()
667
-
668
- .. warning :: Deprecated: This method is deprecated in favor of
669
- :meth: `~web3.geth.shh.set_min_pow() `
670
-
671
- .. py :method :: Shh.set_min_pow(self , min_pow)
672
-
673
- * Sets the minimal PoW required by this node.
674
-
675
- * Returns ``True `` if the filter was sucesfully uninstalled, otherwise ``False ``
676
-
677
- .. code-block :: python
678
-
679
- >> > web3.geth.shh.set_min_pow(0.4 )
680
- True
681
-
682
- .. py :method :: Shh.markTrustedPeer()
683
-
684
- .. warning :: Deprecated: This method is deprecated in favor of
685
- :meth: `~web3.geth.shh.mark_trusted_peer() `
686
-
687
- .. py :method :: Shh.mark_trusted_peer(self , enode)
688
-
689
- * Marks specific peer trusted, which will allow it to send historic (expired) messages.
690
-
691
- * Returns ``True `` if the filter was sucesfully uninstalled, otherwise ``False ``
692
-
693
- .. code-block :: python
694
-
695
- >> > web3.geth.shh.mark_trusted_peer(' enode://d25474361659861e9e651bc728a17e807a3359ca0d344afd544ed0f11a31faecaf4d74b55db53c6670fd624f08d5c79adfc8da5dd4a11b9213db49a3b750845e@52.178.209.125:30379' )
696
- True
697
-
698
- ---------------
699
- Asymmetric Keys
700
- ---------------
701
-
702
- .. py :method :: Shh.newKeyPair()
703
-
704
- .. warning :: Deprecated: This method is deprecated in favor of
705
- :meth: `~web3.geth.shh.new_key_pair() `
706
-
707
- .. py :method :: Shh.new_key_pair(self )
708
-
709
- * Generates a new cryptographic identity for the client, and injects it into the known identities for message decryption
710
-
711
- * Returns the new key pair's identity
712
-
713
- .. code-block :: python
714
-
715
- >> > web3.geth.shh.new_key_pair()
716
- ' 86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb'
717
-
718
- .. py :method :: Shh.addPrivateKey()
719
-
720
- .. warning :: Deprecated: This method is deprecated in favor of
721
- :meth: `~web3.geth.shh.add_private_key() `
722
-
723
- .. py :method :: Shh.add_private_key(self , key)
724
-
725
- * Stores a key pair derived from a private key, and returns its ID.
726
-
727
- * Returns the added key pair's ID
728
-
729
- .. code-block :: python
730
-
731
- >> > web3.geth.shh.add_private_key(' 0x7b8190d96cd061a102e551ee36d08d4f3ca1f56fb0008ef5d70c56271d8c46d0' )
732
- ' 86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb'
733
-
734
- .. py :method :: Shh.deleteKeyPair()
735
-
736
- .. warning :: Deprecated: This method is deprecated in favor of
737
- :meth: `~web3.geth.shh.delete_key_pair() `
738
-
739
- .. py :method :: Shh.delete_key_pair(self , id )
740
-
741
- * Deletes the specified key if it exists.
742
-
743
- * Returns ``True `` if the key pair was deleted, otherwise ``False ``
744
-
745
- .. code-block :: python
746
-
747
- >> > web3.geth.shh.delete_key_pair(' 86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb' )
748
- True
749
-
750
- .. py :method :: Shh.hasKeyPair()
751
-
752
- .. warning :: Deprecated: This method is deprecated in favor of
753
- :meth: `~web3.geth.shh.has_key_pair() `
754
-
755
- .. py :method :: Shh.has_key_pair(self , id )
756
-
757
- * Checks if the whisper node has a private key of a key pair matching the given ID.
758
-
759
- * Returns ``True `` if the key pair exists, otherwise ``False ``
760
-
761
- .. code-block :: python
762
-
763
- >> > web3.geth.shh.has_key_pair(' 86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb' )
764
- False
765
-
766
- .. py :method :: Shh.getPublicKey()
767
-
768
- .. warning :: Deprecated: This method is deprecated in favor of
769
- :meth: `~web3.geth.shh.get_public_key() `
770
-
771
- .. py :method :: Shh.get_public_key(self , id )
772
-
773
- * Returns the public key associated with the key pair.
774
-
775
- .. code-block :: python
776
-
777
- >> > web3.geth.shh.get_public_key(' 86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb' )
778
- ' 0x041b0777ceb8cf8748fe0bba5e55039d650a03eb0239a909f9ee345bbbad249f2aa236a4b8f41f51bd0a97d87c08e69e67c51f154d634ba51a224195212fc31e4e'
779
-
780
- .. py :method :: Shh.getPrivateKey()
781
-
782
- .. warning :: Deprecated: This method is deprecated in favor of
783
- :meth: `~web3.geth.shh.get_private_key() `
784
-
785
- .. py :method :: Shh.get_private_key(self , id )
786
-
787
- * Returns the private key associated with the key pair.
788
-
789
- .. code-block :: python
790
-
791
- >> > web3.geth.shh.get_private_key(' 86e658cbc6da63120b79b5eec0c67d5dcfb6865a8f983eff08932477282b77bb' )
792
- ' 0x7b8190d96cd061a102e551ee36d08d4f3ca1f56fb0008ef5d70c56271d8c46d0'
793
-
794
- ---------------
795
- Symmetric Keys
796
- ---------------
797
-
798
- .. py :method :: Shh.newSymKey()
799
-
800
- .. warning :: Deprecated: This method is deprecated in favor of
801
- :meth: `~web3.geth.shh.new_sym_key() `
802
-
803
- .. py :method :: Shh.new_sym_key(self )
804
-
805
- * Generates a random symmetric key and stores it under id, which is then returned. Will be used in the future for session key exchange
806
-
807
- * Returns the new key pair's identity
808
-
809
- .. code-block :: python
810
-
811
- >> > web3.geth.shh.new_sym_key()
812
- ' 6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c'
813
-
814
- .. py :method :: Shh.addSymKey()
815
-
816
- .. warning :: Deprecated: This method is deprecated in favor of
817
- :meth: `~web3.geth.shh.add_sym_key() `
818
-
819
- .. py :method :: Shh.add_sym_key(self , key)
820
-
821
- * Stores the key, and returns its ID.
822
-
823
- * Returns the new key pair's identity
824
-
825
- .. code-block :: python
826
-
827
- >> > web3.geth.shh.add_sym_key(' 0x58f6556e56a0d41b464a083161377c8a9c2e95156921f954f99ef97d41cebaa2' )
828
- ' 6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c'
829
-
830
- .. py :method :: Shh.generateSymKeyFromPassword()
831
-
832
- .. warning :: Deprecated: This method is deprecated in favor of
833
- :meth: `~web3.geth.shh.generate_sym_key_from_password() `
834
-
835
- .. py :method :: Shh.generate_sym_key_from_password(self )
836
-
837
- * Generates the key from password, stores it, and returns its ID.
838
-
839
- * Returns the new key pair's identity
840
-
841
- .. code-block :: python
842
-
843
- >> > web3.geth.shh.generate_sym_key_from_password(' shh secret pwd' )
844
- ' 6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c'
845
-
846
- .. py :method :: Shh.hasSymKey()
847
-
848
- .. warning :: Deprecated: This method is deprecated in favor of
849
- :meth: `~web3.geth.shh.has_sym_key() `
850
-
851
- .. py :method :: Shh.has_sym_key(self , id )
852
-
853
- * Checks if there is a symmetric key stored with the given ID.
854
-
855
- * Returns ``True `` if the key exists, otherwise ``False ``
856
-
857
- .. code-block :: python
858
-
859
- >> > web3.geth.shh.has_sym_key(' 6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c' )
860
- False
861
-
862
- .. py :method :: Shh.getSymKey()
863
-
864
- .. warning :: Deprecated: This method is deprecated in favor of
865
- :meth: `~web3.geth.shh.get_sym_key() `
866
-
867
- .. py :method :: Shh.get_sym_key(self , id )
868
-
869
- * Returns the symmetric key associated with the given ID.
870
-
871
- * Returns the public key associated with the key pair
872
-
873
- .. code-block :: python
874
-
875
- >> > web3.geth.shh.get_sym_key(' 6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c' )
876
- ' 0x58f6556e56a0d41b464a083161377c8a9c2e95156921f954f99ef97d41cebaa2'
877
-
878
- .. py :method :: Shh.deleteSymKey()
879
-
880
- .. warning :: Deprecated: This method is deprecated in favor of
881
- :meth: `~web3.geth.shh.delete_sym_key() `
882
-
883
- .. py :method :: Shh.delete_sym_key(self , id )
884
-
885
- * Deletes the symmetric key associated with the given ID.
886
-
887
- * Returns ``True `` if the key pair was deleted, otherwise ``False ``
888
-
889
- .. code-block :: python
890
-
891
- >> > web3.geth.shh.delete_sym_key(' 6c388d63003deb378700c9dad87f67df0247e660647d6ba1d04321bbc2f6ce0c' )
892
- True
0 commit comments