ethereum

How can we generate multiple random number in ethereum?

佐手、 提交于 2020-06-27 09:38:27
问题 I want my smart contract to return 7 or 8 UNIQUE random numbers ranging from 1 to 100 upon calling the contract. What can be the best approach to obtain such result? 回答1: Probably if you are trying to build roulettes, lotteries, and card games using the Ethereum blockchain, as the Ethereum blockchain is deterministic, it imposes certain difficulties for those who have chosen to write their own pseudo-random number generator (PRNG). Some Vulnerable Methods Currently Used If you are using the

Validate TRON address using solidity ecrecover

孤街醉人 提交于 2020-06-17 11:55:09
问题 I'm trying to validate a signed message using a smart contract running on the TRON network. I've tried a few different methods but all failed: Based on this article I've deployed the following smart contract: contract Verifier { function recoverAddr(bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (address) { return ecrecover(msgHash, v, r, s); } function isSigned(address _addr, bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (bool) { return ecrecover(msgHash, v, r, s) == _addr

web3.eth.sendSignedTransaction() always return “Returned error: nonce too low”

纵然是瞬间 提交于 2020-05-28 03:28:12
问题 I used web3@1.00 in node.js to interact with private blockchain. And I write the code according to the official documents of web3@1.00. var Web3 = require('web3'); var Tx = require('ethereumjs-tx'); var web3 = new Web3('http://localhost:8101'); //get the privatekey var decryptPK = web3.eth.accounts.decrypt({"address":"68c5cb5aa9f568ae2a6ec530e982f4f1144f2d10", "crypto":{"cipher":"aes-128-ctr", "ciphertext":"96b6a86bd5ff16a5669975974eabba844bc414bc52d9cc36843b4f41e89d46b9", "cipherparams":{"iv

Best datatype to store hexidecimal and hex characters in the database

99封情书 提交于 2020-05-15 00:56:37
问题 I'm using the Ethereum api. I want to store the information from the api into a mysql table. The address data looks like: 0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be 0x1d80982502f3bb75654df13aa32bbd5ac9cab7d6 0xaf13bbdbe1ff53c2df7109a53c217320d2d76ee2 ... I've been using just varchar column for these characters. Are there a better data type? I'm thinking maybe varbinary but I don't know if there's any advantages. The disadvantage is that the sql code will be messier as I will have to HEX() and

在centos7下安装以太坊的go-ethereum-1.4.12版本失败

守給你的承諾、 提交于 2020-03-11 11:36:46
今天在centos7下安装以太坊的go-ethereum-1.4.12版本失败,在网上查找资料,以及问了大牛,也不知何解,然后到https://github.com/ethereum/go-ethereum/releases下载最新版的1.8.1版本后,安装成功了。 安装1.4.12下敲make命令后,报的错误如下: 换了1.8.1版本安装成功,提示如下: 来源: oschina 链接: https://my.oschina.net/u/3771618/blog/1625953

go-ethereum搭建私有链多节点

纵然是瞬间 提交于 2020-03-10 23:47:33
参考资料: 简书 江无常 https://www.jianshu.com/p/a7c4e1938c01 笔记作的很详细多节点实现。 官方参考文档: 此文档特别有用,是节点集群的主要参考资料 https://github.com/ethereum/go-ethereum/wiki/Setting-up-private-network-or-local-cluster 非多节点参考此文档即可: https://geth.ethereum.org/docs/interface/private-network 私有链生成的: 直接在chorm浏览器插件处,导入私钥文件。 来源: oschina 链接: https://my.oschina.net/u/2277392/blog/3191427

基于PoA的以太坊私链搭建过程

谁都会走 提交于 2020-03-01 17:09:10
一、搭建环境 宿主系统:Windows 10 家庭版 虚拟机: Virtual Box 6.0.12 操作系统:CentOS 7 64 位 二、安装基础工具 下载并安装Git、vim、gcc-c++、ntp组件、nodejs以及添加epel第三方安装源。这些工具的说明如下: git:安装相关的组件,下载安装各类开源代码与工具的利器; gcc-c++:c/c++编译工具,用于golang下部分c库的编译以及truffle组件的编译 ntp:网络时钟同步组件;Ethereum的rpc网络需要时间同步; nodejs:ethereum前端开发JavaScript包管理软件 epel:网络第三方的linux安装包源 三、安装cmake echo "export PATH=/usr/local/cmake-3.15.7/bin:$PATH" >> /etc/profile source /etc/profile cmake -version 四、安装Golang 注意:安装包地址可能有变更,可到官网上找 wget https://storage.googleapis.com/golang/go1.14.linux-amd64.tar.gz tar -C /usr/local -zxzf go1.14.linux-amd64.tar.gz echo "export GOROOT=/usr

Rust开发以太坊智能合约-Parity

我的未来我决定 提交于 2020-03-01 12:27:57
Parity 声称是世界上最快速最轻便的客户端。它用Rust语言写成,可靠性、性能和代码清晰度都有所增强。Parity由Ethcore开发。Ethcore由以太坊基金会的几个会员创建。 网站: https://ethcore.io/parity.html Github: https://github.com/ethcore/parity Gitter聊天: https://gitter.im/ethcore/parity Arch Linux 程序包由Afri Schoedon和quininer进行社群维护。 https://aur.archlinux.org/packages/parity/ (稳定,最新版本) https://aur.archlinux.org/packages/parity-git/ (不稳定,最新开发) 已经有人报告在树莓派2上成功运行了Parity。 如果你希望 高效的 学习以太坊DApp开发,可以访问汇智网提供的 最热门 在线互动教程: 适合区块链新手的以太坊DApp实战入门教程 区块链+IPFS+Node.js+MongoDB+Express去中心化以太坊电商应用开发实战 其他更多内容也可以访问 这个以太坊博客 。 来源: oschina 链接: https://my.oschina.net/u/3837977/blog/1805446