@@ -723,3 +723,139 @@ func (r *GenerateRequest) MarshalJSON() ([]byte, error) {
723
723
724
724
return json .Marshal (params )
725
725
}
726
+
727
+ // ========== GetBlockHeader ============= //
728
+ type (
729
+ GetBlockHeaderRequest struct {
730
+ Hash string
731
+ NotVerbose bool
732
+ }
733
+
734
+ /*
735
+ {
736
+ "hash": "bba11e1bacc69ba535d478cf1f2e542da3735a517b0b8eebaf7e6bb25eeb48c5",
737
+ "confirmations": 1,
738
+ "height": 3983,
739
+ "version": 536870912,
740
+ "versionHex": "20000000",
741
+ "merkleroot": "0b5f03dc9d456c63c587cc554b70c1232449be43d1df62bc25a493b04de90334",
742
+ "time": 1536551888,
743
+ "mediantime": 1536551728,
744
+ "nonce": 0,
745
+ "bits": "207fffff",
746
+ "difficulty": 4.656542373906925e-10,
747
+ "chainwork": "0000000000000000000000000000000000000000000000000000000000001f20",
748
+ "hashStateRoot": "3e49216e58f1ad9e6823b5095dc532f0a6cc44943d36ff4a7b1aa474e172d672",
749
+ "hashUTXORoot": "130a3e712d9f8b06b83f5ebf02b27542fb682cdff3ce1af1c17b804729d88a47",
750
+ "previousblockhash": "6d7d56af09383301e1bb32a97d4a5c0661d62302c06a778487d919b7115543be",
751
+ "flags": "proof-of-stake",
752
+ "proofhash": "15bd6006ecbab06708f705ecf68664b78b388e4d51416cdafb019d5b90239877",
753
+ "modifier": "a79c00d1d570743ca8135a173d535258026d26bafbc5f3d951c3d33486b1f120"
754
+ }
755
+ */
756
+ GetBlockHeaderResponse struct {
757
+ Hash string `json:"hash"`
758
+ Confirmations int `json:"confirmations"`
759
+ Height int `json:"height"`
760
+ Version int `json:"version"`
761
+ VersionHex string `json:"versionHex"`
762
+ Merkleroot string `json:"merkleroot"`
763
+ Time uint64 `json:"time"`
764
+ Mediantime int `json:"mediantime"`
765
+ Nonce int `json:"nonce"`
766
+ Bits string `json:"bits"`
767
+ Difficulty float64 `json:"difficulty"`
768
+ Chainwork string `json:"chainwork"`
769
+ HashStateRoot string `json:"hashStateRoot"`
770
+ HashUTXORoot string `json:"hashUTXORoot"`
771
+ Previousblockhash string `json:"previousblockhash"`
772
+ Flags string `json:"flags"`
773
+ Proofhash string `json:"proofhash"`
774
+ Modifier string `json:"modifier"`
775
+ }
776
+ )
777
+
778
+ func (r * GetBlockHeaderRequest ) MarshalJSON () ([]byte , error ) {
779
+ return json .Marshal ([]interface {}{
780
+ r .Hash ,
781
+ ! r .NotVerbose ,
782
+ })
783
+ }
784
+
785
+ // ========== GetBlock ============= //
786
+ type (
787
+ GetBlockRequest struct {
788
+ Hash string
789
+ Verbosity * int
790
+ }
791
+
792
+ /*
793
+ {
794
+ "hash": "bba11e1bacc69ba535d478cf1f2e542da3735a517b0b8eebaf7e6bb25eeb48c5",
795
+ "confirmations": 57,
796
+ "strippedsize": 584,
797
+ "size": 620,
798
+ "weight": 2372,
799
+ "height": 3983,
800
+ "version": 536870912,
801
+ "versionHex": "20000000",
802
+ "merkleroot": "0b5f03dc9d456c63c587cc554b70c1232449be43d1df62bc25a493b04de90334",
803
+ "hashStateRoot": "3e49216e58f1ad9e6823b5095dc532f0a6cc44943d36ff4a7b1aa474e172d672",
804
+ "hashUTXORoot": "130a3e712d9f8b06b83f5ebf02b27542fb682cdff3ce1af1c17b804729d88a47",
805
+ "tx": [
806
+ "3208dc44733cbfa11654ad5651305428de473ef1e61a1ec07b0c1a5f4843be91",
807
+ "8fcd819194cce6a8454b2bec334d3448df4f097e9cdc36707bfd569900268950"
808
+ ],
809
+ "time": 1536551888,
810
+ "mediantime": 1536551728,
811
+ "nonce": 0,
812
+ "bits": "207fffff",
813
+ "difficulty": 4.656542373906925e-10,
814
+ "chainwork": "0000000000000000000000000000000000000000000000000000000000001f20",
815
+ "previousblockhash": "6d7d56af09383301e1bb32a97d4a5c0661d62302c06a778487d919b7115543be",
816
+ "nextblockhash": "d7758774cfdd6bab7774aa891ae035f1dc5a2ff44240784b5e7bdfd43a7a6ec1",
817
+ "flags": "proof-of-stake",
818
+ "proofhash": "15bd6006ecbab06708f705ecf68664b78b388e4d51416cdafb019d5b90239877",
819
+ "modifier": "a79c00d1d570743ca8135a173d535258026d26bafbc5f3d951c3d33486b1f120",
820
+ "signature": "3045022100a6ab6c2b14b1f73e734f1a61d4d22385748e48836492723a6ab37cdf38525aba022014a51ecb9e51f5a7a851641683541fec6f8f20205d0db49e50b2a4e5daed69d2"
821
+ }
822
+ */
823
+ GetBlockResponse struct {
824
+ Hash string `json:"hash"`
825
+ Confirmations int `json:"confirmations"`
826
+ Strippedsize int `json:"strippedsize"`
827
+ Size int `json:"size"`
828
+ Weight int `json:"weight"`
829
+ Height int `json:"height"`
830
+ Version int `json:"version"`
831
+ VersionHex string `json:"versionHex"`
832
+ Merkleroot string `json:"merkleroot"`
833
+ HashStateRoot string `json:"hashStateRoot"`
834
+ HashUTXORoot string `json:"hashUTXORoot"`
835
+ Tx []string `json:"tx"`
836
+ Time int `json:"time"`
837
+ Mediantime int `json:"mediantime"`
838
+ Nonce int `json:"nonce"`
839
+ Bits string `json:"bits"`
840
+ Difficulty float64 `json:"difficulty"`
841
+ Chainwork string `json:"chainwork"`
842
+ Previousblockhash string `json:"previousblockhash"`
843
+ Nextblockhash string `json:"nextblockhash"`
844
+ Flags string `json:"flags"`
845
+ Proofhash string `json:"proofhash"`
846
+ Modifier string `json:"modifier"`
847
+ Signature string `json:"signature"`
848
+ }
849
+ )
850
+
851
+ func (r * GetBlockRequest ) MarshalJSON () ([]byte , error ) {
852
+ verbosity := 1
853
+ if r .Verbosity != nil {
854
+ verbosity = * r .Verbosity
855
+ }
856
+
857
+ return json .Marshal ([]interface {}{
858
+ r .Hash ,
859
+ verbosity ,
860
+ })
861
+ }
0 commit comments