rgb-wg / rgb-schemata Goto Github PK
View Code? Open in Web Editor NEWStandard RGB schemata and schema compiler
License: Apache License 2.0
Standard RGB schemata and schema compiler
License: Apache License 2.0
Main challenge: implement proper AluVM verification scripts
--> src/lib.rs:60:41
|
60 | fn resolve_height(&mut self, _: &XWitnessId) -> Result<WitnessAnchor, Self::Error> {
| ^^^^^^^^^^^
| |
| expected `XChain<rgbstd::Txid>`, found `&XChain<rgbstd::Txid>`
| help: change the parameter type to match the trait: `XChain<rgbstd::Txid>`
|
= note: expected signature `fn(&mut DumbResolver, XChain<_>) -> Result<_, _>`
found signature `fn(&mut DumbResolver, &XChain<_>) -> Result<_, _>`
I'm trying to work with the RGB21 workflow in version 0.11. However, I am experiencing validation failures after the acceptance of the contract, and I'm not quite sure about the token index to set during the issuance and the amount to set in the invoice. I have tried different combinations, but none of them seem to work.According to convention, both of these should be set to 1.
Currently it's possible to issue an UDA contract with an asset owner but no tokens. But the assetOwner
field wants a seal and an allocation, and the latter is defined as struct Allocation(TokenIndex, OwnedFraction)
.
If the asset has no tokens I don't see why the allocation should refer to a token index that doesn't exist.
I would change the interface definition from assetOwner*
and tokens*
to assetOwner+
and tokens+
. But I remember this was once said (LNP-BP/LNPBPs#154 (comment)):
Genesis now can just produce an issue right and not tokens (i.e. they may be issued later). Thus also a global type change and Issue parameters. This makes RGB21 compatible with RGB20
Therefore I'm ok keeping assetOwner*
and tokens*
, but IMO we should add a check that prevents setting an assetOwner
without defining also tokens
. Any other solution that removes this inconsistency will also be fine.
cargo run --example rgb20
results in thread 'main' panicked at 'invalid asset amount: AssetTagUnknown(AssignmentType(4000))', examples/rgb20.rs:68:10
cargo run --example rgb25
in thread 'main' panicked at 'invalid asset amount: AssetTagUnknown(AssignmentType(4000))', examples/rgb25.rs:86:10
This was introduced after commit 943c65d, before both examples worked fine.
assetOwner
not displayedcargo run --example rgb21
with examples/rgb21.rs
modified by adding my own outpoint under beneficiary
and setting testnet
to true
in verified_contract
.validate
call, the stdout only shows (naming=(ticker=("TEST"), name=("Test uda"), details=~), precision=0)
at the end of the output where I would also expect the owner to be displayed as is the case with the RGB20 example.rgb state <contract_id> RGB21
the full output is this:
Global:
spec := (naming=(ticker=("TEST"), name=("Test uda"), details=~), precision=0)
created := (1700145223)
terms := ("")
tokens := (index=(2), ticker=~, name=~, details=~, preview=1((type=(type=("text"), subtype=~, charset=~), data=0x0000)), media=~, attachments={}, reserves=~)
Owned:
assetOwner:
assetOwner
is also not shown with the provided examples/rgb21-simplest.contract.rgb
running rgb state
Error: unsupported value `2` for enum `ContainerVer` encountered during decode operation
when rgb import
a contract created after the recent changes (after commit 943c65d). I assume due to rgb-contracts not yet being updated to contract version 2.rgb transfer
errorrgb transfer
shows Error: state provided via PSBT inputs is not sufficient to cover invoice state requirements.
rgb
aliases for different data directories:
$ rgb3 import examples/rgb21-old.contract.rgb
Contract rgb:2uMxdEm-oeF1WC9Hb-t4cw7YJVt-hVZdGoCdS-RnYoKXAXj-5h4pgLs imported to the stash
$ c21="rgb:2uMxdEm-oeF1WC9Hb-t4cw7YJVt-hVZdGoCdS-RnYoKXAXj-5h4pgLs"
$ rgb4 import examples/rgb21-old.contract.rgb
Contract rgb:2uMxdEm-oeF1WC9Hb-t4cw7YJVt-hVZdGoCdS-RnYoKXAXj-5h4pgLs imported to the stash
$ rgb4 invoice $c21 RGB21 1 tapret1st:b82a11ea842e99508636d59a3338d932d02618fa28a78123b1df591b20b8eeb0:0
rgb:2uMxdEm-oeF1WC9Hb-t4cw7YJVt-hVZdGoCdS-RnYoKXAXj-5h4pgLs/RGB21/1+utxob:2nc7Ab4-PYTqVQfZS-hrzKmfgn3-kcnYE1rog-MN4vggmW1-PuiLVfm
$ btc-cold construct -k "output(0) TAPRET(0)" -i "b4c1b479bdc64ab637f408996ebc20288ab6192f329b87df56f3429327dd2d05:1 /0/0" ~/Library/Application\ Support/Descriptor\ Wallet\ Testnet/w3.wallet transfer21_rgb3_to4.psbt 10
Wallet descriptor:
tr([39908a2e/86h/1h/0h]tpubDCc6J2ZLbYqEqWiFS893Z8y5ckHRV2HRj7nqyh5t6GpPEJcPUTgAdoxz2yumZmHLKbWCCbLcdp9C3x6fi38k9Pv2nHaGowv1v42gTxwFtnQ/*/*)#kmzzt3ac
Re-scanning network testnet using electrum.blockstream.info:60001 ... done
PSBT: 70736274ff01005e0200000001052ddd279342f356df879b322f19b68a2820bc6e9908f437b64ac6bd79b4c1b40100000000ffffffff01fe510000000000002251208cd3830b00d4f35eb9dd82b21bd6356070ad55263bf464878caf0caba89374bc000000004f01043587cf034f0903b580000000cab6430d20d8ba3fc0e673edc4ac6f1950dd98e6ea0f325cbb66b909aa94a50d028f9abe2069ff69370b2793ae50cdb3b336a0159e9f46b8c506650a5a6910f3061039908a2e56000080010000800000008000010089010000000196b1fda2828defdb4dfba5835e37c6ab44b77f7471574edc6bd21fddd1064a380000000000ffffffff02ba851a0000000000225120d5aa23f70c061c526ab8232ef4bc19bcdbc2248f2ef3cb68629c068d7c59747c08520000000000002251204a3e2d16cd2d4c82fddef2c613718ae8836f7dcaac1aa9be9e4a48d541a3d9ae00000000010304010000002116efac612b72e0a9f003967a77b19961dfd687a6c61c7b174a41827d2edc0dd700190039908a2e5600008001000080000000800000000000000000011720efac612b72e0a9f003967a77b19961dfd687a6c61c7b174a41827d2edc0dd700002202032ac2addf1867f615237399510618068275f17f246011b189e230489243d4c6041839908a2e56000080010000800000008001000000000000000105202ac2addf1867f615237399510618068275f17f246011b189e230489243d4c60409fc06544150524554000000
$ rgb3 transfer transfer21_rgb3_to4.psbt rgb:2uMxdEm-oeF1WC9Hb-t4cw7YJVt-hVZdGoCdS-RnYoKXAXj-5h4pgLs/RGB21/1+utxob:2nc7Ab4-PYTqVQfZS-hrzKmfgn3-kcnYE1rog-MN4vggmW1-PuiLVfm transfer21_rgb3_to4.rgb
Error: state provided via PSBT inputs is not sufficient to cover invoice state requirements.
Can we now add rgb-schemata = { version = "0.11.0-beta.4" } to the Cargo.toml to import related data structure?
I saw the readme file still the 0.10
error[E0432]: unresolved import `rgbstd::interface::ContractClass`
--> examples/rgb20.rs:9:25
|
9 | use rgbstd::interface::{ContractClass, FilterIncludeAll, FungibleAllocation, Rgb20};
| ^^^^^^^^^^^^^
| |
| no `ContractClass` in `interface`
| help: a similar name exists in the module: `ContractIface`
error[E0599]: no function or associated item named `iface` found for struct `Rgb20` in the current scope
--> examples/rgb20.rs:54:31
|
54 | stock.import_iface(Rgb20::iface()).unwrap();
| ^^^^^ function or associated item not found in `Rgb20`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 + use rgbstd::interface::IfaceClass;
|
error[E0599]: no function or associated item named `schema` found for struct `NonInflatableAsset` in the current scope
--> examples/rgb20.rs:55:45
|
55 | stock.import_schema(NonInflatableAsset::schema()).unwrap();
| ^^^^^^ function or associated item not found in `NonInflatableAsset`
|
note: if you're trying to build a new `NonInflatableAsset` consider using one of the following associated functions:
NonInflatableAsset::testnet
NonInflatableAsset::testnet_det
--> /Users/matrix/Codes/github/rgb-schemata/src/nia.rs:161:5
|
161 | / pub fn testnet(
162 | | ticker: &str,
163 | | name: &str,
164 | | details: Option<&str>,
165 | | precision: Precision,
166 | | ) -> Result<Self, InvalidIdent> {
| |___________________________________^
...
171 | / pub fn testnet_det<C: IssuerClass>(
172 | | ticker: &str,
173 | | name: &str,
174 | | details: Option<&str>,
... |
177 | | asset_tag: AssetTag,
178 | | ) -> Result<Self, InvalidIdent> {
| |___________________________________^
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 + use rgbstd::interface::IssuerClass;
|
error[E0599]: no function or associated item named `main_iface_impl` found for struct `NonInflatableAsset` in the current scope
--> examples/rgb20.rs:56:49
|
56 | stock.import_iface_impl(NonInflatableAsset::main_iface_impl()).unwrap();
| ^^^^^^^^^^^^^^^ function or associated item not found in `NonInflatableAsset`
|
note: if you're trying to build a new `NonInflatableAsset` consider using one of the following associated functions:
NonInflatableAsset::testnet
NonInflatableAsset::testnet_det
--> /Users/matrix/Codes/github/rgb-schemata/src/nia.rs:161:5
|
161 | / pub fn testnet(
162 | | ticker: &str,
163 | | name: &str,
164 | | details: Option<&str>,
165 | | precision: Precision,
166 | | ) -> Result<Self, InvalidIdent> {
| |___________________________________^
...
171 | / pub fn testnet_det<C: IssuerClass>(
172 | | ticker: &str,
173 | | name: &str,
174 | | details: Option<&str>,
... |
177 | | asset_tag: AssetTag,
178 | | ) -> Result<Self, InvalidIdent> {
| |___________________________________^
error[E0599]: no function or associated item named `iface` found for struct `Rgb20` in the current scope
--> examples/rgb20.rs:61:64
|
61 | let contract = stock.contract_iface_id(contract_id, Rgb20::iface().iface_id()).unwrap();
| ^^^^^ function or associated item not found in `Rgb20`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 + use rgbstd::interface::IfaceClass;
|
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `rgb-schemata` (example "rgb20") due to 5 previous errors
When encountering a validation error the state type ID of the field having the error is printed out. This information is useful for debugging, but would be even more if all fields had different ID numbers.
Currently this is not the case. For example the UDA schema has the fields GS_NOMINAL
, OS_ASSET
and TS_TRANSFER
all with the same ID (2100
). Since by always having different IDs I see pros and no cons, I propose to always have them different.
Cargo.toml
[patch.crates-io]
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "v0.11" }
rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "v0.11" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "v0.11" }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.