Skip to content
Discussions/App Development/一些关于config-local.yaml 的问题 (Some questions about daml-for-fabric config.yaml)Forum ↗

一些关于config-local.yaml 的问题 (Some questions about daml-for-fabric config.yaml)

App Development22 posts826 views31 likesLast activity Jul 2021
UI
uid10086OP
Jun 2021

关于驱动daml-on-fabric 使用中遇到了以下问题:
配置文件config-local.yaml 中的相关参数根据 注释提示 相应置空之后发现依然无法正确部署到其他fabric网络中错误如下: 我配置了现有网络中的channel(ntchannel)
image

BE
bernhard
Jun 2021

Hi @uid10086 , welcome to the forum. I don’t speak mandarin so I used Google Translate and got this (posting for everyone else’s benefit):

The following problems have been encountered in the use of the driver daml-on-fabric: The relevant parameters in the configuration file config-local.yaml are prompted according to the comments. After the corresponding blanking, it is still unable to be deployed to other fabric networks. The error is as follows: I configured the channel (ntchannel) in the existing network

Could you post the versions of all the dependencies listed on the daml-for-fabric readme page that you have installed, please? And how exactly are you running this? Are you following some guide or example?

UI
uid10086
Jun 2021
bernhard:

welcome to the forum. I don’t speak mandarin so I used Google Translate and got this (posting for everyone else’s benefit):

The following problems have been encountered in the use of the driver daml-on-fabric: The relevant parameters in the configuration file config-local.yaml are prompted according to the comments. After the corresponding blanking, it is still unable to be deployed to other fabric networks. The error is as follows: I configured the channel (ntchannel) in the existing network

Could you post the versions of all the dependencies listed on the daml-for-fabric readme page that you have installed, please? And how exactly are you running this? Are you following some guide or example?

sbt version 1.5.3
daml sdk 1.11.0
centos 7
其他的软件环境和官方文档一致

BE
bernhard
Jun 2021

I suspect you are running into this issue: Bug ID: JDK-8133521 (fs) Paths.get(null); throws NullPointerException

That would happen if the field config.channel.chaincode.metapath here is null.

Looking at your config, that is exactly the case… Could you try just setting a random path for the meatapath?

BE
bernhard
Jun 2021

Actually, I think it should be

    gopath: ./chaincode
    metapath: ./chaincode/src/github.com/digital-asset/daml-on-fabric/META-INF
    entryPath: github.com/digital-asset/daml-on-fabric

in your config. You also seem to have lost the ./ in front of chaincode in gopath.

UI
uid10086
Jun 2021
bernhard:

I suspect you are running into this issue: Bug ID: JDK-8133521 (fs) Paths.get(null); throws NullPointerException

That would happen if the field config.channel.chaincode.metapath here is null .

Looking at your config, that is exactly the case… Could you try just setting a random path for the meatapath?

因为我需要连接到其他网络,根据文档提示,我需要置空这个选项

UI
uid10086
Jun 2021

这是默认的参考文件config-local.yaml 中的配置,请注意观察,同目录下并没使用./

BE
bernhard
Jun 2021

I see. The Java Bug I referenced above seems to be specific to Oracle Java 8. Is that what you are using? If so, a different Java version or distro probably fixes this?

Alternatively, you can bravely apply a local patch to the file I linked above. Change

Files.exists(Paths.get(config.channel.chaincode.metapath))

to

config.channel.chaincode.metapath != null && Files.exists(Paths.get(config.channel.chaincode.metapath))
UI
uid10086
Jun 2021

但是我想连接的是自己的fabric网络,并且已经有了channel(ntchannel),那么我需要怎么配置呢,根据模版文件config-local.yaml的提示,我需要把这些选项(this attribute should be empty.),我应该如何配置

BE
bernhard
Jun 2021

I think your config was fine. If you are using Oracle Java 8, you are running into a bug that occurs exactly if you run daml-for-fabric with empty metapath on that Java version.

The best way to verify is to either switch java version if you have another one available, or to try out the patch suggested above.

The daml-for-fabric experts around here are largely US-based so if neither of those work, we may have to wait for them to get up.

UI
uid10086
Jun 2021

好的,我明白了,我尝试更换一下java sdk版本,谢谢

UI
uid10086
Jun 2021

我已经更换到了java sdk 11版本,还是会存在空指针问题,根据模版提示,这些都是可以置空的,我又困扰在了这里



BE
bernhard
Jun 2021

So, i had another quick look and actually ran a test this time since you are no longer running into a Java bug. “empty” in the readme appears to mean “empty string”, not null. That needs to be clarified.

I can connect to an existing channel with this config:

channel:
  name: mainchannel
  channelTxFile: ''
  endorsementPolicy: ''
  chaincode:
    name: daml_on_fabric
    type: golang
    version: 1.0
    gopath: ''
    metapath: ''
    entryPath: github.com/digital-asset/daml-on-fabric
    queryWaitTime: 30000
    invokeWaitTime: 60000
UI
uid10086
Jun 2021
bernhard:

So, i had another quick look and actually ran a test this time since you are no longer running into a Java bug. “empty” in the readme appears to mean “empty string”, not null . That needs to be clarified.

I can connect to an existing channel with this config:

出现了新的问题,因为没有配置chaincode 的路径
image

KC
kctam
Jun 2021

Hi,
如我們在會議中所建議,請試試使用新的channel,而我會測試能否使用現有channel.
As mentioned in our call, let’s try to use a new channel for daml-on-fabric, and I will test the setup using an existing channel.

kc

BE
bernhard
Jun 2021

So just to clarify: ntchannel is an existing channel, but it doesn’t have daml running on it yet? As far as I understand, there are really three operations:

  1. Create a Fabric Channel
  2. Deploy the Chain Code for daml for fabric
  3. Run Daml over a Fabric channel with that chain code

The channelTxFile and endorsementPolicy fields are inputs for creating a new channel, ie for 1.
The gopath, metapath, and entryPath fields are for deploying the chaincode (ie 2). Both of those are done as part of the “provision” role in daml-on-fabric.

Now I’m actually not sure how to do 2 without doing 1, but I think your best bet would be to leave channelTxFile and endorsementPolicy empty and fill in gopath, metapath, and entryPath.
Then for every second daml-for-fabric instance you connect, you either remove the provision role, or also leave the chaincode fields empty.

KC
kctam
Jun 2021

Hi @bernhard yes, we understand the three steps. What we wish to check is that whether item 1 can be an existing channel where item 2 is not running yet. So far I have tested 1-2-3 together works fine (where 1 is a new channel).

BE
bernhard
Jun 2021

As I said, I think this is probably the way:

bernhard:

leave channelTxFile and endorsementPolicy empty and fill in gopath , metapath , and entryPath

KC
kctam
Jun 2021

Yes, we will test this and let you know the result. Thanks again and have a nice weekend.

UI
uid10086
Jun 2021

感谢你们的帮助,周末愉快,谢谢!我会继续测试

UI
uid10086
Jun 2021


我已经成功进行到了把peer加入到新的channel,下个礼拜再解决chaincode 安装问题

KC
kctam
Jul 2021

Hi team,

A quick update. We have completed the test on daml-on-fabric deployed on a running fabric network. It is deployed in a brand new channel, i.e., all 1-2-3 steps are complete well.

Thanks @bernhard for your support, and hope you have already learnt some Chinese. :slight_smile:

cheers,
kc

← Back to Discussions