如何使用 best use vb.net 在 binance smart chain 或 ethereum 网络中自动执行任务?

How to use best use vb.net to automate task in binance smart chain or ethereum network?

基本上我想用加密货币自动执行一些任务。

比如我想买比特币如果defi里面的价格是36k

在 cefi 中有一个 API。

defi 呢?

之后我需要与区块链进行交互,对这个智能合约进行交易。

据我所知defi中没有API

那我应该改用什么?

我做了研究并找到了像

这样的资源

https://ethereum.org/en/developers/docs/

但我不想构建 dapps

我想构建一个与区块链交互的普通应用程序,例如在 defi 上自动买卖硬币。

我应该从哪里开始?

我来打样

假设我在 spooky swap 中做了一个简单的交换。

我想执行合同

https://ftmscan.com/address/0xf491e7b69e4244ad4002bc14e878a34207e38c29

和函数

swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline)

使用这些参数

#   Name    Type    Data
0   amountOutMin    uint256 101506649727709088
1   path    address[]   0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83
0x112dF7E3b4B7Ab424F07319D4E92F41e6608c48B
2   to  address 0x898568c58466957bedaE0e2A2457beb158a150de
3   deadline    uint256 1653213606

简单吧?

任何人都可以去 spookyswap 并使用 metamask 执行此操作。

如何在 vb.net(或 c#)中执行此操作?

我做了一些研究,有人说使用 nethereum

https://nethereum.com/

好像是做dapps,而不是和dapps交互

那我该怎么办?

下以太坊是正确的选择吗?它可以与 avalanche、fantom 和 cronos 等一起使用吗?喜欢元掩码?

我研究了 google。

我能想到的最好的是

https://medium.com/coinmonks/a-net-developers-workflow-for-creating-and-calling-ethereum-smart-contracts-44714f191db2

基本上是说

There are many great tools available to create Ethereum Smart Contracts. It can be hard to choose between them. In this article, you will learn a simple workflow for developing Solidity smart contracts and calling their functions from C#. This workflow is well suited to .NET developers because it minimises the amount of new tools you need to know about. By using the excellent Nethereum .NET library you can continue to use the Visual Studio set of tools you are already familiar with.There are many great tools available to create Ethereum Smart Contracts. It can be hard to choose between them. In this article, you will learn a simple workflow for developing Solidity smart contracts and calling their functions from C#. This workflow is well suited to .NET developers because it minimises the amount of new tools you need to know about. By using the excellent Nethereum .NET library you can continue to use the Visual Studio set of tools you are already familiar with.

基本上它说的是,使用 Nethereum。我会调查一下。

还有其他 API 资源。其中大部分用于自动化的只读部分,这对我来说很棒

我目前收集到的是

  1. https://www.covalenthq.com/
  2. https://thegraph.com/en/
  3. https://dexscreener.com/

所以我似乎被覆盖在只读部分。如果我能自动化一些钱包就好了。这似乎是 Nethereum 所做的。

看来,如果我们粘贴EVM代码,我们将能够创建一些功能。看起来像

的函数

然后使用一些插件创建一个与一些以太坊节点交互的 c# 函数。

例如,

所以有些东西会自动创建 SetRequestAndWaitForReceiptAsync

我将从那里开始。

无论如何,我发现dexscreener会解决我计划的阅读部分。

例如,

https://api.dexscreener.com/latest/dex/pairs/fantom/0x2dc234dbfc085ddbc36a6eacc061d7333cd397b0

演出

{"schemaVersion":"1.0.0","pairs":[{"chainId":"fantom","dexId":"spookyswap","url":"https://dexscreener.com/fantom/0x2dc234dbfc085ddbc36a6eacc061d7333cd397b0","pairAddress":"0x2DC234DbfC085DdbC36a6EACC061D7333Cd397b0","baseToken":{"address":"0x8a41f13a4FaE75ca88B1ee726ee9D52B148b0498","name":"Ripae","symbol":"PAE"},"quoteToken":{"symbol":"WFTM"},"priceNative":"122.14","priceUsd":"43.87","txns":{"h24":{"buys":997,"sells":2003},"h6":{"buys":212,"sells":479},"h1":{"buys":51,"sells":101},"m5":{"buys":0,"sells":9}},"volume":{"h24":591159.12,"h6":124512.92,"h1":31047.84,"m5":351.69},"priceChange":{"h24":-16.13,"h6":0.2,"h1":1.31,"m5":0.36},"liquidity":{"usd":409095.69760772487,"base":4652.47,"quote":569418},"fdv":26644339.03,"pairCreatedAt":1643886747000}],"pair":{"chainId":"fantom","dexId":"spookyswap","url":"https://dexscreener.com/fantom/0x2dc234dbfc085ddbc36a6eacc061d7333cd397b0","pairAddress":"0x2DC234DbfC085DdbC36a6EACC061D7333Cd397b0","baseToken":{"address":"0x8a41f13a4FaE75ca88B1ee726ee9D52B148b0498","name":"Ripae","symbol":"PAE"},"quoteToken":{"symbol":"WFTM"},"priceNative":"122.14","priceUsd":"43.87","txns":{"h24":{"buys":997,"sells":2003},"h6":{"buys":212,"sells":479},"h1":{"buys":51,"sells":101},"m5":{"buys":0,"sells":9}},"volume":{"h24":591159.12,"h6":124512.92,"h1":31047.84,"m5":351.69},"priceChange":{"h24":-16.13,"h6":0.2,"h1":1.31,"m5":0.36},"liquidity":{"usd":409095.69760772487,"base":4652.47,"quote":569418},"fdv":26644339.03,"pairCreatedAt":1643886747000}}

这就是我需要的。