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

feat: P-926 support other 4 bitcoin networks for brc20 contract #2907

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

higherordertech
Copy link
Contributor

@higherordertech higherordertech commented Jul 18, 2024

Context

as title

Labels

Please apply following PR-related labels when appropriate:

  • C0-breaking: if your change could break the existing client, e.g. API change, critical logic change
  • C1-noteworthy: if your change is non-breaking, but is still worth noticing for the client, e.g. reference code improvement

How (Optional)

Testing Evidences

Please attach any relevant evidences if applicable

Postive case:

./bin/litentry-cli trusted -d request-vc did:litentry:bitcoin:0x027325c885ecad783cf4f0dd7fb6ea937c19e113c3c8eb4cfd0c732aacb71ce9a4 -a "dynamic 0000000000000000000000000000000000000003 000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000047261747300000000000000000000000000000000000000000000000000000000"

identity: Bitcoin(Address33)
nonce: 0
assertions: [Dynamic(DynamicParams { smart_contract_id: 0x0000000000000000000000000000000000000003, smart_contract_params: Some(BoundedVec([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 114, 97, 116, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1024)), return_log: false })]
----Generated VC-----
{"@context":["https://www.w3.org/2018/credentials/v1","https://w3id.org/security/suites/ed25519-2020/v1"],"id":"0xccb621aa1ee7896d603765fe0b38f6ca23f4fc5a682e88f1440b673690e4feb0","type":["VerifiableCredential"],"credentialSubject":{"id":"did:litentry:bitcoin:0x027325c885ecad783cf4f0dd7fb6ea937c19e113c3c8eb4cfd0c732aacb71ce9a4","description":"The amount of a particular token you are holding","type":"Token Holding Amount","assertionText":"","assertions":[{"and":[{"src":"$token","op":"==","dst":"rats"},{"src":"$holding_amount","op":">=","dst":"2000000"}]}],"values":[true],"endpoint":"http://localhost:9933/"},"issuer":{"id":"did:litentry:substrate:0xd1903fbb8a5cac3de73c70f33a980e41b938e9a0193f71c353019fd27626d40d","name":"Litentry TEE Worker","mrenclave":"AjXWy3vvBSknZJf6NBQ3yV1LriVZQ2DAXEfEgFf5DTjV","runtimeVersion":{"parachain":9183,"sidechain":109}},"issuanceDate":"2024-07-18T08:06:49.849373281+00:00","parachainBlockNumber":67,"sidechainBlockNumber":128,"proof":{"created":"2024-07-18T08:06:49.849590772+00:00","type":"Ed25519Signature2020","proofPurpose":"assertionMethod","proofValue":"d0dde331e22ca319ac4c00ce029e239c39eac6da829f3550451e718619efc5fd2080cfeed03ba090f248afb1109140c715d7869911200f69e652649d80ff5901","verificationMethod":"0xa2ff08c95ffb86ae1eeb7b35582f0d2b6bfc6775cd780c4b03f58f72ec6c95f8"},"credentialSchema":{"id":"https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-1-0.json","type":"JsonSchemaValidator2018"}}

Negative case:
./bin/litentry-cli trusted -d request-vc did:litentry:bitcoin:0x02e8c39e82aaaa143c3def8d3c7084a539b227244ac9067c3f7fc86cb73a0b7aed -a "dynamic 0000000000000000000000000000000000000003 000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000047261747300000000000000000000000000000000000000000000000000000000"

identity: Bitcoin(Address33)
nonce: 0
assertions: [Dynamic(DynamicParams { smart_contract_id: 0x0000000000000000000000000000000000000003, smart_contract_params: Some(BoundedVec([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 114, 97, 116, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1024)), return_log: false })]
----Generated VC-----
{"@context":["https://www.w3.org/2018/credentials/v1","https://w3id.org/security/suites/ed25519-2020/v1"],"id":"0x5f18937abbe9a499b79a3751aaaba8cd8d6c89ddbe680f61e96388c26abba0fb","type":["VerifiableCredential"],"credentialSubject":{"id":"did:litentry:bitcoin:0x02e8c39e82aaaa143c3def8d3c7084a539b227244ac9067c3f7fc86cb73a0b7aed","description":"The amount of a particular token you are holding","type":"Token Holding Amount","assertionText":"","assertions":[{"and":[{"src":"$token","op":"==","dst":"rats"},{"src":"$holding_amount","op":">=","dst":"0"},{"src":"$holding_amount","op":"<","dst":"1"}]}],"values":[false],"endpoint":"http://localhost:9933/"},"issuer":{"id":"did:litentry:substrate:0xd1903fbb8a5cac3de73c70f33a980e41b938e9a0193f71c353019fd27626d40d","name":"Litentry TEE Worker","mrenclave":"AjXWy3vvBSknZJf6NBQ3yV1LriVZQ2DAXEfEgFf5DTjV","runtimeVersion":{"parachain":9183,"sidechain":109}},"issuanceDate":"2024-07-18T08:07:03.695510498+00:00","parachainBlockNumber":69,"sidechainBlockNumber":131,"proof":{"created":"2024-07-18T08:07:03.695695987+00:00","type":"Ed25519Signature2020","proofPurpose":"assertionMethod","proofValue":"6aa3d2f00665e61b2d1e8b0eeb621be27abbd54815f4a2dd27a3098d34055c39983b70a4304a3aa10a208def548f581fb0a7f0adf6d8eb17a4c212c55ab0d003","verificationMethod":"0xa2ff08c95ffb86ae1eeb7b35582f0d2b6bfc6775cd780c4b03f58f72ec6c95f8"},"credentialSchema":{"id":"https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-1-0.json","type":"JsonSchemaValidator2018"}}

Copy link

linear bot commented Jul 18, 2024

@higherordertech higherordertech force-pushed the support-rest-btc-networks-for-brc20-contract branch from d54a065 to 72bd1fe Compare July 18, 2024 05:59
Copy link
Contributor

@silva-fj silva-fj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@higherordertech higherordertech force-pushed the support-rest-btc-networks-for-brc20-contract branch from 72bd1fe to f9aeedf Compare July 18, 2024 23:35
@higherordertech higherordertech enabled auto-merge (squash) July 18, 2024 23:36
@higherordertech higherordertech merged commit 6d7bc4d into dev Jul 19, 2024
32 checks passed
@Kailai-Wang Kailai-Wang deleted the support-rest-btc-networks-for-brc20-contract branch July 19, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants