SHOWING: First 60
context.index.assert_inscription_location(
inscription_id,
SatPoint {
outpoint: OutPoint { txid, vout: 0 },
offset: 0,
},
Some(50 * COIN_VALUE),
);
}
}
#[test]
fn inscription_with_pointer_is_cursed() {
for context in Context::configurations() {
context.mine_blocks(1);
let inscription = Inscription {
content_type: Some("text/plain".into()),
body: Some("pointer-child".into()),
pointer: Some(0u64.to_le_bytes().to_vec()),
..Default::default()
};
let txid = context.rpc_server.broadcast_tx(TransactionTemplate {
inputs: &[(1, 0, 0, inscription.to_witness())],
..Default::default()
});
context.mine_blocks(1);
let inscription_id = InscriptionId { txid, index: 0 };
context.index.assert_inscription_location(
inscription_id,
SatPoint {
outpoint: OutPoint { txid, vout: 0 },
offset: 0,
},
Some(50 * COIN_VALUE),#45,198,185textuse {super::*, crate::wallet::Wallet};
#[derive(Debug, Parser)]
pub(crate) struct Sats {
#[arg(
long,
help = "Find satoshis listed in first column of tab-separated value file <TSV>."
)]
tsv: Option<PathBuf>,
}
#[derive(Serialize, Deserialize)]
pub struct OutputTsv {
pub sat: String,
pub output: OutPoint,
}
#[derive(Serialize, Deserialize)]
pub struct OutputRare {
pub sat: Sat,
pub output: OutPoint,
pub offset: u64,
pub rarity: Rarity,
}
impl Sats {
pub(crate) fn run(&self, options: Options) -> SubcommandResult {
let index = Index::open(&options)?;
if !index.has_sat_index() {
bail!("sats requires index created with `--index-sats` flag");
}
index.update()?;
let utxos = index.get_unspent_output_ranges(Wallet::load(&options)?)?;
if let Some(path) = &self.tsv {
let mut output = Vec::new();
for (outpoint, sat) in sats_from_tsv(
utxos,
&fs::read_to_string(path)
.with_context(|| format!("I/O error reading `{}`", path.display()))?,#45,198,168text let reveal_address = recipient();
let (_commit_tx, reveal_tx, _private_key, _) = Batch {
satpoint,
parent_info: None,
inscriptions: vec![inscription],
destinations: vec![reveal_address],
commit_fee_rate: FeeRate::try_from(1.0).unwrap(),
reveal_fee_rate: FeeRate::try_from(1.0).unwrap(),
no_limit: true,
reinscribe: false,
postage: TransactionBuilder::TARGET_POSTAGE,
mode: Mode::SharedOutput,
..Default::default()
}
.create_batch_inscription_transactions(
BTreeMap::new(),
Chain::Mainnet,
BTreeSet::new(),
utxos.into_iter().collect(),
[commit_address, change(1)],
)
.unwrap();
assert!(reveal_tx.size() >= MAX_STANDARD_TX_WEIGHT as usize);
}
#[test]
fn cbor_and_json_metadata_flags_conflict() {
assert_regex_match!(
Arguments::try_parse_from([
"ord",
"wallet",
"inscribe",
"--cbor-metadata",
"foo",
"--json-metadata",
"bar",
"--file",#45,198,037text ..Default::default()
});
context.mine_blocks(1);
let inscription_id = InscriptionId { txid, index: 0 };
context.index.assert_inscription_location(
inscription_id,
SatPoint {
outpoint: OutPoint { txid, vout: 0 },
offset: 0,
},
Some(50 * COIN_VALUE),
);
}
}
#[test]
fn inscription_with_pointer_into_fee_ignored_and_assigned_default_location() {
for context in Context::configurations() {
context.mine_blocks(1);
let inscription = Inscription {
content_type: Some("text/plain".into()),
body: Some("hello".into()),
pointer: Some((25 * COIN_VALUE).to_le_bytes().to_vec()),
..Default::default()
};
let txid = context.rpc_server.broadcast_tx(TransactionTemplate {
inputs: &[(1, 0, 0, inscription.to_witness())],
fee: 25 * COIN_VALUE,
..Default::default()
});
context.mine_blocks(1);
let inscription_id = InscriptionId { txid, index: 0 };#45,197,957textconsidered to have an implicit input equal in size to the subsidy, followed by
an input for every fee-paying transaction in the block, in the order that those
transactions appear in the block. The implicit subsidy input carries the
block's newly created sats. The implicit fee inputs carry the sats that were
paid as fees in the block's transactions.
Underpaying the subsidy does not change the ordinal numbers of sats mined
in subsequent blocks. Ordinals depend only on how many sats could have been
mined, not how many actually were.
=== Specification ===
Sats are numbered and transferred with the following algorithm:
<pre>
# subsidy of block at given height
def subsidy(height):
return 50 * 100_000_000 >> height // 210_000
# first ordinal of subsidy of block at given height
def first_ordinal(height):
start = 0
for height in range(height):
start += subsidy(height)
return start
# assign ordinals in given block
def assign_ordinals(block):
first = first_ordinal(block.height)
last = first + subsidy(block.height)#45,161,765text