> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.chainstack.com/feedback

```json
{
  "path": "/reference/bitcoin-decodescript",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# decodescript | Bitcoin

The `decodescript` method is used to decode a hex-encoded script, providing insights into its structure and purpose. This includes identifying the script type, associated addresses, and whether it is a segwit script.

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

* `scriptHex` (required): The hex-encoded script to decode.

## Response

* `result` — an object containing detailed information about the decoded script, including its type, related addresses, and segwit status.
* `error` — an object containing an error message if an error occurred, otherwise `null`.
* `id` — an integer representing the ID of the request.

## Use case

The `decodescript` method is invaluable for developers and analysts working with Bitcoin scripts, providing a way to inspect and understand the functionality of arbitrary scripts without executing them.


## OpenAPI

````yaml /openapi/bitcoin_node_api/decodescript.json POST /788f110831fe13808302bd79796d55e8
openapi: 3.0.0
info:
  title: decodescript example
  version: 1.0.0
  description: >-
    This is an API example for decodescript, a method to decode a hex-encoded
    script and provide details about  it, including its type, whether it is a
    segwit script, and any addresses it relates to.
servers:
  - url: https://nd-202-842-353.p2pify.com
security: []
paths:
  /788f110831fe13808302bd79796d55e8:
    post:
      tags:
        - Blockchain Operations
      summary: decodescript
      operationId: decodeScript
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  default: '1.0'
                method:
                  type: string
                  default: decodescript
                params:
                  type: array
                  items:
                    type: string
                    description: The hex-encoded script to decode.
                  default:
                    - 76a914af92ad98c7f77559f96430dfef2a6805b87b24f888ac
                id:
                  type: integer
                  default: 1
      responses:
        '200':
          description: Details about the decoded script.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    description: >-
                      Contains information about the script, such as its type,
                      addresses involved, and if it's a  segwit script.
                  error:
                    type: object
                  id:
                    type: integer

````