Crates.io | ckb_ssri_sdk |
lib.rs | ckb_ssri_sdk |
version | 0.1.0 |
source | src |
created_at | 2024-12-10 23:27:16.470104 |
updated_at | 2024-12-10 23:27:16.470104 |
description | SDK for implementing SSRI-compliant smart contracts on CKB |
homepage | |
repository | https://github.com/Alive24/ckb_ssri_sdk |
max_upload_size | |
id | 1479159 |
size | 30,070 |
[EN/CN] Script-Sourced Rich Information - 来源于 Script 的富信息: General introduction to SSRI.
ssri-test
: First prototype of SSRI-Compliant contract.
ssri-server
: Server for calling SSRI methods.
Script Sourced Rich Information
; it is a protocol for strong bindings of relevant information and conventions to the Script itself on CKB. For more information, please read [EN/CN] Script-Sourced Rich Information - 来源于 Script 的富信息>.Intent
of running the script) (e.g., minting UDT
, transferring
) and build relevant validation logics within the scope of the corresponding method.UDT
, UDTExtended
, UDTPausable
) in combinations, generic users and devs would be able to quickly understand and organize functionalities of contracts as well as the relevant adaptations / integrations in dApps , especially in use cases involving multiple distinct contracts (and very likely from different projects) within same transactions.ckb_ssri_sdk
CCC
and ckb_ssri_cli
) of SSRI public traits.ckb-cinnabar
for easier deployment and migration.argv[0]
and the arguments at argv[1..]
.
SSRI
which consists of:
SSRI.version() -> u8
SSRI.get_methods(offset: u64, limit: u64) -> Vec<Bytes8>
SSRI.has_methods(methods: Vec<Bytes8>) -> Vec<bool>
#[ssri_module]
macro and #[ssri_method]
attribute, methods can be automatically exposed in the namespace defined by trait name.ckb_ssri_sdk::public_module_traits
in the SSRI-Compliant Smart Contract, infrastructures would be able to provide richer information off-chain as well for all kinds of purposes based on the SSRI protocol.pausable-udt
is a real production level contract (instead of a pseudo-project) that exemplifies the usage of SSRI.
proc-macros
and Implement SSRI Traitsstruct
that can be sent to directly to RPC. If transaction is set to true, the required level is automatically set to Chain;ckb-cinnabar deploy --contract-name pausable-udt --tag transaction.v241112 --payer-address ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqtxe0gs9yvwrsc40znvdc6sg4fehd2mttsngg4t4 --type-id
ckb-cinnabar migrate --contract-name pausable-udt --from-tag v241030.1 --to-tag v241030.2
With SSRI-server and SSRI-VM, users, devs, and admins would have the ability to obtain Script-Source Rich Information directly from the script by calling SSRI methods via SSRI-server (which can be both run locally and for public usage).
The returned information can be just data for display, or a transaction object that can be sent to a CKB RPC, without the need of extra implementations on either dApps or backend applications.
echo '{
"id": 2,
"jsonrpc": "2.0",
"method": "run_script",
"params": ["<TxHash of the target Cell>", <Index>, [<Bytes of methods path>, <...argv>]]
}'
ckb_ssri_cli
Due to the limitations of ckb_testtools
, it is recommended to test the same SSRI-Compliant Contract on two level:
ckb_testtools
ckb_ssri_cli
against the latest deployment.