github.com/btcsuite/btcd@v0.24.0/btcjson/README.md (about)

     1  btcjson
     2  =======
     3  
     4  [![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
     5  [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
     6  [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson)
     7  
     8  Package btcjson implements concrete types for marshalling to and from the
     9  bitcoin JSON-RPC API.  A comprehensive suite of tests is provided to ensure
    10  proper functionality.
    11  
    12  Although this package was primarily written for the btcsuite, it has
    13  intentionally been designed so it can be used as a standalone package for any
    14  projects needing to marshal to and from bitcoin JSON-RPC requests and responses.
    15  
    16  Note that although it's possible to use this package directly to implement an
    17  RPC client, it is not recommended since it is only intended as an infrastructure
    18  package.  Instead, RPC clients should use the
    19  [btcrpcclient](https://github.com/btcsuite/btcrpcclient) package which provides
    20  a full blown RPC client with many features such as automatic connection
    21  management, websocket support, automatic notification re-registration on
    22  reconnect, and conversion from the raw underlying RPC types (strings, floats,
    23  ints, etc) to higher-level types with many nice and useful properties.
    24  
    25  ## Installation and Updating
    26  
    27  ```bash
    28  $ go get -u github.com/btcsuite/btcd/btcjson
    29  ```
    30  
    31  ## Examples
    32  
    33  * [Marshal Command](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-MarshalCmd)  
    34    Demonstrates how to create and marshal a command into a JSON-RPC request.
    35  
    36  * [Unmarshal Command](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-UnmarshalCmd)  
    37    Demonstrates how to unmarshal a JSON-RPC request and then unmarshal the
    38    concrete request into a concrete command.
    39  
    40  * [Marshal Response](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-MarshalResponse)  
    41    Demonstrates how to marshal a JSON-RPC response.
    42  
    43  * [Unmarshal Response](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-package--UnmarshalResponse)  
    44    Demonstrates how to unmarshal a JSON-RPC response and then unmarshal the
    45    result field in the response to a concrete type.
    46  
    47  ## GPG Verification Key
    48  
    49  All official release tags are signed by Conformal so users can ensure the code
    50  has not been tampered with and is coming from the btcsuite developers.  To
    51  verify the signature perform the following:
    52  
    53  - Download the public key from the Conformal website at
    54    https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
    55  
    56  - Import the public key into your GPG keyring:
    57    ```bash
    58    gpg --import GIT-GPG-KEY-conformal.txt
    59    ```
    60  
    61  - Verify the release tag with the following command where `TAG_NAME` is a
    62    placeholder for the specific tag:
    63    ```bash
    64    git tag -v TAG_NAME
    65    ```
    66  
    67  ## License
    68  
    69  Package btcjson is licensed under the [copyfree](http://copyfree.org) ISC
    70  License.