Skip to content

BlockCypher API: 'Error no data to embed for OP_RETURN output 1.' #1792

Closed Answered by gregnomis
gregnomis asked this question in Q&A
Discussion options

You must be logged in to vote

Well, although adding the null-data in hex didn't work, BlockCypher also accepts them as ASCII. So that's what I did and it worked:
// Modified createTransactionSkeleton function
async function createTransactionSkeleton(dataHash) {
console.log('Preparing to create transaction skeleton.');

// Convert hash to ASCII-safe Base64 encoding
const dataAscii = Buffer.from(dataHash, 'hex').toString('base64');

const inputs = [{ addresses: [address] }]; 
const outputs = [
    {
        addresses: ['bc1quul9k5pd63mgh4gj6h5gc7g5c24qmnmzex94hl'],
        value: 700 
    },
    {
        script_type: "null-data",
        data_string: dataAscii, // Use data_string field for ASCII representation instead o…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gregnomis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant