Withdraw Ordinal Inscriptions
Overview
You can use Bitcoin hot wallets to receive, store, and transfer ordinal inscriptions - the Bitcoin equivalent to a non-fungible token (NFT). Ordinal inscriptions enable you to secure your valuable digital files in the same way you secure bitcoin. The Bitcoin blockchain records inscribed-ordinal satoshis, enabling a public record of ownership.
Minting
The following content types are supported:
* application/json
* application/pdf
* application/pgp-signature
* application/yaml
* application/yaml
* flac
* audio/mpeg
* audio/wav
* image/apng
* image/avif
* image/gif
* image/jpeg
* image/jpg
* image/png
* image/svg+xml
* image/webp
* model/gltf-binary
* model/stl
* text/html;charset=utf-8
* text/plain;charset=utf-8
* video/mp4
* video/webm
Prerequisites
Steps
1. Mint Inscription
async function mintBitcoinInscription(walletId) {
const coin = 'btc';
const walletInstance = await bitgo.coin(coin).wallets().get({ id: walletId });
const inscriptionBuilder = bitgo.coin(coin).getInscriptionBuilder(walletInstance);
const inscriptionData = Buffer.from('BitGoNFT', 'ascii');
const { address, tapLeafScript, revealTransactionVSize } =
await inscriptionBuilder.prepareReveal(inscriptionData, 'text/plain');
// Calculate Fees
const feeRateSatPerKb = 20001;
const sendAmount = new BigNumber( (revealTransactionVSize / 1000) * feeRateSatPerKb).plus(10000);
// Build a commit transaction to pay reveal transaction fees.
const builtTxn = await walletInstance.prebuildTransaction({
recipients: [{
amount: sendAmount.decimalPlaces(0,6).toString(),
address: address,
}],
});
const unsignedCommitTx = builtTxn.txHex;
const unspents = builtTxn.txInfo.unspents;
const recipientAddress = '3LXYcBoqxVcdAFgtRrNoRUjzArxtFjuPuT'
await inscriptionBuilder.signAndSendReveal('walletPassphrase',
tapLeafScript,
address,
Buffer.from(unsignedCommitTx, 'hex'),
unspents,
recipientAddress,
inscriptionData);
}
2. Send Transaction
async function sendInscription(walletId) {
const coin = 'btc';
const walletInstance = await bitgo.coin(coin).wallets().get({ id: walletId });
const inscriptionBuilder = bitgo.coin(coin).getInscriptionBuilder(walletInstance);
const feeRateSatKb = 1001;
const satPoint = '41eb6bb6aa7a3cf71d1ccc4429e33efcd76b9c661c014c7c943f7a81f9461e06:0:0';
const recipient = '2MuQkZo9E3M8ryqwxPyrS2QK9yi5TtwKyog';
const buildResult = await inscriptionBuilder.prepareTransfer(
satPoint,
recipient,
feeRateSatKb,
{ inscriptionConstraints: {
minInscriptionOutput: BigInt(5_000),
},
});
await inscriptionBuilder.signAndSendTransfer('walletPassphrase', buildResult);
}
Next
Approve the transaction.
See Also
Updated 22 days ago