Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ npm run deploy
The root uses current CARS CLI. Releases require operator-owned Evans safety gates, isolated canary rendering/drain qualification, continuous probes of custom and generated domains, exact deployed-asset verification, and two Ready serving endpoints on distinct nodes. `ops/canary.Dockerfile` supports a Linux/amd64 remote qualification image of the same frontend source; it adds no application backend. Deployment records, images, routing, release credentials and rollback evidence belong in network-ops.

After publishing addresses, rollback must preserve this wallet record format, expiration blocks and access to all saved key IDs. Do not roll back to the old single-address frontend. Retain the accepted compatible frontend image and use forward repair or a compatible image rollback; never delete wallet recovery outputs or resume expired-address discovery.

## Wallet permission group and branding

`/manifest.json` declares the complete BRC-116 group under `metanet`: identity retrieval, the unchanged Mountaintops derivation/signing protocol, self-only `[2, "mntops v1"]` SDK LocalKVStore encryption/signature checks, both app baskets, all three fixed action-label protocols, and a 100,000-satoshi monthly spending allowance for payments and wallet/network fees. The wallet presents this declaration for user consent; it is not a grant or a hard transfer limit. Above-allowance payments require further wallet approval. No certificate or peer-trust scope is requested. See the [BRC-116 specification](https://github.com/bsv-blockchain/BRCs/blob/master/wallet/0116.md).

New actions use fixed labels and native TXIDs, avoiding a new label permission for every request. Older UUID-labelled actions remain recoverable by reading the common app label and matching their TXID or legacy label in returned metadata. No transaction UI history is persisted.

The header and favicon use the same authored `/mountaintops.svg`. Wallet/PWA icons and the touch icon are PNG renders of that source at 192 and 512 pixels. Keep all variants in sync when changing the logo. The unused legacy Vite file remains only for cached old HTML during compatible releases; the current app and manifest never reference it.
6 changes: 5 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/mountaintops.svg" />
<link rel="manifest" href="/manifest.json" />
<link rel="apple-touch-icon" href="/mountaintops-192.png" />
<meta name="theme-color" content="#142630" />
<meta name="description" content="Receive and send public BSV payments with your BRC-100 wallet." />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mountaintops | Shout BSV with no privacy.</title>
</head>
Expand Down
96 changes: 96 additions & 0 deletions frontend/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"id": "/",
"name": "Mountaintops",
"short_name": "Mountaintops",
"description": "Receive and send public BSV payments with your BRC-100 wallet.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"theme_color": "#142630",
"background_color": "#101b23",
"icons": [
{
"src": "/mountaintops-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/mountaintops-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/mountaintops.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "any"
}
],
"metanet": {
"schemaVersion": 1,
"groupPermissions": {
"description": "Use Mountaintops to recover addresses and payments, save receiving choices, and send BSV.",
"protocolPermissions": [
{
"protocolID": [
1,
"identity key retrieval"
],
"description": "Restore the addresses belonging to your wallet account."
},
{
"protocolID": [
1,
"mountaintops"
],
"description": "Derive your receiving addresses and sign imports of your coins."
},
{
"protocolID": [
2,
"mntops v1"
],
"counterparty": "self",
"description": "Encrypt, sign, verify, and recover your saved addresses, receiving choice, and recovery records."
},
{
"protocolID": [
1,
"action label mountaintops actions v1"
],
"description": "Find unfinished Mountaintops actions and prevent duplicate payments."
},
{
"protocolID": [
1,
"action label mountaintops record v1"
],
"description": "Identify saved address and recovery records."
},
{
"protocolID": [
1,
"action label mountaintops receipts v1"
],
"description": "Identify retained payment evidence for your addresses."
}
],
"basketAccess": [
{
"basket": "mntops v1",
"description": "Read and save encrypted address and recovery records."
},
{
"basket": "mountaintops receipts v1",
"description": "Retain and recover transaction evidence for coins sent to your addresses."
}
],
"spendingAuthorization": {
"amount": 100000,
"description": "Allow up to 100,000 satoshis per month for BSV payments and wallet/network fees. Amounts above the allowance need separate wallet approval."
}
}
}
}
Binary file added frontend/public/mountaintops-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/mountaintops-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions frontend/public/mountaintops.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { readCoverage, type Coverage } from './coverageClient.ts'
import { refreshCoins, type Coin } from './coins.ts'
import { importCoins, sendCoins, unfinishedWalletActions } from './actions.ts'
import { preferCompatibleTransport } from './walletClient.ts'
import { assertWalletActionFinal } from './walletActionState.ts'
import './style.css'

const client = new WalletClient('auto')
Expand Down Expand Up @@ -217,7 +218,7 @@ export default function Mountaintops() {
}

return <main aria-busy={busy || searching}>
<header><div className="brand"><span className="mountain-mark" aria-hidden="true">△</span><h1>Mountaintops</h1></div><p>Public BSV payments.</p></header>
<header><div className="brand"><img className="mountain-mark" src="/mountaintops.svg" width="40" height="40" alt="" aria-hidden="true" /><h1>Mountaintops</h1></div><p>Public BSV payments.</p></header>
{!session ? <section className="connect"><h2>Your BSV, ready to receive.</h2><p>Connect your wallet to find your addresses and payments.</p><button className="accent" disabled={disabled} onClick={() => void run(async () => { await reload(null); setMessage(''); })}>{busy ? 'Connecting…' : 'Connect wallet'}</button><p className="small">Use the same BRC-100 wallet on any device.</p></section> : <>
<nav className="view-tabs" aria-label="Payment direction"><button aria-pressed={view === 'receive'} onClick={() => setView('receive')}>Receive</button><button aria-pressed={view === 'send'} onClick={() => setView('send')}>Send</button><span className="connection">{session.network === 'mainnet' ? 'Mainnet' : 'Testnet'} · Connected</span></nav>
{pendingActions.length > 0 && <section className="warning"><h2>Check your wallet before continuing</h2><p>A previous payment has no final result yet. Do not send it again.</p>{pendingActions.map(action => <div key={String(action.id)}><details><summary>Payment details</summary><p className="transaction">{String(action.state)} {action.txid ? `· ${String(action.txid)}` : ''}</p></details><button disabled={disabled} onClick={() => void run(async () => {
Expand All @@ -226,8 +227,7 @@ export default function Mountaintops() {
const aborted = await client.abortAction({ reference: action.reference })
if (!aborted.aborted) throw new Error('Wallet did not acknowledge cancellation')
} else {
const page = await client.listActions({ labels: [`mountaintops request ${String(action.id)}`], limit: 100 })
if (!page.actions.length || page.actions.some(x => !['completed', 'failed'].includes(x.status))) throw new Error('Your wallet has no final result yet. Do not retry this payment.')
await assertWalletActionFinal(client, action)
}
await reload(fresh); setMessage('Wallet payment status checked.')
})}>{action.state === 'prepared' ? 'Cancel unsent payment' : 'Check wallet result'}</button></div>)}</section>}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Importer from './Importer.ts'
import type { WalletRecords } from './walletRecords.ts'
import { assertInputsUnspent } from './inputChecks.ts'
import { unfinishedWalletActions } from './walletActionState.ts'
import { ACTION_LABEL } from './walletScopes.ts'
export { unfinishedWalletActions } from './walletActionState.ts'

export function parseSatoshis(bsv: string): number {
Expand Down Expand Up @@ -34,8 +35,6 @@ export function assertSameTemplate(before: Transaction, after: Transaction): voi
// external coins. Signed noSend actions can be aborted by TXID on a fresh device.

export async function eligibleAction(wallet: WalletInterface, store: WalletRecords, args: CreateActionArgs, coverage: Coverage, progress: Progress, coins: Coin[] = [], recipient?: string): Promise<string> {
const id = crypto.randomUUID()
const requestLabel = `mountaintops request ${id}`
if ((await unfinishedWalletActions(wallet, store.network)).length) throw new Error('Review the unfinished wallet action before another payment.')
let reference: string | undefined
let signedTxid: string | undefined
Expand All @@ -45,7 +44,7 @@ export async function eligibleAction(wallet: WalletInterface, store: WalletRecor
let nonce = 0
while (performance.now() - started < 30_000) {
progress(`Preparing an eligible transaction (attempt ${nonce + 1}). Your wallet may request permission; payment fees apply to the submitted payment.`)
const prepared = await wallet.createAction({ ...args, version: 1, lockTime: nonce++, labels: [...(args.labels ?? []), 'mountaintops actions v1', requestLabel], options: { signAndProcess: false, noSend: true, returnTXIDOnly: false, randomizeOutputs: false } })
const prepared = await wallet.createAction({ ...args, version: 1, lockTime: nonce++, labels: [...(args.labels ?? []), ACTION_LABEL], options: { signAndProcess: false, noSend: true, returnTXIDOnly: false, randomizeOutputs: false } })
if (!prepared.signableTransaction) throw new Error('The wallet did not return a signable transaction; no automatic retry is safe.')
reference = prepared.signableTransaction.reference
const tx = Transaction.fromAtomicBEEF(prepared.signableTransaction.tx)
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { addressMatches, assertReceivable, canonicalKeyID, transactionMatches }
import { validateAddress } from './addressBook.ts'
import { whatsOnChainFetch } from './whatsOnChainClient.ts'
import getBeefForTxid from './getBeefForTxid.ts'
import { RECEIPT_LABEL } from './walletScopes.ts'
import type { WalletRecords } from './walletRecords.ts'

export const COIN_BASKET = 'mountaintops receipts v1'
Expand Down Expand Up @@ -72,7 +73,7 @@ async function retainCoins(wallet: WalletInterface, entry: AddressRecord, coins:
async function saveCoinEvidence(wallet: WalletInterface, entry: AddressRecord, beef: Beef, outputs: Coin[]): Promise<void> {
const txid = outputs[0].txid
await wallet.internalizeAction({
tx: beef.toBinaryAtomic(txid), description: 'Retain Mountaintops deposit evidence', labels: ['mountaintops receipts v1'],
tx: beef.toBinaryAtomic(txid), description: 'Retain Mountaintops deposit evidence', labels: [RECEIPT_LABEL],
outputs: outputs.map(coin => ({ outputIndex: coin.vout, protocol: 'basket insertion', insertionRemittance: {
basket: COIN_BASKET, tags: [`address ${entry.address}`], customInstructions: JSON.stringify({ v: 1, network: entry.network, ...coin })
} }))
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/recordActions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Transaction, type WalletInterface } from '@bsv/sdk'
import type { Network } from '../../shared/brc234.ts'
import { assertInputsUnspent } from './inputChecks.ts'
import { ACTION_LABEL, RECORD_LABEL } from './walletScopes.ts'

type Prepared = { tx: Transaction; txid?: string; submitted: boolean }

Expand All @@ -19,7 +20,7 @@ export class RecordActions {
this.wallet = new Proxy(original, { get: (target, property) => {
if (property === 'createAction') return async (...[args, originator]: Parameters<WalletInterface['createAction']>) => {
if (args.options?.signAndProcess !== false || args.options?.sendWith?.length) throw new Error('Wallet record must be prepared before submission.')
const result = await original.createAction({ ...args, labels: [...(args.labels ?? []), 'mountaintops actions v1', 'mountaintops record v1', `mountaintops request ${crypto.randomUUID()}`], options: { ...args.options, noSend: true, returnTXIDOnly: false } }, originator)
const result = await original.createAction({ ...args, labels: [...(args.labels ?? []), ACTION_LABEL, RECORD_LABEL], options: { ...args.options, noSend: true, returnTXIDOnly: false } }, originator)
if (result.signableTransaction) this.prepared.set(result.signableTransaction.reference, { tx: Transaction.fromAtomicBEEF(result.signableTransaction.tx), submitted: false })
return result
}
Expand Down
Loading
Loading