ethereum

How to get a value from a “Promise” object

女生的网名这么多〃 提交于 2019-12-02 10:46:57
I started learning ethereum and web3js and noticed some functions on Web3js are asynchronous. What i want to achieve is get the account balance of a wallet and use the data for something else. My code below function getAccountBalance2(address){ var wei, balance //address = document.getElementById("addy").value return new Promise(function(resolve, reject){ web3.eth.getBalance(address, function(error, wei){ if(error){ console.log("Error with address"); }else{ var balance = web3.fromWei(wei, "ether"); var bal = resolve(balance); //console.log(bal); console.log(balance.toNumber()); return balance

Different ways to invoke contract method

杀马特。学长 韩版系。学妹 提交于 2019-12-02 08:59:19
I have one contract with method name as getValues().From Dapp I am invoking contract method as 'contractCAt.getValues.call(function(error,result){...})' this works fine and by using 'contractCAt.getValues(function(error,result){...})' this syntax also works fine.I didn't get any difference between those two ways to invoke contract method.So could anyone help me to give idea about those syntax. See the web3j documentation : contractCAt.getValues.call() is run locally and will not alter the state of your contract on the blockchain. Does not consume any ether. contractCAt.getValues

RuntimeError: Can not reuse socket after connection was closed using docker

两盒软妹~` 提交于 2019-12-02 08:11:07
I am following this tutorial to run Ethereum crawler using Docker on window 10 using docker after executing $ MYSQL_DATA_PATH="$HOME/indexer-data/mysql" GETH_DATA_PATH="$HOME/indexer-data/geth"docker-compose up in this line i got error 409 Client Error: Conflict for url: http+docker://localnpipe/v1.25/containers/ee2b46142bae704d4963853e22a77ba896a8f841120ecf5ac97befca91847672/attach?logs=0&stdout=1&stderr=1&stream=1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "threading.py", line 916, in _bootstrap_inner File "threading.py", line

BigQuery/ Ethereum dataset - how to write the code

折月煮酒 提交于 2019-12-02 06:01:13
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 token_trs JOIN `bigquery-public-data.ethereum_blockchain.contracts` AS contracts ON (contracts.address =

Parsing Cryptocompare API Json data in C#

流过昼夜 提交于 2019-12-01 14:57:26
I am loading data from https://min-api.cryptocompare.com/data/histominute?fsym=BTC&tsym=ETH&limit=30&aggregate=1&e=CCCAGG This is the return: {"Response":"Success","Type":100,"Aggregated":false,"Data":[{"time":1504979760,"high":14.26,"low":14.26,"open":14.26,"volumefrom":4.8,"volumeto":68.49,"close":14.26},{"time":1504979820,"high":14.26,"low":14.27,"open":14.26,"volumefrom":2.57,"volumeto":36.77,"close":14.27},{"time":1504979880,"high":14.26,"low":14.27,"open":14.27,"volumefrom":7.41,"volumeto":105.66,"close":14.26},{"time":1504979940,"high":14.26,"low":14.26,"open":14.26,"volumefrom":3.69,

Parsing Cryptocompare API Json data in C#

允我心安 提交于 2019-12-01 14:00:55
问题 I am loading data from https://min-api.cryptocompare.com/data/histominute?fsym=BTC&tsym=ETH&limit=30&aggregate=1&e=CCCAGG This is the return: {"Response":"Success","Type":100,"Aggregated":false,"Data":[{"time":1504979760,"high":14.26,"low":14.26,"open":14.26,"volumefrom":4.8,"volumeto":68.49,"close":14.26},{"time":1504979820,"high":14.26,"low":14.27,"open":14.26,"volumefrom":2.57,"volumeto":36.77,"close":14.27},{"time":1504979880,"high":14.26,"low":14.27,"open":14.27,"volumefrom":7.41,

UnhandledPromiseRejectionWarning: Error: The contract code couldn't be stored, please check your gas limit

独自空忆成欢 提交于 2019-11-30 17:28:17
I am trying to deploy my simple solidity smart contract onto the Rinkeby Network but I keep getting the error: UnhandledPromiseRejectionWarning: Error: The contract code couldn't be stored, please check your gas limit. My solidity code is simple pragma solidity ^0.4.18; contract Greetings{ string public message; function Greetings(string initialMessage) public{ message = initialMessage; } function setMessage(string newMessage) public { message = newMessage; } } and my deploy script is: const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const {

calling smart contracts methods using web3 ethereum

為{幸葍}努か 提交于 2019-11-30 13:58:20
问题 Trying to work around the blockchain using Ethereum, I'm facing problems when trying to interface with a deployed contract. What I would try to achieve is to call a method to display information added to a private blockchain deployed locally using Geth. I can't call any function from my smart contract and I've been wondering if I'm doing something wrong... Could someone tell me how to achieve a simple call to one of the method from this contract? let say display the existing agencies, or the

技术文章转载

拜拜、爱过 提交于 2019-11-30 11:06:14
技术文章转载: http://blog.hubwiz.com/2019/09/24/scikit-learn-pipeline-guide/ http://blog.hubwiz.com/2019/09/23/python-ml-beginner-guide/ http://blog.hubwiz.com/2019/09/22/js-beyond-console-log/ http://blog.hubwiz.com/2019/09/20/web3j-intro/ http://blog.hubwiz.com/2019/09/19/eth-one-to-many/ http://blog.hubwiz.com/2019/09/19/crypto-exchange-data-visualization/ http://blog.hubwiz.com/2019/09/18/crypto-price-api/ http://blog.hubwiz.com/2019/09/16/bounding-box-regression/ http://blog.hubwiz.com/2019/09/15/6-python-tricks/ http://blog.hubwiz.com/2019/09/13/ethereum-dev-tools-2019/ http://blog.hubwiz.com

Best practice to save files in blockchain

穿精又带淫゛_ 提交于 2019-11-30 09:42:28
What is the best practice to save files as part of a blockchain's data? I have tremendously large files to be saved. Can't we save these file on cloud storage (centralized solution like dropbox), and link them with blockchain data using a file hash? Or is it better to use a distributed file storage like IPFS? Or is there any better solution in term of security, volume, performance, and fault tolerance. Lucas Hendren You do not want to directly use a traditional blockchain. Blockchains are good for transactional information/state changes, large data storage is generally a bad idea. This is due