fboucquez / ordinal-inscription-example-using-bitcoinjs-lib

17 stars 6 forks source link

Issue with broadcasting large raw transactions in Bitcoind regtest #4

Open minhnd410 opened 10 months ago

minhnd410 commented 10 months ago

I attempted to broadcast a raw transaction to Bitcoind regtest on my local machine, using an image as content. However, I encountered an error stating Push value size limit exceeded. Upon investigation, I found that sendrawtransaction only accepts content up to 520 bytes. Could you explain why this limit exists?

Here is the relevant line in the Bitcoin source code:
https://github.com/bitcoin/bitcoin/blob/65c05db660b2ca1d0076b0d8573a6760b3228068/src/script/interpreter.cpp#L446

I followed your example for the inscription variable here

  const imgPath = resolve('imgs/smile.png')
  const imgdata = fs.readFileSync(imgPath)
  const inscription = {
    contentType: Buffer.from(encoder.encode('image/png')),
    content: imgdata,
    postage: 10000
  }