ethereum

Getting the address of a contract deployed by another contract

耗尽温柔 提交于 2019-12-03 12:53:07
问题 I am trying to deploy a contract from another factory contract and then return the address of the newly created contract. The address it returns however is the transaction hash not the contract address. I believe this is because the contract is not yet mined when the address is returned. When I deploy a contract using the web3 deploy it seems to wait until the contract is deployed before outputting the address. The factory contract: contract Factory { mapping(uint256 => Contract)

Send signed transactions to Ropsten or Truffle develop network with Trezor (Hardware Wallet)

白昼怎懂夜的黑 提交于 2019-12-03 10:19:13
Im trying to integrate web3js with Trezor in a truffle dev network or using ropsten test network . The idea is to sign the transactions using the hardware wallet and then send a raw transaction using web3js Im getting that we dont have balance to make the transaction, probably because web3js isnt taking one of the 10 truffle accounts and is using the trezor address that isnt in my local network .. On ropsten i have some ethers and i get "invalid address" Is there a way to send a signed transactions (with trezor) using web3js into a truffle develop network? i mean, is there a way to include the

How to find out if an Ethereum address is a contract?

旧时模样 提交于 2019-12-03 05:47:42
问题 An address in Solidity can be an account or a contract (or other things, such as a transaction). When I have a variable x, holding an address, how can I test if it is a contract or not? (Yes, I've read the chapter on types in the doc) 回答1: Edit: Solidity has changed since this answer was first written, @manuel-aráoz has the correct answer. There is no way in solidity to check if an address is a contract. One of the goals of Ethereum is for humans and smart contracts to both be treated equally

Are there null like thing in solidity

淺唱寂寞╮ 提交于 2019-12-03 05:00:21
struct buyer{ uint amount; Status status; } mapping(address=>buyer) public buyers; mapping(uint=>address) buyerIndex; uint public buyerNum; //Order a product. function(){ uint doubleValue=value*2; uint amount=msg.value/doubleValue; if(buyers[msg.sender]==null){ //Error in this line buyer abuyer=buyer({amount:amount,status:Status.Created}); //Error in this line buyerNum++; buyerIndex[buyerNum]=msg.sender; buyers[msg.sender]=abuyer; }else{ buyers[msg.sender].amount+=amount; } Order(msg.sender,amount*doubleValue,amount); } If a buyer is not recorded in the buyer mapping, then buyerNum++; but I

What is blockchain and Ethereum? Where is it used?

最后都变了- 提交于 2019-12-03 03:51:56
I just got chance to work on Ethereum, block-chain based platform. But I don't have a clear idea in which scenarios this is used, any real life use of this.Could anybody help me understand blockchain based platform and its real life uses? Welcome to blockchain world.Don't get demotivated, Blockchain area is relatively new & hard to find good tutorials.I also started learning blockchain related technologies a month ago & I would like to share some ideas about Blockchain & Ethereum.Since your question is not directly related to Nodejs & Javascript,I would like to suggest you modify the question

Getting the address of a contract deployed by another contract

此生再无相见时 提交于 2019-12-03 03:24:55
I am trying to deploy a contract from another factory contract and then return the address of the newly created contract. The address it returns however is the transaction hash not the contract address. I believe this is because the contract is not yet mined when the address is returned. When I deploy a contract using the web3 deploy it seems to wait until the contract is deployed before outputting the address. The factory contract: contract Factory { mapping(uint256 => Contract) deployedContracts; uint256 numContracts; function Factory(){ numContracts = 0; } function createContract (uint32

Difference between various blockchain protocols [closed]

只谈情不闲聊 提交于 2019-12-03 00:40:35
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 11 months ago . As the developers are constantly using different network protocols of blockchain such as Hyperledger, multichain, Ethereum, Corda, and others. Community will appreciate if the developers & blockchain enthusiasts can pour in some key differences between various types of

模块化写作(Topic-Based Authoring 或 Topic-Based Writing)

匿名 (未验证) 提交于 2019-12-03 00:03:02
什么是模块化写作 模块化写作(英文:Topic-based authoring 或 Topic-based writing)是一种以主题(英文:Topic)为模块进行内容创作的写作方式,是编写各类技术文档是最常用的方式之一。这种写作方式与当前线性的写作方式形成鲜明的对比,各个不同的主题模块会根据不同的内容来自由组合或重用,每个主题是一个独立的内容模块,包含标题和内容(有时可以只有标题)向读者提供一段完整的信息。各个主题之间可以互相嵌套,也可以独立存在。根据结构化资讯标准促进组织(OASIS)发布的达尔文信息类型架构(DITA)规范,主题可以分为概念、任务、参考、术语表和故障排查五种类型。 简单来说,模块化写作就是写出一个个独立的内容模块。“独立的内容模块”可以是一个标题加上几段话,也可以仅仅是一个标题。它的评价标准也很简单:如果这段内容单独成文依然合乎情理,那它就是一个“独立的内容模块”。 举例而言,这篇文章《模块化写作》就是一个独立的内容模块。我既可以把它单独作为一篇文章、仅解释什么是模式化写作,也可以把它作为其它文章中的一小节、把模块化写作作为背景知识介绍给读者。无论哪种方式都是合乎情理的。 为什么要进行模块化写作 模块化写作的优点显而易见。 提升阅读体验。现如今,读者在搜索信息时所得到的信息多是碎片化的,用户需要自行整合信息以构建完整的逻辑体系来解决实际问题

Difference between various blockchain protocols [closed]

女生的网名这么多〃 提交于 2019-12-02 14:14:48
As the developers are constantly using different network protocols of blockchain such as Hyperledger, multichain, Ethereum, Corda, and others. Community will appreciate if the developers & blockchain enthusiasts can pour in some key differences between various types of blockchains as mentioned above. Thanks ! christo4ferris This is a good question, though not one easily addressed with a simple answer. As @Mat0 commented above, one difference is the approaches that the various platforms are using to achieve consensus. Some use proof of work (PoW), others use variants of byzantine fault tolerant

BigQuery/ Ethereum dataset - how to write the code

拥有回忆 提交于 2019-12-02 12:02:24
问题 For the ethereum dataset, anyone could tell me how should I write in BigQuery if I'd know the last month transactions of a particular contract? For example, if i would know how many transactions are made in the last month for the contract address " 0x41dbecc1cdc5517c6f76f6a6e836adbee2754de3 " his a Everytime I try to analyze this address, it returns zero. For example SELECT from_address, to_address, value, transaction_hash FROM `bigquery-public-data.ethereum_blockchain.token_transfers` AS