A transaction with a 77 bytes OP_RETURN is refused, but with shorter data (e.g. 74 bytes) is accepted, although up to 80 bytes should work.
What is the safe limit to be used?
Per these references the maximum length is 80 bytes (83 for whole script) (since v 0.11):
https://stackoverflow.com/questions/24845429/maximum-size-of-data-bitcoin-op-return-tx-can-handle https://developer.bitcoin.org/devguide/transactions.html#null-data
The below transaction produces error: {"error":"-26: scriptpubkey"}
.
Similar transactions with slightly shorter OP_RETURN are fine.
01000000000102ae5c4a7139f0f47cf4bf431d99f110e73d2cd7e03faae56d56d7c09db3ee3c400100000000fbffffffc8ab005126b7b871d7c9621789de87282f4cd13e851fd286b0e5aae02e21c0b90000000000faffffff0350c30000000000001600146f26d2633d5307d9c4b1ca5b4c282201bae4ab144e15000000000000160014bb5bb9b9a07718bd0bfeef385f6a184787b584da00000000000000004f6a4d535741503a424e422e425553443a626e62317368366e757a7474336463657679346e676d7a746b7061706e76787179376a653074307564723a3635383137323831393a74656d7963683a3330300247304402200ca03ef0f249471dbee806b0961892c7141339460a5890479fdbebd3ec06ce8d02201a2275d54849f660ba01cd2799c0ac57a4bfca6d21115ddeecf63ebfd71898df0121034df96f5dacf5e22fb8611e6863e48f6777c7e96064c81196e23dcefd35017d0e02483045022100987199ff71731d44520bc1ed3704a6a66725ea890479ea5078b6b89ebb854d8402202dd52791a28c9d28c1672785765aab811b1549a1ec031f7c15a4ee472e70c4200121034df96f5dacf5e22fb8611e6863e48f6777c7e96064c81196e23dcefd35017d0e00000000
{
"data_hex": "535741503a ...",
"script": "6a4d535741503a ...",
"script_type": "null-data",
"value": 0
}
Note: use case is client for thorswap.finance cross-chain DEX.