LOADING...
LOADING...
LOADING...
当前位置:主页 > 知识列表 >

const

1. eosio.token合约源码分析

...义如下struct [[eosio::table]] account { asset balance; uint64_t primary_key()const { return balance.symbol.code().raw(); } }; struct [[eosio::table]] currency_stats { asset supply; asset max_supply; name issuer; uint64_t primary_key()const { return supply.symbol.code().raw(); } }; typedef eosio::multi_index< "ac...

知识:代币,合约,创建代币,发行代币

2. 如何使用以太坊、DAI,标记和结算“自动执行”智能发票

...olit添加了Etherscan链接。 1.买方和卖方应各自拥有一个含有以太坊的帐户。 const buyerBalance = await web3.eth.getBalance(buyer); assert( new BigNumber(buyerBalance).isGreaterThanOrEqualTo( web3.utils.toWei('10', 'ether'), ), ); const sellerBalance = await web3.eth.getBalance(seller); assert( new BigNumber(sellerBalance).isGreaterThanOrEqualTo( web3.utils....

知识:钱包,合约,以太坊

3. [Bitfinex] 通过Honey框架和Bitfinex终端执行您的交易策略

...我们可以加载所需的依赖项。 我们的回测教程的读者会发现一些相似之处:const dazaar = require(’dazaar’)const swarm = require(’dazaar / swarm’)const Hyperbee = require(’hyperbee’)const keyEncoding = require(’bitfinex-terminal-key-encoding’)const terms = require(’ bitfinex-terminal-terms-of-use&#8221...

知识:策略,数据,函数,您的

4. 使用IPFS、IOTA构建的智能回收系统

...路径:app.route(‘/init’).get(recycler.init);控制器:exports.init = async (req,res) =>{const response = await manageClients.init()res.json('DB initialized with some clients with root',response )}实现:(将初始化MAM根,并添加客户端虚拟数字)const init = async()=>{products['HELLODRAYMANRNFELVTJREBCXJETCFEUGXBZHEGHCJHIYIFPQEQGDXILJZYUQMOYSELXIG9KUYOSYBFAY'] = {'na...

知识:IPFS,智能回收系统,IPFS应用

5. 【Substrate开发教程】14 - 使用polkadot-js API获取链上信息

...下形式构成接口:api.<type>.<module>.<section>包括如下一些分组:consts:所有运行时常量,如api.consts.balances.existentialDeposit;query:所有链上状态信息,如api.query.system.account(<accountId>);tx:所有交易信息,如api.tx.balances.transfer(<accountId>, <value>);events:事件,如api.query.system.events();2...

知识:区块,区块链,链上,本地节点

6. 一个真正做DeFi生态的项目Compound,寻找DeFi兴起的原点,不要把借贷等同于P2P

...gDecimals - cTokenDecimals))这是一个使用Web3.js JavaScript在BAT中查找1 cBAT值的示例。const cTokenDecimals = 8; // all cTokens have 8 decimal placesconst underlying = new web3.eth.Contract(erc20Abi, batAddress);const cToken = new web3.eth.Contract(cTokenAbi, cBatAddress);const underlyingDecimals = await underlying.methods.decimals().call();const exchangeRateCurrent = await cToken.met...

知识:代币,合约,以太币,区块

7. DeFi新玩法 | 一文教你用Node.js在Uniswap和SushiSwap之间套利

...交易费后的价差。 function estimateProfitAfterTradingFees(uniswapPrice, sushiswapPrice) { const diff = Math.abs(sushiswapPrice - uniswapPrice); const diffRatio = diff / Math.max(sushiswapPrice, uniswapPrice);// multiply by 2 because we trade 2 times // (once on Uniswap and once on SushiSwap) const fees = UNISWAP_FEE * 2;return diffRatio - fees; } </pre> 如果扣除交易费用后的利润...

知识:DeFi,Uniswap

8. 零时科技|CNVD-2020-30018比特币存在逻辑缺陷漏洞

...首先依然是先看script.cpp,在第1114-1134行的VerifySignature函数:bool?VerifySignature(const?CTransaction&?txFrom,?const?CTransaction&?txTo,?unsigned?int?nIn,?int?nHashType) { ????assert(nIn?&lt;?txTo.vin.size()); ????const?CTxIn&?txin?=?txTo.vin[nIn]; ????if?(txin.prevout.n?>=?txFrom.vout.size()) ????????return?false; ????const?CTxOut&?txout?=?txFrom.vout[txin.prevout.n];if?(txin.pre...

知识:比特币,公钥,函数,比特币存在

9. # Wasm介绍之6:间接函数调用

...type 1) (param i32 f32 f32) (result f32) ... ) (table (;0;) 5 5 funcref) (elem (;0;) (i32.const 1) funcref $div $mul $sub $add) (memory (;0;) 16) (global (;0;) (mut i32) (i32.const 1048576)) (global (;1;) i32 (i32.const 1048576)) (global (;2;) i32 (i32.const 1048576)) (export "memory" (memory 0)) (export "__data_end" (global 1)) (export "__heap_base" (global 2)) (export "...

知识:指令,WASM

10. 如何使用node.js语言实现PBFT协议 part3

...ceNo - 区块的序列号 // Import SHA256 used for hashing and ChainUtil for verifying signature const SHA256 = require("crypto-js/sha256"); const ChainUtil = require("./chain-util"); class Block { constructor( timestamp, lastHash, hash, data, proposer, signature, sequenceNo ) { this.timestamp = timestamp; this.lastHash = lastHash; this.hash = hash; ...

知识:区块,消息,创建一个

11. BTFS开发者指南 | 第十一期:关于开发者SDK

... files to BTFS, you can first define the IP address and accessible port of your BTFS node.JavaScriptconst ipAddr = "api.btfs.trongrid.io";const ipPort = "443";Then define a variable with the host IP, port number, and protocol.JavaScriptconst btfs = window.IpfsApi({host:ipAddr, port:ipPort, protocol:'https'});add方法的形式为.add(data,[options],[callback]),其中数据可以是:可...

知识:智能合约,实例,对象,形式

12. 墨客科普 | MOAC区块链钱包账号管理

...账号node环境下运行以下代码,可以离线生成账号,得到私钥、公钥和地址。const EthCrypto = require('eth-crypto'); const identity = EthCrypto.createIdentity(); //可以直接显示私钥、公钥和地址console.log('privateKey:'+identity.privateKey);console.log('publicKey: '+identity.publicKey);console.log('address: '+identity.address); /* > privateKey:0xafd2fa1a5710...

知识:私钥,钱包,区块,公钥

13. Achain星系研究院:Achain2.0chainbase解析

...文件上加入注释。class database {public://...// db 复制构造函数,启动入口database(const bfs::path& dir, open_flags write = read_only, uint64_t shared_file_size = 0, bool allow_dirty = false);// db析构函数,解除该database的文件映射,关闭文件;~database();// 同步mmap的内存到文件(msync)void flush();// 设置标识符,在一些操作时,是否需要锁voi...

知识:区块,事务,文件,是一个

14. 墨客科普 | MOAC区块链钱包账号管理

...node环境下运行以下代码,可以离线生成账号,得到私钥、公钥和地址。  const EthCrypto = require('eth-crypto'); const identity = EthCrypto.createIdentity(); //可以直接显示私钥、公钥和地址console.log('privateKey:'+identity.privateKey);console.log('publicKey: '+identity.publicKey);console.log('address: '+identity.address); /* &gt; privateKey:0xafd2fa1a5...

知识:私钥,钱包,区块,公钥

15. Chainlink去中心化预言机桥接区块链与现实世界

...交请求的 请求器合约。我们创建了一个请求器合约示例,可以在这里下载。constructor()?public?{????//?Set?the?address?for?the?LINK?token?in?Kovan?network.????setLinkToken(0xa36085F69e2889c224210F603D836748e7dC0088);????//?Set?the?address?of?the?Oracle?contract?in?Kovan?network.????setOracle(0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e);?}...???/*???*?Create?a?request?and?s...

知识:合约,预言机合约,代币,预言机