ChainLink节点可以向Chainlink外部适配器提出请求(在Localhost上)

发布于 2025-02-02 15:11:03 字数 1142 浏览 3 评论 0原文

我有一个在端口6688上运行的链链接节点。我正在使用Docker运行它,并带有以下命令:

cd ~/.chainlink-rinkeby && docker run -p 6688:6688  \
-v ~/.chainlink-rinkeby:/chainlink  \
-it --env-file=.env \
 smartcontract/chainlink:1.4.0-root local n -p /chainlink/.password -a /chainlink/.api

并且我在端口8080上运行了一个外部适配器。

如果我请求它“ data”:{“列”:[“血”,“ heath”],“ linesAmount”:500}} 它以我的正确有效载荷返回了我的正确有效载荷,以外部适配器预期的格式:

{
    "jobRunID": 0,
    "data": {
        "ipfsHash": "anIpfshashShouldBeHere",
        "providers": [
            "0x03996eF07f84fEEe9f1dc18B255A8c01A4986701"
        ],
        "result": "anIpfshashShouldBeHere"
    },
    "result": "anIpfshashShouldBeHere",
    "statusCode": 200
}

问题IS,在链链接节点中,特别是在fetch方法中,它给我一个错误: 错误制作http请求:发布“ http:// localhost:8080”:拨号TCP 127.0.0.1:8080:连接:连接拒绝

它与Docker容器有关吗?我不明白为什么它无法从同一台计算机中的另一个端口请求重新构造。我是否错过了一些配置? 根据我从文档中阅读的内容,可以在本地运行适配器。 下面,图片提供更多信息:

”在此处输入图像说明”

I have a chainlink Node which is running on port 6688. I'm running it with docker, with the following command:

cd ~/.chainlink-rinkeby && docker run -p 6688:6688  \
-v ~/.chainlink-rinkeby:/chainlink  \
-it --env-file=.env \
 smartcontract/chainlink:1.4.0-root local n -p /chainlink/.password -a /chainlink/.api

And I have an external adapter running on port 8080.

If I request it { "id": 0, "data":{ "columns": ["blood","heath"], "linesAmount":500 } } it returns me a correct payload, in the format that is expected from the external adapter:

{
    "jobRunID": 0,
    "data": {
        "ipfsHash": "anIpfshashShouldBeHere",
        "providers": [
            "0x03996eF07f84fEEe9f1dc18B255A8c01A4986701"
        ],
        "result": "anIpfshashShouldBeHere"
    },
    "result": "anIpfshashShouldBeHere",
    "statusCode": 200
}

The problem is, in the chainlink node, specifically in the fetch method it gives me an error:
error making http request: Post "http://localhost:8080": dial tcp 127.0.0.1:8080: connect: connection refused

Is it related to the docker container? I don't see why it wouldn't be able to request resuources from another port in the same machine. Am I missing some configuration maybe?
From what I've read from the docs it's possible to run the adapter locally.
Below, a picture with more information:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转身泪倾城 2025-02-09 15:11:03

如果您是外部适配器(ea)在http:// localhost:8080上运行,并且您正在尝试从Docker内运行的链条节点到达该EA,则您无法使用<<代码> localhost ,您需要从Docker容器中出来,然后进入运行Docker Engine(Windows或Mac Machine)的主机。

要这样做,因此定义您的桥以使用http://host.docker.internal:8080

更多详细信息可以在 docker docs

If you're External Adapter (EA) is running on http://localhost:8080 and you're trying to reach that EA from a Chainlink node running inside Docker, then you can't use localhost, you need to get out of the Docker container and onto the host running the Docker engine (your Windows or Mac machine).

To do, so define your bridge to use http://host.docker.internal:8080.

Further details can be found in the Docker Docs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文