public function addOpReturn($data, $allowNonStandard = false) {
        if (!$allowNonStandard && strlen($data) / 2 > 79) {
            throw new BlocktrailSDKException("OP_RETURN data should be <= 79 bytes to remain standard!");
        }

        $script = ScriptFactory::create()
            ->op('OP_RETURN')
            ->push(new Buffer($data))
            ->getScript()
        ;

        $this->addOutput([
            'scriptPubKey' => $script,
            'value' => 0
        ]);

        return $this;
    }
public function addOpReturn($data, $allowNonStandard = false) {
        if (!$allowNonStandard && strlen($data) / 2 > 79) {
            throw new BlocktrailSDKException("OP_RETURN data should be <= 79 bytes to remain standard!");
        }

        $script = ScriptFactory::create()
            ->op('OP_RETURN')
            ->push(new Buffer($data))
            ->getScript()
        ;

        $this->addOutput([
            'scriptPubKey' => $script,
            'value' => 0
        ]);

        return $this;
    }
public function addOpReturn ( $ data , $ allowNonStandard = false ) { if ( ! $ allowNonStandard && strlen ( $ data ) / 2 > 79 ) { throw new BlocktrailSDKException ( "OP_RETURN data should be <= 79 bytes to remain standard!" ) ; } $ script = ScriptFactory :: create ( ) -> op ( 'OP_RETURN' ) -> push ( new Buffer ( $ data ) ) -> getScript ( ) ; $ this -> addOutput ( [ 'scriptPubKey' => $ script , 'value' => 0 ] ) ; return $ this ; }
add OP_RETURN output

$data will be bin2hex and will be prefixed with a proper OP_PUSHDATA

@param string $data
@param bool   $allowNonStandard  when TRUE will allow scriptPubKey > 80 bytes (so $data > 80 bytes)
@return $this
@throws BlocktrailSDKException
add OP_RETURN output