Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB v0.12: zk-STARKy, fully refactored and simplified #267

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
9d69fa3
nullify repo for refactoring
dr-orlovsky Dec 6, 2024
fb2ebc0
new descriptor
dr-orlovsky Dec 9, 2024
74dce7a
new wallet
dr-orlovsky Dec 10, 2024
ffd4073
make cli compile
dr-orlovsky Dec 10, 2024
fd324ad
bundle and PSBT creation
dr-orlovsky Dec 10, 2024
1e063f1
remove v0.11 files
dr-orlovsky Dec 10, 2024
84ae82b
complete accept and consign commands
dr-orlovsky Dec 15, 2024
36ec7dd
chore: use github-based rgb-std patch
dr-orlovsky Dec 15, 2024
f0a6aa0
chore: update dependencies
dr-orlovsky Dec 16, 2024
c7f8826
debug contract issue
dr-orlovsky Dec 16, 2024
6b192b9
improve contracts and state commands
dr-orlovsky Dec 17, 2024
f6db3da
funding and invoicing
dr-orlovsky Dec 17, 2024
18012f8
debug reading script for exec command
dr-orlovsky Dec 18, 2024
f11f30e
rename rgb-bp to rgb-runtime
dr-orlovsky Dec 20, 2024
542206e
chore: update formatting rules
dr-orlovsky Dec 20, 2024
bc29c5b
cli: add wallet sync; improve state display
dr-orlovsky Dec 20, 2024
fa51d7a
add outpoint information into the contract state
dr-orlovsky Dec 20, 2024
30262b2
wip on debugging
dr-orlovsky Dec 21, 2024
e9ec0a8
support state filtering basing on wallet ownership
dr-orlovsky Dec 21, 2024
e7d2efd
add complete procedure
dr-orlovsky Dec 21, 2024
484c50d
debug PSBT completion procedure
dr-orlovsky Dec 21, 2024
6ce02fe
complete PSBT processing
dr-orlovsky Dec 22, 2024
31edd8f
debug transfers
dr-orlovsky Dec 23, 2024
50ad8cd
save seal definition information to wallet
dr-orlovsky Dec 23, 2024
eec5e16
resolve seals on consignment consume
dr-orlovsky Dec 23, 2024
520811a
chore: update data
dr-orlovsky Dec 23, 2024
227912a
ci: update branch filter rules
dr-orlovsky Dec 23, 2024
a37ab77
chore: update dependencies
dr-orlovsky Dec 23, 2024
a81b205
chore: fix clippy lints
dr-orlovsky Dec 23, 2024
e6adad0
chore: add description to rgb-wallet crate
dr-orlovsky Dec 23, 2024
45d5aac
fix: tapret fund with opret wallet
Crayon-Shin-chan-bitlightlabs Jan 8, 2025
f5f35b9
fix typo
crisdut Jan 9, 2025
5cdfef8
Merge pull request #271 from crisdut/fix/typo
dr-orlovsky Jan 10, 2025
45a5ebd
Merge pull request #270 from Crayon-Shin-chan-bitlightlabs/v0.12
dr-orlovsky Jan 10, 2025
3187de5
chore: update dependencies
dr-orlovsky Jan 10, 2025
fde5e5a
support witness-output based seals
dr-orlovsky Jan 10, 2025
c75e1be
wip on invoicing
dr-orlovsky Jan 12, 2025
1bf8ca5
debug example
dr-orlovsky Jan 13, 2025
40a7415
example: update to newer auth token and wout formats
dr-orlovsky Jan 13, 2025
276d227
unify single-use seals
dr-orlovsky Jan 14, 2025
3bd0eb5
Merge pull request #274 from RGB-WG/refactor/consensus
dr-orlovsky Jan 15, 2025
9d6af65
runtime: separate runtime module
dr-orlovsky Jan 15, 2025
8ffe11c
update to use payment branch
dr-orlovsky Jan 24, 2025
74be135
payments workflows
dr-orlovsky Jan 18, 2025
1c59090
use PaymentScript type alias
dr-orlovsky Jan 25, 2025
6920e07
chore: fix clippy lints
dr-orlovsky Jan 25, 2025
cff6b11
ci: bump MSRV
dr-orlovsky Jan 25, 2025
80cc027
ci: remove past features
dr-orlovsky Jan 25, 2025
1ba38db
ci: temporarily disable codecov target requirements
dr-orlovsky Jan 25, 2025
c2870c8
test coinselect display/from_str
dr-orlovsky Jan 25, 2025
97f780a
psbt: avoid dependencies on bpstd when bp feature is not active
dr-orlovsky Jan 25, 2025
18df3d6
chore: fix use of bp feature in rgb-psbt from rgb-runtime crate
dr-orlovsky Jan 25, 2025
5a05fcc
ci: use latest wasm-pack version
dr-orlovsky Jan 25, 2025
2f51bcd
Merge pull request #279 from RGB-WG/payments
dr-orlovsky Jan 25, 2025
90ea1b7
chore: update dependencies
dr-orlovsky Jan 26, 2025
4ecdfd8
examples: improve .gitignore
dr-orlovsky Jan 26, 2025
a1f2aa8
complete custom payment workflow
dr-orlovsky Jan 26, 2025
136aeae
doc: improve Payments.md
dr-orlovsky Jan 27, 2025
c39d12e
chore: add check for missing change in payment script
dr-orlovsky Jan 27, 2025
9648aa2
fix: add taproot key only
crisdut Jan 27, 2025
df68d4f
debug invoicing
dr-orlovsky Jan 28, 2025
ff1393a
chore: update dependencies
dr-orlovsky Jan 28, 2025
e3850de
cli: use ContractRef where possible
dr-orlovsky Jan 28, 2025
e2fa6f3
Merge pull request #281 from crisdut/fix/derive-tap-key
dr-orlovsky Jan 28, 2025
6f414e0
chore: use new StateCalcError
dr-orlovsky Jan 28, 2025
3e0c8c8
fix payment script construction
dr-orlovsky Jan 29, 2025
1cd6d98
psbt: insert OP_RETURN output in the first position
dr-orlovsky Jan 29, 2025
12bec4c
fix seal resolution bug
dr-orlovsky Jan 29, 2025
9ad405e
use differentiated seal types
dr-orlovsky Jan 30, 2025
4d3f217
remove second generic argument for FileFile
dr-orlovsky Jan 30, 2025
7d3a13e
cli: add wallets sync
dr-orlovsky Jan 30, 2025
a8f59fb
Merge pull request #282 from RGB-WG/wtxoseal
dr-orlovsky Jan 30, 2025
93ab15e
fix wout assignment serde deserialization
dr-orlovsky Jan 30, 2025
7c8d6eb
fix pay-to-address payments
dr-orlovsky Jan 30, 2025
0208029
cli: add ability to create tapret wallets
dr-orlovsky Feb 2, 2025
155cdaa
cli: improve arguments
dr-orlovsky Feb 2, 2025
021bca7
cli: improve error messages
dr-orlovsky Feb 2, 2025
b18d7b5
cli: add wallets command, improve errors
dr-orlovsky Feb 3, 2025
9e13562
cli: refactor modules
dr-orlovsky Feb 3, 2025
64244ce
cli: improve command grouping
dr-orlovsky Feb 3, 2025
d5c46ac
cli: add wallet sync command
dr-orlovsky Feb 3, 2025
889da7c
cli: add wallet seals command
dr-orlovsky Feb 3, 2025
167653a
cli: improve panic messages
dr-orlovsky Feb 3, 2025
a6d9dd7
chore: update strict types with a patch
dr-orlovsky Feb 3, 2025
92018a2
cli: improve backtrace on a panic
dr-orlovsky Feb 7, 2025
450d35c
examples: do simple and advanced demo
dr-orlovsky Feb 7, 2025
60c9ee0
cli: support customizing PSBT version
dr-orlovsky Feb 7, 2025
7a5de97
cli: add finalize command
dr-orlovsky Feb 10, 2025
4300cfc
cli: always print state name
dr-orlovsky Feb 10, 2025
aacaaa5
cli: allow sync in seals command
dr-orlovsky Feb 10, 2025
26745e6
cli: improve wallet sync printouts
dr-orlovsky Feb 10, 2025
62491bc
chore: add log feature
dr-orlovsky Feb 11, 2025
fa37363
cli: fix missed transaction broadcasting
dr-orlovsky Feb 11, 2025
bc2b889
psbt: fix updating change seal on adding OP_RETURN output
dr-orlovsky Feb 11, 2025
2c87e7e
cli: improve panic messages
dr-orlovsky Feb 13, 2025
073d0f0
chore: update dependencies with fixes
dr-orlovsky Feb 13, 2025
259bda8
bp: fix non-updated change vout after adding opret
dr-orlovsky Feb 14, 2025
5bd42bf
chore: release v0.12.0-beta.5
dr-orlovsky Feb 16, 2025
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
Prev Previous commit
Next Next commit
complete accept and consign commands
dr-orlovsky committed Dec 15, 2024
commit 84ae82b91ec02ab2e673ba298687f989303aa67a
44 changes: 22 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 41 additions & 6 deletions cli/src/cmd.rs
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ use std::fs::File;
use std::path::PathBuf;
use std::str::FromStr;

use amplify::ByteArray;
use bpwallet::fs::FsTextStore;
use bpwallet::psbt::TxParams;
use bpwallet::{Network, Sats, Vout, Wpkh, XpubDerivable};
@@ -136,7 +137,13 @@ pub enum Cmd {
Wallets,

/// Create a new wallet
Create { name: String, descriptor: String },
Create {
/// Wallet name
name: String,

/// Extended pubkey descriptor
descriptor: String,
},

/// Print out a contract state
#[clap(alias = "s")]
@@ -186,6 +193,9 @@ pub enum Cmd {
/// Create a consignment transferring part of a contract state to another peer
#[clap(alias = "c")]
Consign {
/// Contract to use for the consignment
contract: ContractId,

/// List of tokens of authority which should serve as a contract terminals
#[clap(short, long)]
terminals: Vec<AuthToken>,
@@ -224,7 +234,6 @@ impl Args {
let wallet = TapretWallet::load(provider, true).expect("unable to load the wallet");
DirBarrow::with_tapret(self.seal, self.mound(), wallet)
}
_ => panic!("unsupported wallet type"),
};
// TODO: Sync wallet if needed
wallet.into()
@@ -263,11 +272,12 @@ impl Args {
Cmd::Create { name, descriptor } => {
let provider = self.wallet_provider(Some(name));
let xpub = XpubDerivable::from_str(descriptor).expect("Invalid extended pubkey");
let noise = xpub.xpub().chain_code().to_byte_array();
match self.seal {
SealType::BitcoinOpret => {
OpretWallet::create(
provider,
Opret::new_unfunded(Wpkh::from(xpub)),
Opret::new_unfunded(Wpkh::from(xpub), noise),
self.network,
true,
)
@@ -276,7 +286,7 @@ impl Args {
SealType::BitcoinTapret => {
TapretWallet::create(
provider,
Tapret::key_only_unfunded(xpub),
Tapret::key_only_unfunded(xpub, noise),
self.network,
true,
)
@@ -338,8 +348,33 @@ impl Args {
}
}

Cmd::Consign { .. } => todo!(),
Cmd::Accept { .. } => todo!(),
Cmd::Consign {
contract,
terminals,
output,
} => {
let mut mound = self.mound();
match self.seal {
SealType::BitcoinOpret => {
mound.bc_opret.consign_to_file(*contract, terminals, output)
}
SealType::BitcoinTapret => mound
.bc_tapret
.consign_to_file(*contract, terminals, output),
_ => panic!("unsupported wallet type"),
}
.expect("unable to consign contract");
}

Cmd::Accept { input } => {
let mut mound = self.mound();
match self.seal {
SealType::BitcoinOpret => mound.bc_opret.accept_from_file(input),
SealType::BitcoinTapret => mound.bc_opret.accept_from_file(input),
_ => panic!("unsupported wallet type"),
}
.expect("unable to accept a consignment");
}

_ => todo!(),
}
6 changes: 3 additions & 3 deletions examples/token.rs
Original file line number Diff line number Diff line change
@@ -23,13 +23,11 @@

#[macro_use]
extern crate amplify;
#[macro_use]
extern crate strict_types;

use hypersonic::Schema;
use rgb::bitcoin::file::OmniBarrow;

fn main() {
/*
let mut alice = OmniBarrow::load("");
let seal1 = alice.next_seal_pub();
@@ -87,4 +85,6 @@ fn main() {
// Locker, token (stash) and trace are append-only logs
// Only state, wallet (alice) must persist in memory
*/
todo!()
}
10 changes: 7 additions & 3 deletions src/descriptor.rs
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ use core::fmt::{self, Display, Formatter};
use std::collections::HashMap;
use std::ops::{Deref, DerefMut};

use amplify::{Wrapper, WrapperMut};
use amplify::{Bytes32, Wrapper, WrapperMut};
use bpstd::dbc::opret::OpretProof;
use bpstd::dbc::tapret::{TapretCommitment, TapretProof};
use bpstd::seals::TxoSeal;
@@ -101,13 +101,15 @@ impl<D: dbc::Proof> Display for SealDescr<D> {
pub struct Opret<K: DeriveSet = XpubDerivable> {
pub descr: StdDescr<K>,
pub seals: SealDescr<OpretProof>,
pub noise: Bytes32,
}

impl<K: DeriveSet> Opret<K> {
pub fn new_unfunded(descr: impl Into<StdDescr<K>>) -> Self {
pub fn new_unfunded(descr: impl Into<StdDescr<K>>, noise: impl Into<[u8; 32]>) -> Self {
Self {
descr: descr.into(),
seals: empty!(),
noise: noise.into().into(),
}
}
}
@@ -162,6 +164,7 @@ pub struct Tapret<K: DeriveXOnly = XpubDerivable> {
pub tr: Tr<K>,
pub tweaks: BTreeMap<Terminal, BTreeSet<TapretCommitment>>,
pub seals: SealDescr<TapretProof>,
pub noise: Bytes32,
}

impl<K: DeriveXOnly> Display for Tapret<K> {
@@ -196,11 +199,12 @@ impl<K: DeriveXOnly> Display for Tapret<K> {
}

impl<K: DeriveXOnly> Tapret<K> {
pub fn key_only_unfunded(internal_key: K) -> Self {
pub fn key_only_unfunded(internal_key: K, noise: impl Into<[u8; 32]>) -> Self {
Self {
tr: Tr::KeyOnly(TrKey::from(internal_key)),
tweaks: empty!(),
seals: empty!(),
noise: noise.into().into(),
}
}

9 changes: 7 additions & 2 deletions src/wallet.rs
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
// or implied. See the License for the specific language governing permissions and limitations under
// the License.

use amplify::Bytes32;
use bpstd::seals::Noise;
use bpstd::{Network, XpubDerivable};
use bpwallet::{Layer2Empty, NoLayer2, Wallet, WalletCache, WalletData, WalletDescr};
@@ -36,7 +37,9 @@ use crate::descriptor::{Opret, Tapret};
#[wrapper_mut(DerefMut)]
pub struct OpretWallet(Wallet<XpubDerivable, Opret<XpubDerivable>, NoLayer2>);

impl WalletProvider for OpretWallet {}
impl WalletProvider for OpretWallet {
fn noise_seed(&self) -> Bytes32 { self.noise }
}
impl OpretProvider for OpretWallet {}

impl OpretWallet {
@@ -75,7 +78,9 @@ impl OpretWallet {
#[wrapper_mut(DerefMut)]
pub struct TapretWallet(Wallet<XpubDerivable, Tapret<XpubDerivable>, NoLayer2>);

impl WalletProvider for TapretWallet {}
impl WalletProvider for TapretWallet {
fn noise_seed(&self) -> Bytes32 { self.noise }
}
impl TapretProvider for TapretWallet {}

impl TapretWallet {