bigchaindb-driver: [handcraft tx] The browser (or proxy) sent a request that this server could not understand.

Both @mgrand (java) and @zballs (go) encountered the same error meanwhile trying to implement code to generate valid transaction payloads.

Key Pair Generation

BigchainDB relies on the Python cryptoconditions library to generate keypairs, which in turn relies on libsodium (via PyNacl) and base58.

It is important to note that the base58 library must be an implementation compatible with what is used by the bitcoin network, but not including the check (for example, the server uses b58encode() rather than b58encode_check()). An example Java implementation that should be compatible is available here.

The payload reported by @mgrand is:

{
    "version": 1,
    "transaction": {
        "asset": {
            "data": null,
            "divisible": false,
            "refillable": false,
            "updatable": false,
            "id": "50965943-3070-41d6-a7be-a44727933476"
        },
        "metadata": {
            "data": {
                "bogosity": 43
            },
            "id": "316f0ef9-4566-48c8-9b9c-0db09329ea2c"
        },
        "conditions": [
            {
                "amount": 1,
                "cid": 0,
                "owners_after": [
                    "QDui4QA6QKMpMRpJQxm8QMM3m4ty2oY3HcgUq5hx3bixdHYbLBnJMZysqYd91Lr1"
                ],
                "condition": {
                    "uri": "cc:4:20:MC0wCAYDK2VkCgEBAyEAErZADsVxHrIG4zs0ghg0hMvGeqRUv00e5DF_2CRtg4Y:96",
                    "details": {
                        "bitmask": 32,
                        "public_key": "QDui4QA6QKMpMRpJQxm8QMM3m4ty2oY3HcgUq5hx3bixdHYbLBnJMZysqYd91Lr1",
                        "signature": null,
                        "type": "fulfillment",
                        "type_id": 4
                    }
                }
            }
        ],
        "fulfillments": [
            {
                "signature": "449ZhWnCjKuMjJ87SPJeuTTeMGub6c6wUnYwcUGT1xKfTB9AJaAVCzETcnpcDH6ob1ZbwuY8To5BXYdXpGJ9fW8L",
                "public_key": "QDui4QA6QKMpMRpJQxm8QMM3m4ty2oY3HcgUq5hx3bixdHYbLBnJMZysqYd91Lr1",
                "type_id": 4,
                "bitmask": 32,
                "type": "fulfillment"
            }
        ],
        "operation": "CREATE"
    },
    "id": "c80a202d95620166611b6755fa1b94a032505df36c1ab4a123ce5675b50b38b8"
}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (15 by maintainers)

Most upvoted comments

@sohkai Ok, I can send valid transactions now! I set fulfillment to null in the prepared transaction (as opposed to omitting it) to get the same tx_id. Also, following your advice, I took the string representation of the marshaled JSON.

@zballs @mgrand I did want to point out another potential cause that relates to the error message in the title.

Usually, if you get back a 400 with a payload that resembles

{
  "message": "The browser (or proxy) sent a request that this server could not understand."
}

It’s because of bad headers or something else mal-formed about your HTTP request. If you see this error, then the BigchainDB node hasn’t actually looked at the payload or tried to validate it; this is a pretty typical Flask (our webserver) error that gets spit out if something looks weird to it.

For example, I often get this error if I try to do a GET with Content-Type instead of Accept headers.


If the transaction payload is actually invalid, a different message saying that should come back.