forked from supertestnet/sigchains
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_op_return.html
26 lines (26 loc) · 1.26 KB
/
create_op_return.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://bitcoincore.tech/apps/bitcoinjs-ui/lib/bitcoinjs-lib.js"></script>
<script src="https://bundle.run/[email protected]"></script>
<script>
var txb = new bitcoinjs.TransactionBuilder( bitcoinjs.networks.testnet );
txb.addInput( '2be931057a5c7f324e73dd15fab1b228825caebc1122a760b21402745bad0797', 1 );
txb.addOutput( 'mortzsoRcusKthxeYXjuj24VNLA4bxLsuN', 521336 );
var data = buffer.Buffer.from( '00fc862b4ecce74626814efc585249e060d369c700e6b279bc6497d433815f84618e5438b6696ee80c7acd2d86ad135e6ee0605a7f78a9f4786b114e1bc79556277acd7d1bd348aea185f8509bae42b5', 'hex' );
ret = bitcoinjs.script.compile(
[
bitcoinjs.opcodes.OP_RETURN,
data
]
)
txb.addOutput( ret, 0 )
var yourAddressPrivateKeyWIF = '';
var yourAddresskeyPair = bitcoinjs.ECPair.fromWIF( yourAddressPrivateKeyWIF, bitcoinjs.networks.testnet );
txb.sign( 0, yourAddresskeyPair );
console.log( txb.build().toHex() );
</script>
</head>
<body>
</body>
</html>