- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在构建一个需要多个 CorDapps 的应用程序;我们就叫他们 LibCorDapp 和 AppCorDapp , 其中 AppCorDapp 取决于 LibCorDapp (就像 CorDapp 可能依赖于 Accounts 或 Tokens SDK)。
LibCorDapp - 合约
这个 CorDapp 的目的是定义一个状态和合约的对象模型,可以开箱即用,但也可以派生出来以创建更明确的状态和合约类型。
build.gradle
cordapp {
targetPlatformVersion cordapp_platform_version
minimumPlatformVersion cordapp_platform_version
contract {
name cordapp_contract_name
vendor cordapp_vendor_name
licence cordapp_license
versionId cordapp_version_id
}
signing {
enabled = cordapp_signing_enabled
}
}
dependencies {
implementation "$kotlin_group:kotlin-stdlib-jdk8:$kotlin_version"
cordaCompile "$corda_group:corda-core:$corda_release_version"
testRuntimeOnly "$junit_group:junit-jupiter-engine:$junit_version"
testImplementation "$junit_group:junit-jupiter-api:$junit_version"
testImplementation "$kotlin_group:kotlin-test:$kotlin_version"
testImplementation "$corda_group:corda-node-driver:$corda_release_version"
}
示例状态
package com.example.libcordapp.contract
@BelongsToContract(ExampleContract::class)
open class ExampleState<T : Any>(
override val participants: List<AbstractParty> = emptyList(),
val value: T
) : ContractState { ... }
示例契约(Contract)
package com.example.libcordapp.contract
open class ExampleContract {
final override fun verify(tx: LedgerTransaction) { ... }
protected open fun onVerifyCreate(tx: LedgerTransaction, signers: Set<PublicKey>) = Unit
}
注意
ExampleState
之间的关系和
ExampleContract
.他们都是
open
, 和
ExampleContract
包含一个可覆盖的函数,允许派生类在创建时指定额外的合约逻辑。
ExampleState
的状态和契约(Contract)。和
ExampleContract
.
cordapp {
targetPlatformVersion cordapp_platform_version
minimumPlatformVersion cordapp_platform_version
workflow {
name cordapp_workflow_name
vendor cordapp_vendor_name
licence cordapp_license
versionId cordapp_version_id
}
signing {
enabled = cordapp_signing_enabled
}
}
dependencies {
implementation "$kotlin_group:kotlin-stdlib-jdk8:$kotlin_version"
cordaCompile "$corda_group:corda-core:$corda_release_version"
cordapp project(":libcordapp-contract")
testRuntimeOnly "$junit_group:junit-jupiter-engine:$junit_version"
testImplementation "$junit_group:junit-jupiter-api:$junit_version"
testImplementation "$kotlin_group:kotlin-test:$kotlin_version"
testImplementation "$corda_group:corda-node-driver:$corda_release_version"
}
示例流程
package com.example.libcordapp.workflow
class ExampleFlow(val state: ExampleState) : FlowLogic<SignedTransaction>() {
@Suspendable
override fun call(): SignedTransaction {
val tx = with(TransactionBuilder(notary)) {
addOutputState(state)
addCommand(ExampleContract.Issue, signers)
}
}
}
请注意,我没有明确定义输出状态的合约 ID,因为它应该在运行时为每个合约/状态对确定。
cordapp {
targetPlatformVersion cordapp_platform_version
minimumPlatformVersion cordapp_platform_version
contract {
name "Test CorDapp Contract"
vendor cordapp_vendor_name
licence cordapp_license
versionId cordapp_version_id
}
signing {
enabled = cordapp_signing_enabled
}
}
dependencies {
implementation "$kotlin_group:kotlin-stdlib-jdk8:$kotlin_version"
implementation "$corda_group:corda-core:$corda_release_version"
cordapp project(":libcordapp-contract")
testRuntimeOnly "$junit_group:junit-jupiter-engine:$junit_version"
testImplementation "$junit_group:junit-jupiter-api:$junit_version"
testImplementation "$kotlin_group:kotlin-test:$kotlin_version"
testImplementation "$corda_group:corda-node-driver:$corda_release_version"
}
GreetingState
package com.example.appcordapp.contract
@BelongsToContract(GreetingContract::class)
class GreetingState(
participants: List<AbstractParty> = emptyList()
value: String = "Hello, World!"
) : ExampleState<String>(participants, value)
问候契约(Contract)
package com.example.appcordapp.contract
class GreetingContract : ExampleContract {
override fun onVerifyCreate(tx: LedgerTransaction, signers: Set<PublicKey>) = requireThat { ... }
}
请注意
GreetingContract
扩展
ExampleContract
和
GreetingState
扩展
ExampleState
以及定义
GreetingContract
因为它是相关契约(Contract),所以在创建
GreetingState
时使用
ExampleFlow
它应该拿起这份契约(Contract)。
ExampleFlow
与我派生的状态/契约(Contract)对。
cordappsForAllNodes = listOf(
TestCordapp.findCordapp("com.example.libcordapp.contract"),
TestCordapp.findCordapp("com.example.libcordapp.workflow"),
TestCordapp.findCordapp("com.example.appcordapp.contract")
)
在尝试创建
GreetingClaim
使用
ExampleFlow
...
ExampleFlow(GreetingClaim(participants = listOf(partyA)))
...我得到以下异常:
java.lang.IllegalArgumentException: There is more than one CorDapp containing the package com.example.appcordapp.contract on the classpath [/.../libcordapp-contract-0.1.jar, /.../libcordapp-workflow-0.1.jar]. Specify a package name which is unique to the CorDapp.
最佳答案
阅读有关 dependencies 的官方文档,并阅读 this answer ;建议你改cordapp project(":libcordapp-contract")
里面 build.gradle
的 AppCorDapp - Contract
至cordaCompile project(":libcordapp-contract")
.
在您当前的依赖设置中(即使用 cordapp
),libcordapp-contract
被包含在您的 CorDapp 的 jar 文件中,因此当您运行测试时,可以在 2 个位置找到该包:LibCorDapp - Contract
和 AppCorDapp - Contract
CorDapps;如果将依赖项更改为 cordaCompile
,该包将只包含在LibCorDapp - Contract
的jar文件中CorDapp。
关于kotlin - Corda - 包含该软件包的 CorDapp 不止一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63781659/
这是先前回答的后续问题 legal prose Joel 的问题。(根据要求创建了单独的问题) @LegalProseReference(uri = "foo.bar.com/my-legal-doc
我想在数据库中创建具有唯一 ID 的状态。有我的州代码 data class SampleState( val partyA: Party, val partyB: Party,
Corda introduction to consensus说“唯一性共识是由公证人提供的。” 我们是不是说,如果没有公证人,A 有可能说服 B 将一笔涉及状态 X 作为输入的交易提交到其账本,并同
在 Corda 中,有没有一种方法可以在不花费的情况下引用交易中未花费的状态?目的是允许合约使用状态中的某些信息作为 verify 方法的一部分。 最佳答案 引用状态将添加到将于今年晚些时候发布的 C
我们知道 Corda 并不是一个真正的区 block 链系统,尽管它使用了一些受区 block 链启发的技术。 所以我有一个问题:Corda 能否像比特币或以太坊那样抵抗扭曲或操纵? Corda是否适
有人可以解释一下 Corda 中的法律散文是什么吗?我知道它是一个文档,用于解决冲突,但我没有找到任何信息。它是如何与智能合约联系起来的? 最佳答案 一个 Contract类可以用 @LegalPro
要获得状态,我可以使用 Vault,但是交易呢?例如,我如何通过 txHash 获取它们? CordaRPCOps 是否可以做到这一点,有 internalVerifiedTransactionsSn
在 Cordapp 中,我想更新第二条链作为正常交易的一部分。由于数据在具有不同参与者的两个不同状态中被跟踪,因此这需要在两个事务中完成。 出于讨论的目的,我们有两方 A 和 B。A 向 B 发起事务
在闭环网络中,当各方转移 Assets 时,与之相关的交易也会共享。因此,另一方将了解我过去与该 Assets 交易的所有信息,尤其是在现金或证券的情况下。这实际上是一个隐私问题。此外,由于它是一个私
目前我有 4 个节点 A、B、C 和 D,它们在同一个 Corda 网络中相互连接。 如果我想从网络中删除节点 D,推荐的方法是什么? 因为现在如果我停止节点 D,另一个节点将显示它无法连接到节点 D
最近,我一直在研究Corda中合同命令的安全性和漏洞方面。对于某些合同命令约束是否应该严格或者是否应该放宽以允许不同输入,输出和命令的事务组合引起了争论。 问题是,尽管我看到了允许进行交易组合的好处,
目前我们计划有一个“草稿”版本的合约,不会发送给交易对手,发起人可以在发送到网络之前进行任何更改,因此这应该是一个“未共享的事实”。正如我们所知 Corda 和 vault 用于共享事实,所以在这里我
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 5 年前。 Improve this qu
我已经用 PostgreSQL 运行 Corda。 Corda 如何扩展以与其他数据库一起使用?将数据库驱动程序添加为 Gradle 依赖项并尝试连接到其他数据库是否足够? 最佳答案 Corda 使用
谁能给我一些示例代码,说明如何在 Corda 流中获取 JDBC 连接并执行一些任意 SQL?我想执行一些像这样的 SQL,并且 VaultCustomQueryCriteria 类将无法生成它(据我
在 macOS Mojave 10.14.1 中启动 ./build/nodes/deployNodes 时,终端会打开但不会启动与 deployNodes 中定义的每个节点对应的选项卡> Gradl
只是想知道单个 Corda 节点是否可以像比特币那样支持多个帐户。 我在讨论 https://discourse.corda.net/t/can-you-have-a-corda-identity-a
我想存储一个大小为194个字符及以上的字符串数据。当我尝试存储这样的字符串时,它正在执行流程并且正在创建状态对象,但在服务器端它抛出异常,如下所示: Caused by: net.corda.cor
以下流测试曾经在 Corda 3 中工作... @Test fun `can ping counterparties`() { val acceptorFlowFutures = listOf
如果 R3 清算,Corda 会怎样?谁是 Corda 保持其主要分类账分散的主要公证人? Corda 是否有可能影响历史账本状态并更改交易以适应它们? 最佳答案 没有“Corda 网络”这样的东西。
我是一名优秀的程序员,十分优秀!