随笔分类 -  solidity

摘要:https://stackoverflow.com/questions/42738640/division-in-ethereum-solidity/42739843 阅读全文
posted @ 2018-06-24 05:11 huahuayu 阅读(719) 评论(0) 推荐(0) 编辑
摘要:https://wiki.parity.io/ 阅读全文
posted @ 2018-05-26 11:26 huahuayu 阅读(575) 评论(0) 推荐(0) 编辑
摘要:参考链接:https://ethereum.stackexchange.com/questions/13616/accessing-a-public-mapping-within-a-contract-from-a-different-contract/13617#13617 阅读全文
posted @ 2018-05-17 10:55 huahuayu 阅读(424) 评论(0) 推荐(0) 编辑
摘要:参考链接: https://ethereum.stackexchange.com/questions/9705/how-can-you-call-a-payable-function-in-another-contract-with-arguments-and-send/9722#9722 关键语句 阅读全文
posted @ 2018-05-16 21:54 huahuayu 阅读(2317) 评论(0) 推荐(0) 编辑
摘要:来源:https://medium.com/@blockchain101/calling-the-function-of-another-contract-in-solidity-f9edfa921f4c 合约一: 合约二调用合约一: 阅读全文
posted @ 2018-05-02 16:42 huahuayu 阅读(774) 评论(0) 推荐(0) 编辑
摘要:ERC20代币并不能像Ether一样使用sendTo.transfer(amt)来转账,ERC20代币只能通过token中定义的transfer方法来转账,每个账户的余额信息也只保存在token合约的状态变量中。如果要使用除token合约之外的合约进行ERC20代币的转账,那就需要这个合约能够调用E 阅读全文
posted @ 2018-05-02 16:33 huahuayu 阅读(4371) 评论(0) 推荐(0) 编辑
摘要:MIT IMO it is the less restrictive license. It gives the rights to anyone to use, copy, modify, merge, publish, distribute, sublicense, and/or sell co 阅读全文
posted @ 2018-04-22 07:34 huahuayu 阅读(399) 评论(0) 推荐(0) 编辑
摘要:https://medium.com/@msolomon44/using-apis-in-your-ethereum-smart-contract-with-oraclize-95656434292e 作者在写这篇文章之前和我在gitter上有过交流,我特地提到加上本地链 + oraclize br 阅读全文
posted @ 2018-04-21 10:19 huahuayu 阅读(1153) 评论(1) 推荐(0) 编辑
摘要:1. oraclize官方提供的方法 https://github.com/oraclize/ethereum-examples/blob/master/solidity/random-datasource/randomExample.sol 可靠性证明白皮书: http://www.oracliz 阅读全文
posted @ 2018-04-19 16:39 huahuayu 阅读(2333) 评论(0) 推荐(0) 编辑
摘要:solidity虽然不能解析json数据但是oraclize_query可以直接处理: 查询获得的Json数据(http://api.k780.com/?app=finance.globalindex&inxno=000001&appkey=10003&sign=b59bc3ef6191eb9f74 阅读全文
posted @ 2018-04-08 15:39 huahuayu 阅读(3021) 评论(0) 推荐(0) 编辑
摘要:在Solidity中两个无符号整型数字相减结果如果为负则会溢出,很严重的问题。所以在做数字运算时可以用DSSafeAddSub来保证运算的安全。 阅读全文
posted @ 2018-04-05 00:32 huahuayu 阅读(753) 评论(0) 推荐(0) 编辑
摘要:solidity本身没有字符串拼接功能,但是如果你恰巧要用oraclize api,那么可以使用oraclize api中的字符串拼接方法(strConcat)。之所以oraclize api里会有strConcat方法,我想是因为方便用户实现动态查询。 阅读全文
posted @ 2018-04-03 10:40 huahuayu 阅读(1013) 评论(0) 推荐(0) 编辑
摘要:https://medium.com/@blockchain101/looping-in-solidity-32c621e05c22 阅读全文
posted @ 2018-03-31 17:54 huahuayu 阅读(793) 评论(0) 推荐(0) 编辑
摘要:原文地址:https://medium.com/@k3no/making-a-birthday-contract-858fd3f63618 先将datetime合约部署:https://github.com/pipermerriam/ethereum-datetime 然后获取datetime ut 阅读全文
posted @ 2018-03-29 15:44 huahuayu 阅读(5725) 评论(0) 推荐(0) 编辑
摘要:oraclize result以string格式返回,solidity没有uint(string)这样的强制转换功能,如果要解析其中的数字,可以用oraclize提供的parseInt方法: 阅读全文
posted @ 2018-03-29 11:39 huahuayu 阅读(2123) 评论(0) 推荐(0) 编辑
摘要:https://blog.zeppelin.solutions/proxy-libraries-in-solidity-79fbe4b970fd 阅读全文
posted @ 2018-03-28 18:24 huahuayu 阅读(753) 评论(0) 推荐(0) 编辑
摘要:Solidity是一个有诸多限制的语言,部署智能合约以及运行都需要gas。 部署的时候如果程序太大,所需要的gas会超过一个区块的上限,这样就没法部署合约。如果用metamask测试的话会弹出以下警告,强行执行部署交易也没用: Gas estimation errored with the foll 阅读全文
posted @ 2018-03-28 16:44 huahuayu 阅读(3177) 评论(0) 推荐(0) 编辑
摘要:原文地址: https://ethereum.stackexchange.com/questions/19341/address-send-vs-address-transfer-best-practice-usage address.transfer() throws on failure for 阅读全文
posted @ 2018-03-26 11:53 huahuayu 阅读(3614) 评论(0) 推荐(0) 编辑
摘要:solidity mapping of mapping,两层映射,用的时候可以像二维数组一样去访问和修改值,非常方便。 以下代码示例中的这一句: mapping(string => mapping(uint => uint)) prices 相当于建立了一个price数据库表(只不过存在内存中),表 阅读全文
posted @ 2018-03-22 15:29 huahuayu 阅读(1193) 评论(0) 推荐(0) 编辑
摘要:1. 股票数据: https://blog.quandl.com/api-for-stock-data iextrading.com www.nowapi.com 中文 2. 外汇数据: https://fixer.io/ 阅读全文
posted @ 2018-03-22 10:49 huahuayu 阅读(655) 评论(0) 推荐(0) 编辑