texts: Help looping over two digit chunks from uint

texts:
My current situation, I'm creating 10 random models that store two digit numbers inside the struct and store that struct inside an array of said struct.

struct Model {
        uint a;
        uint b;
        uint c;
        uint d;
    }

Model[] private _models;

function _create(uint dna) private returns(uint) {
    uint a = uint(keccak256(dna, "a")) % 10 ** 2;
    uint b =  uint(keccak256(dna, "b")) % 10 ** 2;
    uint c = uint(keccak256(dna, "c")) % 10 ** 2;
    uint d = 1;
    return _models.push(Model(a,b,c,d)) - 1;
}

function _generate() private {
    for(uint x=0; x<10; x++){
        uint dna = uint(keccak256(now, msg.sender, x)) % 10 ** 2;
        uint id = _create(dna);
        Owners[id] = msg.sender;
        decks[msg.sender].push(cardId);
    }
}

The issue I'm having is this code is horribly expensive to execute.

I don't think I need the loop inside _generate since I already have dna variable there with random numbers. I'm thinking I can do something like this

    function _generate() private {
        //for(uint x=0; x< 10; x++){  //remove loop

            uint dna = uint(keccak256(now, msg.sender, x));

            // % 10 ** 2; //remove mod division or change it to the correct length of 10 two digit numbers so maybe 20

            //Help: reading chunks of two digit data from dna.
            //I'm not sure how to split uint data types into
            //subsets of data.
            //sudo code of taking subdata of dna and assigning it
            //to the variables a,b,c

            for(x=0;x<dnaChunks.length;x++){

            //loop through sets of 6 digit numbers and break them into 2 digits and call _create
               uint a = dna[0,1];
               uint b = dna[2,3];
               uint c = dna[4,5];
               _create(a,b,c);
            }
            //uint id = _create(dna);
            Owners[id] = msg.sender;
            decks[msg.sender].push(cardId);
        //}
    }

    function _create(uint _a, uint _b, uint _c) private returns(uint) {
        uint a = _a;
        uint b = _b;
        uint c = _c
        uint d = 1;
        return _models.push(Model(a,b,c,d)) - 1;
    }


texts: Transfer of funds from etherli to poloniex

texts:
I can not make the ethereum transfer from the etherli wallet to my poloniex wallet. The message is:

"Please fund your user account with sufficient ether (~0.01 ETH / tx) for gas (transaction fees)"

Can someone please help me?


texts: Is there any way to scale geth (or any client) API Layer to query a single node?

texts:
as title suggest, what I'm trying to do is to have multiple "app" that expose Json RPC endpoints, like get_balance, get_block / eth_getBlockByNumber / eth_getBlockByHash, so I need to read a full node, but I don't want to deploy and sync multiple identical nodes, 1 for each "API app".

There is a way, to spawn N "API apps" and "attach" (like the geth attach command) to a single ethereum data node?

P.s: I don't need to write on blockchain (deploy smart contracts, generate address, sign etc), just read.

Thank you.


texts:
I want to implement a small guess-the-word game on Ethereum, where the user needs to guess a word from a given set of words. The procedure is following:
1. The user attempts the guess.
1.1. The user fails the guess.
1.2. The user succeeds the guess - a new word is randomly generated (by using Oraclize).

Theoretically, any hidden raw data could be querried on the blockchain if the stakes are high enough to waste the computational power. Even hashed with keccak256, given the known set of words (say, 200 words), it would have been possible to get the keccak256 values of every word and just reverse engineer the raw data.

The question is: is there a way to somehow organize such a pipeline, so that even querrying the raw data of blockchain, the attacker (even the organizer) could not be able to know the newly generated word?


texts:
According to the Yellow Paper, creating a transaction costs 21000 gas (regardless if it contains value) and creating a message call with non-zero call value costs at at least 9000 gas. Yet when I call Contract's default function in Remix (uses ethereumjs-vm) with a value of 1 ether, the entire transaction costs 28562. That means 7562 for execution. How could it be less than 9000?

pragma solidity ^0.5.0;

contract Helper {
    function () external payable {}
}

contract Contract {
    function () external payable {
        [insert helper address here].transfer (1 ether);
    }
}


texts:
Our current project requires that the recipients of a private transaction are unknown to the rest of the network.

So my question is: is the privateFor field dropped before sending the transaction to the Ethereum-Network?

To me this would make sense since this field isn't needed after the Transaction is sent over the Constellation-Network.

Thanks in advance


texts: how do we use `commit/reveal` to count votes?

texts:
Let's say we are doing an election and it's easy to note that we need commit/reveal scheme to hide votes.
So, we store hashes while users commit their votes. Now, let's say the election is over. How do we count the votes ?
Solution: all users call reveal and pass their actual votes with the corresponding hash which means we get the actual vote from each one of users and we count the votes directly in reveal function. like this:
function reveal(vote) {
   require(keccak256(vote) == data[msg.sender]);
   if(vote == true) {
     trueVotes+=1;
   }else{
     falseVotes+=1;
   }
}

The problem with this solution is that all the users have to call reveal and some might forget about it at all to call it, which means we lose votes.
Are there any other solutions or how does it happen at all ?


texts: Can anyone please explain me the following solidity code?

texts:
What is the use of -1 in  instructorAccts.push(_address) -1?

function setInstructor(address _address, uint _age, string _fName, string _lName) public {
    var instructor = instructors[_address];
    instructor.age = _age;
    instructor.fName = _fName;
    instructor.lName = _lName;

    instructorAccts.push(_address) -1;
}


texts: Is there any tool for Ethereum which can convert smart contract into REST API similar to hyperledger fabric?

texts:
In Hyperledger Fabric, REST API can be created for chain code/smart contract using composer-rest-server.
Is there any tool which can do the same for Ethereum Smart Contract?

So that any front developer only call these APIs.
I know about web3 library.
I am just asking is it possible for etherum or not?
can we use compiled smart contract JSON file as a REST API?


texts:
I'm trying to get an Event "Transfer" for the ERC20 Token with web3 function getTransactionReceipt

event Transfer(address indexed _from, address indexed _to, uint256 _value)

You can see the term indexed, this is causing me a strange behaviour.

This Transfer transaction

It's decoded:

topics[0] = methodID
topics[1] = from
topics[2] = to
data = value

I say that this is strange, because if the term "indexed" is not present, the event params are in a single string "data" , for example in the Multisig used by Golem.

The method submitTransaction triggers two events:

event Confirmation(address sender, bytes32 transactionHash);
event Submission(bytes32 transactionHash);

You can see both events here

First one is the confirmation:

topic[0] = methodID
data = sender + transactionHash concatenated

Second one is the submission event:

topic[0] = methodID
data = transactionHash

Thanks!


texts: Private key recovering from both addresses + signed transaction?

texts:
Hello I have a problem.

I have two computers, one of them is airgapped

I have downloaded and runned Myetherwallet locally on an airgapped computer.

On the other computer I made the on line transaction

But here comes the problem:

I have written both the addresses to wich to send the coins from and to on the pc connected to internet

You know that when you run MEW LOCALLY you have to write an on line form and an offline form and then put the signed transaction into the on line form

The problem is that a potencial attacker could have those things recorded on my internet computer:

1) the address which I am sending the coins FROM

2) the address which I am sending the coins TO

3) the signed transaction made from that two addresses.

With all those informations is it possible to recover the Private key whith some kind of tools?
comment


texts: Installing Mist and missing libusb problem

texts:
Can someone help how to install libusb on Windows Server? I tried to install it using this link, and installation went well. But when I run Mist, I get same error like above

  Failed to start Ledger hub, disabling: libusb: not found [code -5]

Can someone help please? What can I check next? Thank you in advence...


texts:
I'm pretty new to Solidity, and I was writing a contract to play around with dynamic arrays. My array length grows, but it seems to stop at length 8.

Here's the contract I wrote:

pragma solidity 0.4.19;

contract BigData {
  bytes public doubleBag = "1";

  function doubleStorage() public {
    uint256 index = 0;
    uint256 addThisMany = doubleBag.length;
    while (index < addThisMany) {
      doubleBag.push("1");
      index += 1;
    }
  }

  function getLength() public view returns (uint256) {
    return doubleBag.length;
  }
}

And the truffle test with web3@^0.20.6:

var BigData = artifacts.require('./BigData.sol')
const BigNumber = require('bignumber.js')

contract('BigData', function(accounts) {
  it('Should grow storage exponentially', async function() {
    let contract = await BigData.deployed()
    for (let i = 1; i <= 3; i++) {
      let tx = await contract.doubleStorage()
      let size = await contract.getLength()
      let expected = i * 2
      assert.equal(size.toNumber(), expected)
    }
  })
})


texts: How to make transaction using npm package

texts: Using npm packages how would you create a transaction on the Ethereum network for 1 ETH to the wallet address 0x8f0ee8bf4596ae4e6c421350159bc723a3afdaa4?


texts: Can I implement the blockchain technology to build my own app that decentralizes renewable energy in the place I live?

texts:
Probably someone has already asked this question but I searched for quite a while and could not find a "simple" answer.
So I would like to implement the blockchain tech into my app that will regulate finances and renewable energy flow from house to house in the place that I live in.
I just want to know if this is possible.

If theres an easier way,maybe using the Ethereum platform to build my app on...?

I'm grateful for any kind of a reply.


texts: How to distinguish between ETH & ETC Node

texts:
I'm using the go-ethereum code (mainly discover (discv4) and rlpx) to write a node discovery tool.

The Programm is using discv4 to discover nodes on the internet and putting the discovered nodes into a que.

A different subroutine then pulls a node from the que and does the hole handshake thing to pass the "HELLO (0x00)" Message. So I get the Capabilities, Name of the Software that the Node is running, OS, ... .

Now I would like distinguish if node is actually a ETH or ETC node.
How can I do that?


texts: how to transfer a specific balance from a smart contract?

texts:
Whenever someone buys a smart-contract the amount (in Wei) get stored in SC(Smart Contract) address(this) += msg.value.

Now I am trying to create a function to redeem the balance of the SC

function redeemInvTokens(uint256 _amount) public returns(bool){
    require(_amount <= amount, "you cannot redeem the more tokens");
    balanceOf[msg.sender] -= _amount;
    msg.sender.call.value(address(this).balance - (address(this).balance - _amount))("Transferred ether to financier");
    return true;
}

but its not transferring any amount to the msg.sender.

How to transfer the specific amount to the msg.sender? so I don't have to use address(this).balance - (address(this).balanace - _amount).


texts: How the contract address being decide when deploy it in another contract?

texts: According to How is the address of an Ethereum contract computed?, I know a contract address is decided by the hash of deployer address and nonce. How about the contract is deployed through another contract?


texts:
Web3.py version: 4.2.1
Python: 3.5.2
OS: linux
geth version: 1.8.0-unstable
I am running geth with --shh flag and --rpcapi "admin,eth,net,web3,debug,shh"

from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545'))

print ("web3 =", web3.version.api) #4.2.1
print(web3.shh) #error occurs

When I try to run following code above, I am having following error:

Traceback (most recent call last):
  File "dd.py", line 11, in <module>
    print(web3.shh)
AttributeError: 'Web3' object has no attribute 'shh'

[Q] How could I fix this error?


texts: What does it mean that Solidity can encode arbitrary state transition functions?

texts:
From Ethereum White Paper:

  "What Ethereum intends to provide is a blockchain with a built-in
  fully fledged Turing-complete programming language that can be used to
  create "contracts" that can be used to encode arbitrary state
  transition functions, allowing users to create any of the systems
  described above, as well as many others that we have not yet imagined,
  simply by writing up the logic in a few lines of code."

How can you explain it in non-technical words?


texts: Transaction is not included in block even block number is increasing [private-net]


texts: I have setup new PoA network with default block gas limit to 3 billions. The network starts with configured limit. However, overtime the block gas limit reduce down to 8 millions. Is there a way to prevent geth from adjusting the block gas limit?


texts:
I have read it was possible to predict the address of a contract before deploying it.
Do you know how can this be possible ?
What happens if we send some Ether to this address before deploying the contract ?
Will this Ether be lost ? Or will it be affected to the contract ?
Thanks


texts:
When I perform an ether-transfer transaction on testnet, some of my ether gets deducted as transfer fees.

But as its not a real ether and has 0 value, how does it profit the miners who mine that transaction?

If they can get real ether as reward by mining MainNet-Transactions then why do they waste their time and hardware to mine testnet transactions?

Please forgive me, I might be missing a major point...


texts: Error: Max retries exceeded with url appear when using web3.py

texts:
Here is my code:

from web3 import Web3, HTTPProvider, IPCProvider

web3 = Web3(HTTPProvider('http://localhost:8545'))

print(web3.eth.blockNumber)

Below is the error:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10d8951d0>: Failed to establish a new connection: [Errno 61] Connection refused',))

Am I doing something wrong?
Thanks all


texts: Haven't seen any documentation that shows that this is possible. Could someone direct me to something that would allow me to listen to transactions on non-contract addresses.


texts:
I copied the crowdsale contract from the ethereum website and now that ether is in in the time has expired and the goal is met how do i get the ether? I have already tried the safe withdrawal is goes through but I never get the funds back into my etherbase. What am I doing wrong?

Page I copied from: https://www.ethereum.org/crowdsale


texts: After-the-fact Fee calculation for ETH transfers

texts:
I'm working on a basic application to track ETH transfers, and I'm making use of the web3j Java API to interact with the Ethereum blockchain. My app is working, but I'm having trouble figuring out how to correctly determine the fee.

I'm using the extremely convenient web3j.replayTransactionsObservable. My basic logic is this:

BigInteger gasPrice = HexToBigIntegerUtil.fromString(transaction.getGasPriceRaw());
BigInteger gasUsed = HexToBigIntegerUtil.fromString(transaction.getGasRaw());
BigInteger fee = gasPrice.multiply(gasUsed);

And that seems like it should be correct, but the getGasRaw() method returns the user's specified gas limit, rather than the actual gas used. And I'm afraid I'm not seeing a convenient way to access the actual gas fee.

Any pointers?


texts: How do I change cors domain of geth metrics?

texts:
I am trying to connect the output of geth metrics of a local node to Grafana.
I am initializing my node using the following geth command:
geth --datadir "n1" --nodiscover --networkid "4013" --metrics --metrics.addr "localhost"  --metrics.port "30301"

I can see the expected output when I navigated to http://localhost:30301/debug/metrics/prometheus.
Even curl in powershell also returns the output.
Now when I try to import with the url as a Data Source in Grafana (and using browser access) the JS console outputs the following
Access to fetch at 'http://localhost:30301/debug/metrics/prometheus/api/v1/query' from origin 'https://jhaendar.grafana.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I know I can set cors domain for the HTTP server, is there any way to set it for metrics server as well?


texts: Metamask API: can't detect events "connect" and "disconnect" in React.js

texts:
Hello I'm very new to developing.
I'm testing communication with Metamask via React.js
I managed to succesfully listen to Network and Account changes, but when I try to detect if someone "connected" or "disconnected" from my App, I'm not able to receive the event.
Metamask API Documentation I'm using:
https://docs.metamask.io/guide/ethereum-provider.html#connect
Working:

ethereum.on('accountsChanged', handler: (accounts: Array<string>) => void);
ethereum.on('chainChanged', handler: (chainId: string) => void);

'
Not Working:

ethereum.on('connect', handler: (connectInfo: ConnectInfo) => void);
ethereum.on('disconnect', handler: (error: ProviderRpcError) => void);

the following Code is working flawless in my React.js app (using React.Component)
  async checkAccountChange() {
   const ethereum = window.ethereum
   if (ethereum) {
     // Listening to Event
     ethereum.on('accountsChanged', accounts => {
       console.log(accounts[0])
       this.setState({ account: accounts[0] })
  })
}

}
the following Code on the other hand is not giving me any console output
  async checkMetamaskHasConnected() {
    if (window.ethereum) {
      window.ethereum.on('connect', () => {
      console.log("Metamask connected")
      this.setState({ metamaskHasConnected: true })
  })
}

}
  async checkMetamaskHasDisconnected() {
    const ethereum = window.ethereum
      if (ethereum) {
      // Listening to Event
      ethereum.on('disconnect', () => {
        console.log("MetaMask discconnected")
        this.setState({ metamaskHasDisonnected: true })
  })
}

}
consider that I'm a very fresh beginner and just do learning by doing


texts: web3.js: What is the difference between call back functions, and promises?

texts:
I am new to web3 developing in java script. I am a little confused when to use a call back function, and when to use a promise.
For instance this code to get transaction hash can be written in may ways:

web3.eth.sendSignedTransaction(transaction, (err, hash) => {console.log(hash)})

can also we written as:

web3.eth.sendSignedTransaction(transaction).on('receipt' , console.log)

I want to know the logic behind every way, and what is the difference between using a promise, and a call-back function.
There is also the .then() scheme, and the on scheme. I am lost in the details, and can't know the difference between them, and how they work. The only thing I can see is that they can be used interchangeably.


texts: newbie, contract member balance without specific amount

texts:
I'm just learning about coding in general, and fighting my way through an Ethereum course.

I've seen the answers about the "contract member balance is deprecated" issue, but I'm just trying to use it in the following:
function GetMyContractBalance() public constant returns (uint) {
       return this.balance;

I added:

address myAddress = this;

but how do I construct it just using that return function?  I've tried:

require (return (this).balance);
require return (this).balance;
return (this).balance;

aaaannnnddd - I'm pretty much out of ideas.

Thanks in advance.


texts: Are there any oracles available for Bitcoin price? I'd like to do a currency conversion math inside the smart contract code.


texts: Can I write a smart contract to access a database and verify details of a student?

texts:
I have to write a smart contract to create a degree certificate of a student in the University. To generate the certificate, I have to clear all the dues in my University's library, Sport's department, Hostel and Department.So, I have to access the database of a students to verify the student's details and his dues and if everything is fine, I have to sign the verified details with the respective department's private key.Likewise ,it has to happen in every department. After all department's verification is done, I have to write a smart contract to generate a degree certificate and place it in public blockchain so that anyone can verify. My doubt is whether this assignment is possible or not using smart contracts.
Please help me. Any help would be appreciated.Sorry if I have asked something ridiculous.
Thank you


texts: How Accurate is the gas estimation with web3js and web3py? Can these values be trusted? if not, what circumstances will make the gas estimation deviate from the value observed after the transaction is maned?


texts: Private blockchain accounts have no starting ether despite allocating in genesis.json

texts:
I have created a private blockchain as follows:

geth --rpc --nat none --dev --ipcpath "geth.ipc" init genesis.json

Then ran the following commands to enter the geth console and query the balance of an account:

geth
geth attach ipc:\\.\pipe\geth.ipc
eth.getBalance("0x4666f1ee6a79121e1cc0f98fa020c6be13052c8b")

However, this brings back '0' as the balance of the account, though in my genesis.json I give it an allocation of 300000. Adding 0x before the account in genesis.json or in the eth.getBalance command makes no difference.

My genesis.json file referenced here is as follows:

{
    "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "0x400",
    "gasLimit": "2100000",
    "alloc": {
        "4666f1ee6a79121e1cc0f98fa020c6be13052c8b": { "balance": "300000" },
        "f41c74c9ae680c1aa78f42e5647a62f353b7bdde": { "balance": "400000" }
    }
}


texts: Distributing bonus tokens from different erc20 contracts

texts:
I am creating 3 erc20 tokens and I want 2 of these token contracts to be able to send tokens of the 3rd type.
e.g. When I create the third token, I want 1m total supply, but allow 500k to be accessed by the other 2 token contracts.

The idea is to send a bonus amount of the 3rd token to the buyer on purchase (minting) of the other two tokens.

Would the best way to achieve this be sending 500k of the 3rd token to each of the other token contracts upon token creation? Then would the other token contracts be able to access these tokens and distribute them easily?


texts: What's the point of wrapping 'now' in a _now() function that returns 'now'?

texts:
Why people wrap 'now' in _now() function that just returns 'now'?
Found that on xDAI contracts:
function _now() internal view returns (uint256) {
    return now;
}

Is it because in 0.7.0 'now' was removed, and it's easier to make change in code in one place?
Or for testing timing? Or debugging, or smth?


texts:
When I call a function from a child contract which has been generated through a parent contract, then the mapping within the parent contract which consist of information related to the child contract (various global state variables such as name, etc.) does not update its content.  However, the global state variables are updated in the child contract when called.

What could be the issue in terms of the mapping not updating. should I have any mapping updating logic defined within the called child function?


texts:
I don't understand at what are there.

What is  signing Ethereum transaction? What does it mean?


texts: How to use the 'evm' command of go-ethereum?

texts:
I'm just engaging in geth development and was trying to put some changes into evm opcode implementation(functions like opAdd) for debugging.

After compilation done, I found that there is a command 'evm' that allows me to run bytecode without deploying it to a private chain.

However the help message is confusing, and guide about this command is limited. Is there any guide or example to help learn more about the usage of this command? Or I should just keep using 'geth' instead of 'evm'?

Thank you!


texts: What are the roles of ETHDEV, ETHCORE and the Ethereum Foundation?

texts:
I am trying to understand the institutional setup of Ethereum.

I could identify the following institutions: (1) The Ethereum foundation, (2) ETHDEV and (3) ETHCORE.

The foundation (1) is apparently a non-profit foundation based in Switzerland and Vitalik's blog post earlier this month gives some insights into the activities of the foundation. However, I cannot really get a grip on ETHDEV (2) and ETHCORE (3). People-wise there seems to be a significant overlap.


texts: Metamask: Will imported account be lost after seed restoration?

texts:
Since metamask is a HD wallet, in case of storing some imported accounts in my wallet and after wallet restoration, metamask will only be able to restore derived pairs with the exception of imported ones. In other words, I will not be able to restore imported accounts.
Can someone confirm?


texts: Where are the Ethers landing if not in Wallet?

texts:
I get paid from genesis mining couple of times in a month and the pay-outs are transferred to MyEtherWallet account. The status remains 0 ETHs till date.

In MyEtherWallet account the displayed balance is 0 but it shows a HardFork Balance of 0.2879 ether!
Can someone please explain how it works? How can I transfer my Ethers to Bittrex account? Any help would be highöy appreciated.

Many Thx.
Harry


texts: Deploying same contract with different address

texts: Is it possible to deploy the same contract with different addresses? When I try it in truffle, it is able to generate a new contract with a different contract address, but when I do Contract.address it returns the inital contract address I generated and not any of the new ones.


texts: ELI5 the differences between sprites and traditional payment channels

texts: There has been interest[1][2] lately in sprites-style payment channels. Could someone provide a quick comparison?


texts: miner.start(1) triggers but not starting the mining

texts:
I am creating my own private ethereum blockchain.

sudo geth --rpcapi eth,web3,personal --rpc --networkid=15

Above command gives the below logs.

INFO [09-18|10:16:42.151] Maximum peer count                       ETH=25 LES=0 total=25
INFO [09-18|10:16:42.153] Starting peer-to-peer node               instance=Geth/v1.8.15-stable-89451f7c/linux-amd64/go1.10
INFO [09-18|10:16:42.153] Allocated cache and file handles         database=/home/blockchain/.ethereum/geth/chaindata cache=768 handles=512
INFO [09-18|10:16:42.171] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: <nil> Engine: ethash}"
INFO [09-18|10:16:42.171] Disk storage enabled for ethash caches   dir=/home/blockchain/.ethereum/geth/ethash count=3
INFO [09-18|10:16:42.171] Disk storage enabled for ethash DAGs     dir=/home/blockchain/.ethash               count=2
INFO [09-18|10:16:42.171] Initialising Ethereum protocol           versions="[63 62]" network=15
INFO [09-18|10:16:42.173] Loaded most recent local header          number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [09-18|10:16:42.173] Loaded most recent local full block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [09-18|10:16:42.173] Loaded most recent local fast block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [09-18|10:16:42.174] Loaded local transaction journal         transactions=0 dropped=0
INFO [09-18|10:16:42.174] Regenerated local transaction journal    transactions=0 accounts=0
INFO [09-18|10:16:42.174] Starting P2P networking
INFO [09-18|10:16:46.891] UDP listener up                          self=enode://e919e98154dcddc4e6e6f847332795cbaf072607e410c2330702d3b66b4219eb98c4ebf39dc1ee2b21af74049926a5fb646542636f8835eb420157d825cc3102@[::]:30303
INFO [09-18|10:16:46.892] RLPx listener up                         self=enode://e919e98154dcddc4e6e6f847332795cbaf072607e410c2330702d3b66b4219eb98c4ebf39dc1ee2b21af74049926a5fb646542636f8835eb420157d825cc3102@[::]:30303
INFO [09-18|10:16:46.896] IPC endpoint opened                      url=/home/blockchain/.ethereum/geth.ipc
INFO [09-18|10:16:46.897] HTTP endpoint opened                     url=http://127.0.0.1:8545               cors= vhosts=localhost
INFO [09-18|10:16:59.561] Etherbase automatically configured       address=0xa76D511FCddEB3bCCa1Eb5B6bf4EC39a8d95668d

Then i trigger miner.start(1) by getting geth console using sudo geth attach ../.ethereum/geth.ipc so it adds below lines in above logs.

INFO [09-18|10:18:06.859] Updated mining threads                   threads=1
INFO [09-18|10:18:06.860] Transaction pool price threshold updated price=1000000000
INFO [09-18|10:18:06.860] Commit new mining work                   number=1 sealhash=d91037…57fc0d uncles=0 txs=0 gas=0 fees=0 elapsed=648.451µs

And after this nothing happens.

FYI,  miner.start(1) returns null but that is not a problem i guess.

Could you please give me some hints so that i can do possible workarounds to make mining start.


texts: Good Day. I am trying to build a land registry of land titles on the blockchain, with the intention of being able to sell such title to someone else. Therefore, the title eventually has to be transferred to the buyer. How will the title be represented in the blockchain? Should I tokenize it? If so, how? Thank you.


texts: How to detect the balance change in solidity

texts:
In contract, there are always some storage change like token transfer.
I want to detect the token transfer event.
Token always store in contract mapping struct. So how can i detect the mapping change or the variables change in contract storage and recognize this is a token change event?


texts: How to query Uniswap api in order to get the pair ID of a chosen token?

texts:
I am using the Uniswap v2 api subgraph but I am running into a bit of an issue that I cannot resolve.
Basically I want to query the api to get the latest token swaps of a chosen token and Eth.  Using Eth's current price I can accurately get a real-time price of the given token.
But in order to make pair information requests to the api you need to know the pair ID to begin with.
How can I possibly get the pair ID if the pair ID is not stored or apart of the chosen token's id?  I can dynamically get the token's ID from another API and I can use that to query info from Uniswap's api however there seems to be no way to get the actual pairs ID in order to determine the latest swaps.
Here is a sandbox of Uniswaps subgraph API in case anyone wants to try and see if they can pull a coin's pair ID address.
https://thegraph.com/explorer/subgraph/uniswap/uniswap-v2
Edit: to be clear I can get the Pair ID addresses manually by going to uniswap.info however this is not what I want to do.  I want to be able to dynamically search for any erc-20 token and then use that token to pull the latest swaps using the pair ID.


texts:
I wanted to highlight a problem we all suffer from when using third party API's.
Let's say you want to make an ethereum transaction.
Normally the API will return a txid when the request is successful.
But in my example the request has an unknown error.
No txid is returned from the API.

When an API call fails for any reason the standard assumption is that the transaction wasn't successful.
In my experience with almost every API this assumption is completely wrong.
The transaction could still be successful even though the API returns an error. I've seen this multiple times with bitcoind and exchange API's.

So when we receive an error creating a transaction we want to figure out if the transaction was successful or not.
Otherwise you might end up sending the transaction multiple times.
The problem here is that we don't have a txid to do a simple transaction lookup.

Ideally I want to give my own reference ID with every transaction.
This way I don't have to rely on the txid that is given to me by the API.
Sadly this isn't a parameter in the current json-rpc API.

I solved this problem in bitcoind by using the "comment" field for my own reference ID.
I than iterate through the last X amount of transaction and I try to find a match with the transaction comment and reference ID.

Any suggestions on how to solve this problem with Ethereum?


texts:
Last night everything is fine and then this morning I check my mining its's closed I think it was restarted or close accidentally then when I open my pool I have this error.

ETH: 5 pools are specified
Main Ethereum pool is eth-eu1.nanopool.org:9999
At least 16 GB of Virtual Memory is required for multi-GPU systems
Make sure you defined GPU_MAX_ALLOC_PERCENT 100
Be careful with overclocking, use default clocks for first tests
Press "s" for current statistics, "0".."9" to turn on/off cards, "r" to reload pools, "e" or "d" to select current pool
OpenCL initializing...

I already adjust my performance option and restart but nothing happens.

Anyone can help me here? Thankyou


texts:
I am trying to deploy an small private Ethereum network using geth. I have a server running geth configured as a miner in my local network. In the other side I have a droplet in DigitalOcean that I want to use as a bootnode to connect future nodes to my network.

I have executed the following commands in my DigitalOcean Droplet:

 bootnode --genkey=boot.key
 bootnode --nodekey=boot.key --addr:$(MY_PUBLICIP):30301

And I get the following output from the command instead of my public key that I need to introduce as my enode reference in the future nodes:

INFO [10-29|18:13:32.851] New local node record                    seq=1 id=785b198c28c625f8 ip=<nil> udp=0 tcp=0

I introduced a netstat command in order to find out whether or not the program is opening a port.

ether@ubuntu-s-1vcpu-2gb-ams3-01:~$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 localhost:domain        0.0.0.0:*              LISTEN
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*              LISTEN
tcp6       0      0 [::]:ssh                [::]:*                 LISTEN
udp     6912      0 localhost:domain        0.0.0.0:*
udp        0      0 ubuntu-s-1vcpu-2g:30301 0.0.0.0:*
raw6       0      0 [::]:ipv6-icmp          [::]:*                  7
raw6       0      0 [::]:ipv6-icmp          [::]:*                  7

I'm using the standard configuration of the basic droplet DigitalOcean, I would like to know if I should configure something else besides the usual compilation of the geth code.

Could please somebody tell how to interpret the output from the bootnode command?
Thanks any help is welcomed.


texts: Transaction never mined after one day and new transactions were mined since should I worry for the first transaction appearing again?

texts:
Can someone explain what technically happens here?
It might be to specific to myEtherWallet, but I am confused and worried that this stuck/nonexistent transaction would suddenly go through.

On myEtherWallet I sent some ETH yesterday as a bugbounty reward. I got a transaction hash. Each time I check I get TRANSACTION NOT FOUND.
The ETH is still in my account.

I am trying to be patient ;)

This is it, no reason to hide, it's all public anyways:
https://www.myetherwallet.com/?txHash=0x1e9b3ad9a9179fba873934484a11259e3febca11dfa9e696c43b3d542e996198#check-tx-status

I have made several transactions since. Can I consider the transaction dead and safely issue another?

What could cause this? the myEtherWallet node dropping it or not getting through to the etherum plattform? Evil cryptokittens?


texts: Connection not open on send when subscribing to new block headers

texts:
I am running a local ethereum node with the below configuration

  geth --syncmode "full" --datadir "." --ethash.dagdir "." --cache=4096
  --rpc --rpcaddr test.example.com --rpcapi="web3,miner,admin,db,net,eth,personal,debug,txpool" --rpccorsdomain "test.example.com" --rpcvhosts "test.example.com" --ws --wsaddr test.example.com --wsapi="web3,miner,admin,db,net,eth,personal,debug,txpool" --wsorigins "*"

I am listening to new block headers by subscribing to blockchain events. I am using web socket connection.

  web3 version 1.2.4

  let Web3 = new web3('wss://test.example.com/');

  subscription fails after sometimes it is throwing Error connection not
  open on send()

Please provide any suggestions or workaround for this issue. Thanks in advance


texts:
I try something like this:

Child.sol

pragma solidity ^0.4.6;
contract Child {
  address owner;

  function Child() {
    owner = msg.sender;
  }
}

Parent.sol

pragma solidity ^0.4.6;

import "./Child.sol"

contract Parent {

  address owner;

  function Parent(){
    owner = msg.sender;
  }

  function createChild() {
    Child child = new Child()
  }
}

Then I deploy Parent.sol. I can find this transaction on etherscan. Then I call createChild() function, but the contract is not deploying, because I can't find any new transactions.

So the question is, how should I do it right. Thank you.

Or should I just archive all adresses of the Child contracts in Parent contract? Then Parent contract can be really heavy.


texts: Web3 js 1.0 is throwing big number error while transfering tokens

texts:
When I tried to transfer more then 1000 tokens, it's throwing an error like as mentioned below (I'm using web3 js 1.0.0 34 beta version).

  Error: [number-to-bn] while converting number 1e+23 to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported. Given value: "1e+23

Find code examples which I tried.

//var tokens = amount * 1e18;
//var tokens = amount * (10 ** 18);
//var tokens = parseInt(amount) * 1e18;
//var tokens = web3.utils.toBN(amount);
//var tokens = amount * Math.pow(10, decimal)
var tokens = web3.utils.toBN(amount * 1e18) ;

Does anyone faced this issue?


texts:
I have a problem when calling smart contract function using truffle console. Previously I deployed smart contracts on ropsten, and there was no problem when calling smart contract function. Anyone know the problem? Thanks.

pragma solidity >=0.4.21 <0.7.0;

import "./StandardToken.sol";
import "./Owned.sol";

contract Konserta is StandardToken, Owned {
    string public name;
    string public symbol;
    uint256 public tokenprice;
    string public version = "v0.1";
    uint8 public constant decimals = 8;
    uint256 public constant INITIAL_SUPPLY = 700 * (10 ** uint256(decimals));

    constructor() public  {
        name = "Token 1";
        totSupply = INITIAL_SUPPLY;
        balances[msg.sender] = INITIAL_SUPPLY;
        emit Transfer(address(0),msg.sender,INITIAL_SUPPLY);
        symbol = "TKN";
    }

    function getBalanceContract() view public returns(uint256) {
        return address(this).balance;
    }
}

Contract successfully deployed but when I call getBalanceContract() function, the result is

truffle(development)> let instance = await Konserta.at("0xC657b719f2806bcAf98ab3374BE51e7822746E65")
truffle(development)> instance.getBalanceContract()
    Error: Returned error: VM Exception while processing transaction: revert at PromiEvent (/Users/myuser/.nvm/versions/node/v8.10.0/lib/node_modules/truffle/build/webpack:/packages/contract/lib/promievent.js:9:1)
        at TruffleContract.getBalanceContract (/Users/myuser/.nvm/versions/node/v8.10.0/lib/node_modules/truffle/build/webpack:/packages/contract/lib/execute.js:120:1)
        at evalmachine.<anonymous>:0:10
        at sigintHandlersWrap (vm.js:98:15)
        at ContextifyScript.Script.runInContext (vm.js:56:12)
        at runScript (/Users/myuser/.nvm/versions/node/v8.10.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:222:1)
        at Console.interpret (/Users/myuser/.nvm/versions/node/v8.10.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:237:1)
        at ReplManager.interpret (/Users/myuser/.nvm/versions/node/v8.10.0/lib/node_modules/truffle/build/webpack:/packages/core/lib/repl.js:131:1)
        at bound (domain.js:301:14)
        at REPLServer.runBound [as eval] (domain.js:314:12)
        at REPLServer.onLine (repl.js:468:10)
        at emitOne (events.js:116:13)
        at REPLServer.emit (events.js:211:7)
        at REPLServer.Interface._onLine (readline.js:282:10)
        at REPLServer.Interface._line (readline.js:631:8)
        at REPLServer.Interface._ttyWrite (readline.js:911:14)
        at REPLServer.self._ttyWrite (repl.js:537:7)
        at ReadStream.onkeypress (readline.js:160:10)
        at emitTwo (events.js:126:13)
        at ReadStream.emit (events.js:214:7)
        at emitKeys (internal/readline.js:420:14)
        at emitKeys.next (<anonymous>)


texts: web3: How does deploy new contract work? Can attacker fake my worker contract?

texts:
In the following documentation:
https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html

it says that in order to create a new contract from my script with web3 I have to use the "new" keyword and put the ABI code. Is this correct?

If yes, how does it exactly work? Let's consider the following situation:

There is a contract platform, contract worker and interface IWorker where Worker is IWorker.
Platform has an array of IWorker and there is a function AddWorker(address pAddress) which adds a IWorker(pAddress) to the
array
A user using MetaMask, which visits the website can anytime create a worker with simple click, change some variables, add it on
the platform's array or remove
Workers contain some variables and bool working, when it's false, owner can update variables, when true it's forbidden
IWorker has isIdle() function and Worker overrides it with !working
Worker is working (working == true) unless it's removed from the array.
Platform reads getData(address, uint, uint) from worker and might do some work, sometimes even payable

Is attacker able to create a totally different contract with exactly same IWorker interface and even Worker body and same returning variables and be able to change them as he wants to even if this faked contract exists in my array? The simplest way to hack here would be to remove bool working and being able to dynamically update variables - is this possible?


texts: How is the price of a token determined on Etherscan?

texts:
Etherscan API provides several useful statistics, such as the TotalSupply by ContactAddress.
If we take a random token such as Thether USD. As of writing the supply is 25,916,147,047.969263 USDT.
I am wondering what other ingredients we  need to determine the price of this token, which as of writing equals to $0.9974 @ 0.000304 Eth?


texts: What is the Eclipse attack and how was it fixed in Ethereum?

texts:
In this paper the researchers describe the Eclipse attack https://eprint.iacr.org/2015/263.pdf. Can someone explain it briefly, what steps an attacker needs to take to perform the attack and how it will affect the system.

What changes in the code fixed this vulnerability?


texts: IPC Connection not work on Node.js (web3)

texts:
I have a geth node launch on linux, I want to access it through the IPC connection in a Node.js application.
I am getting this error :
/home/**/node_modules/web3-core-helpers/lib/errors.js:66
        const error = new Error(msg);
                      ^

Error: CONNECTION ERROR: Couldn't connect to node on IPC.
    at Object.ConnectionError (/home/**/node_modules/web3-core-helpers/lib/errors.js:66:23)
    at Object.InvalidConnection (/home/**/node_modules/web3-core-helpers/lib/errors.js:36:21)
    at IpcProvider._timeout (/home/**/node_modules/web3-providers-ipc/lib/index.js:158:48)
    at Socket.<anonymous> (/home/**/node_modules/web3-providers-ipc/lib/index.js:86:15)
    at Socket.emit (node:events:390:22)
    at emitErrorNT (node:internal/streams/destroy:188:8)
    at emitErrorCloseNT (node:internal/streams/destroy:153:3)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)
npm ERR! code 1
npm ERR! path /**
npm ERR! command failed
npm ERR! command sh -c node app.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /**/.npm/_logs/2021-03-02T19_17_41_336Z-debug.log

I run geth like this : geth --datadir /mnt/ssd/ethereum --syncmode fast --cache 256 --ipcpath /**/ethereum/geth.ipc --ropsten
geth attach work well with the IPC and WebSocket connection, and the node is fully synchronized
I tried by enabling the WebSocket connection and everything works, only the IPC connection doesn't work on the Node.js app :/
geth version : 1.9.25-stable-e7872729
Node.js version : v15.10.0
Edit 1 :
This is how i connect my Node.js app using web3. The following script work with the WebSocket connection but not with the IPC connection (i get the mentioned error) :
const net = require('net');
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.IpcProvider("ipc://home/**/geth.ipc", net));
//const web3 = new Web3(new Web3.providers.WebsocketProvider("ws://127.0.0.1:8546"));
web3.eth.getBalance("0x0000000000000000000000000000000000000000").then(console.log);

If it's work with WebSocket, is not from Geth & the IPC connection work with geth attach so it's definitely not a Geth issue.
File permission issue ..? I tried sudo chown -R my_username:my_username on my Node.js app directory but i got the same error.
Edit Solved!
Check this dumb error...
When you want to connect via IPC with Web3 you need to specify the path only, without the protocol :
Not Correct :
const web3 = new Web3(new Web3.providers.IpcProvider("ipc://home/**/geth.ipc", net));
Correct :
const web3 = new Web3(new Web3.providers.IpcProvider("/home/**/geth.ipc", net));


texts: Ethminer continue mining and getting new jobs but not making "Submitted and accepted."

texts:
I used 4x1060 6GB, and ethminer on Linux 16 and overlock GPUs
When i start script everythings works ok, but after some hours, everything look ok, I receive new jobs but my miner to making "Submitted and accepted."
I already switch internet from wifi to cable, and same situation.
I think it can be 3 possible problems

Overlocking (possible)

Internet Provider (uploading issues)(i test internet speed and it was fast)

Linux GPU drivers (possible)

Pool(I had others machines, and they are working ok with same pool)

Maybe smbd can advice how to find that problem.


texts: Why do crypto art NFT platforms set their minting token's max supply so low?

texts:
The screenshot shows details about the crypto art platform SuperRare's non-native token "SUPR" for minting NFTs to. I guess this is the token that creators mint their art to.
But it says only 16,248 of these NFTs can be minted based on the max supply field, meaning 16,248 artworks. Is this correct? Why would SuperRare limit themselves that much, when they could've instead allowed millions of NFTs to be minted in the future?
Are the 2,488 "Holders" inclusive of both creators and collectors, or just creators?
Also what does the pop-up info mean, "submit token burn details"? who is a project owner?


texts: Storing state in log vs in contract variable

texts:
I've read somewhere says storing values in logs is cheaper than storing it in the contract's permanent storage. I wondered if it is the case. If yes, why?

More general question: What is the pros and cons of storing a value in a log and storing them in a variable?


texts: Can a Binance SmartChain / BSC full node be run on Windows?

texts: If Geth is available on Windows, shouldn't that mean it's doable, or am I misunderstanding how it works?  I was under the impression that Geth is essentially the node software. Is that not so?


texts: Is there a way to get enode:// addresses of etherscan and infura nodes?

texts:
How can I get enode:// addresses of Infura and Etherscan nodes? Both mainnet and ropsten ones preferably. I would like to add them to my nodes peers list to be able to sync better.

Thanks!


texts: Running a custom private go-ethereum node cluster using docker

texts:
Here is a set up I have been working on and am having issues with ability to create a private network with peers.
Basic set up: Used the dockerfile from https://github.com/ethereum/ethereum-dockers/tree/master/go-ethereum-base, and added a line for installation of Ethereum to the image.

Upon creation of the image, I ran 2 instances of the image, (note that both contain basic custom genesis JSON file)

docker run -it -p 127.0.0.1:30303:30303 -p 3001:3001 --name e1

and

docker run -it -p 127.0.0.1:30304:30304 -p 3002:3002 --name e2 \
  --link e1:e1

Next, I attached to the container, e1 and ran the following command:

geth --identity "ethnode1" --datadir "/tempdatadir1" --rpc         \
  --port "30303" --rpccorsdomain "*" --rpcport "3001"              \
  --genesis genesis.json --networkid 6161                          \
  --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" \
  --rpcapi "db,eth,net,web3" --nat "any" --maxpeers 2 console

This launched a geth console, wherein I am able to check the node info using commands such as admin.nodeInfo, etc. Extracted the enode value for connecting the second node: enode://@[::]:30303

Exit console using Crtl-C

Attached to the container e2, and ran the following command:

geth --identity "ethnode2" --datadir "/tempdatadir2" --rpc         \
  --port "30304" --rpccorsdomain "*" --rpcport "3002"              \
  --genesis genesis.json --networkid 6161                          \
  --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" \
  --rpcapi "db,eth,net,web3" --nat "any" --maxpeers 2 console

This launched a geth console, wherein I am able to check the node info using commands such as admin.nodeInfo, etc. At this point, I tried adding the first node using the following command: admin.addPeer("enode://@127.0.0.1:30303"), which returns true.
However, when I try to list the peers using either admin.Peers, I see an empty array and using net.peerCount gives 0.

Suggestions, as to how the connectivity between the two can be enabled?

Is it that the wrong IP address is being used? In general, is it possible to utilize a specific IP address from the host by forwarding the IP Address appropriately.
Should the console not be exited in Step 2 above?
In either of the above cases, how do we connect to an existing geth instance? I tried using geth attach "http://127.0.0.1:3001", but it gave me an error saying, connection refused. Any suggestions as to how we can attach to an existing geth instance?


texts: Solidity: Error Member "value" not found or not visible after argument dependent look up in the function address

texts:
I am trying to make the funds withdrawn from 3 accounts automatically after a certain event. I am unable to fix this error from the Remix IDE. Please can someone let me  know what am I doing wrong... The function is payable

  Member "value" not found or not visible after argument dependent look up in the function address. Did you forget the "payable" modifier

function SignTermsAndConditions() OnlySender_Receiver_Transporter{
    if(msg.sender == sender){
        require(state == contractState.waitingForVerificationbySender);
        SignedBy("Terms and Conditiond verified : ", msg.sender);
        state = contractState.waitingForVerificationbyTransporter;
    }else if(msg.sender == transporter)
    {
        require(state == contractState.waitingForVerificationbyTransporter);
        SignedBy("Terms and Conditiond verified : ", msg.sender);
        state = contractState.waitingForVerificationbyReceiver;
    }
    else if(msg.sender == receiver){
        require(state == contractState.waitingForVerificationbyReceiver);
        SignedBy("Terms and Conditiond verified : ", msg.sender);
        state = contractState.DoneVerificationofTerms;
        POD_PhysicalItems.withdrawAgreedUponCollateral.value(2*itemPrice)(sender);
        POD_PhysicalItems.withdrawAgreedUponCollateral.value(2*itemPrice)(transporter);
        POD_PhysicalItems.withdrawAgreedUponCollateral.value(2*itemPrice)(receiver);
    }
}

function withdrawAgreedUponCollateral(address entityAddress) payable internal  {
    require(state == contractState.DoneVerificationofTerms);
    collateralWithdrawnSuccessfully("Double deposit is withdrawn successfully from: ", entityAddress);

}


texts: What happens to Ether in a contract after selfdestruct

texts: When calling selfdestruct on a Smart contract, what happens to the Ether inside of the contract?


texts: *contract* has not been deployed to detected network (network/artifact mismatch)

texts:
I'm trying to launch my first DApp using truffle and testrpc. I keep running into the above error once the web page loads. I looked at the Truffle Contract json object and the networks value is empty ({}). This definitely has something to do with it but I'm not sure what the issue is.

Thanks.


texts:
Let's suppose i have 5 customer. Each customer must give me 1 Ether.
I have 2 solutions:

I generate a single Ethereum Address and i give the same address to all my customers.
I do not want to give the same address to all my customers. So i generate 5 Ethereum Adresses.

What i will get:

First case: I will have a single Ethereum Account with 5 Ethers.
Second case: I will have 5 Ethereum accounts, with 1 Ethers on each.

Now, let's suppose i want to buy something which cost 5 Ether.

In first case: I will make a single transaction of 5 Ethers from my single Account
In the second case: I will make 5 transactions because i need to fetch my 1+1+1+1+1 which are on different accounts.

I think i will pay more GAS in second case because i have 5 transaction instead of 1.
But someone told me it was possible to realize 5 transactions in a single transaction. How can this be possible ? Does this person jokes ?
Thanks a lot


texts: Elliptic Key Crytography(ECC) for generating Private & Public Key

texts:
I want to generate Public-Private Key pair using ECC and then import them to Ethereum for creating an account through Geth. I am working on a Windows machine.

What are the steps I should follow for that?

I believe OpenSSL can be used in such a case. How can I proceed with that?


texts:
Contract code:

function getAddressDnaIds(address owner) external view returns(uint256[])
    {
        return addressDnaIds[owner];
}

Code causing the error:

var dna = await this.airdrop.methods.getAddressDnaIds(this.address)
      .call({ from: this.address })

Someone know what is the cause of this error or how to fix it?


texts: Bitcoin and other non-ethereum coins on EtherDelta Exchnage?

texts: Is there a Bitcoin equivalent coin on EtherDelta for trade? Say if I wanted to trade my ether for btc/ltc/doge on the exchange. How would that be possible?


texts: I would like to understand exactly which signatures are used in the Ethereum. Here https://bitcoin.stackexchange.com/questions/12554/why-the-signature-is-always-65-13232-bytes-long it says that there are DER encoded and custom encoded (also called recoverable) signatures in bitcoin. Can I use both types of these signatures in Ethereum? Are there any types besides these two? Is it possible to convert one type to another?


texts: Do state tree key/vaue maps reference state trees from other blocks?

texts: Each block includes both a state root and the whole state tree. In the state trees, do key/value maps reference state trees from other blocks ?


texts: Ethereum's purpose is to decentralize components in the network. There is only   one state trie in the network, Can't it be hacked and changed (because there is only one trie) ?


texts: Python: How make Ethereum tx without web3.py?

texts:
make a simple eth raw tx and self sign without web3

I only need generate a eth raw transaction and self sign , web3.py is bloated.

I generate lots of eth address using python like this:

def create_wallet():
    keccak = sha3.keccak_256()
    private_key = SigningKey.generate(curve=SECP256k1)
    public_key = private_key.get_verifying_key().to_string()

    keccak.update(public_key)

    address = '0x%s' % keccak.hexdigest()[24:]

    private_key = binascii.hexlify(private_key.to_string())
    public_key = binascii.hexlify(public_key)

    return {
        "private_key": private_key.decode(),
        "public_key": public_key.decode(),
        "address": address
    }

now i want make a simple raw transaction and sign it


texts: Let two clients trigger each others' event (request-response)

texts:
What I'm trying to achieve with 2 clients running on my computer (same, private network):

client1 makes a request by sending a value k
 client1 starts to listen for an answer to the request
 client2 is listening for such a request
 client2's event listener is triggered
 client2 then performs an action (sends k+1 to the contract as a response)
 client2 starts listening for a new request
 client1's event listener is triggered - she got an answer to her request
 client1 sends a new request (k+1)

I have tried a number of variants of the code below, with varying degrees of (un)success - either one client keeps pumping out requests/responses (like in the example below) or one of them sends its data, and the other reads it multiple times (?) and acts accordingly (i.e. starts sending out as many requests/responses as it has received events). I of course want each client to wait until its event is triggered and then just perform its action and go back to waiting. Would really appreciate some help with this!

This is the JavaScript web3js code (process1 is called with a 0 in the first run).

function process1(k){
  myContract.query(k, 2000000, {from: web3.eth.accounts[0]});
  myContract.responding({}, {fromBlock: 'latest', toBlock: 'latest'}).watch((error, eventResult) => {
    if (error)
    console.log('Error: ' + error);
    else{
      console.log('myEvent: ' + JSON.stringify(eventResult));
      k=eventResult.args.r;
      k++;
      myContract.responding({}, {}).stopWatching();
      process1(k);
    }
  });
}

function process2(){
  myContract.asking({}, {fromBlock: 'latest', toBlock: 'latest'}).watch((error, eventResult) => {
    if (error)
    console.log('Error: ' + error);
    else{
      console.log('myEvent: ' + JSON.stringify(eventResult));
      k=eventResult.args.q;
      k++;
      myContract.response(k, 2000000, {from: web3.eth.accounts[0]});
      myContract.asking({},{}).stopWatching();
      process2();
    }
  });
}

This is the Solidity contract:

pragma solidity ^0.4.9;

contract Testing {

  function Testing() payable {
  }

  event asking (address sender, uint q);
  event responding (address sender, uint r);

  function query(uint q){
    asking(msg.sender, q);
  }

  function response(uint r){
    responding(msg.sender, r);
  }
}

Output:

myEvent: {
"address":"0x7dae29167d71e027a56672b6cba6d6f32b68456f",
"blockNumber":6985,
"transactionHash":"0xdef57d92d37166d54673d128bd56f8e170a11ba84695395f5b06fac723450d90",
"transactionIndex":0,
"blockHash":"0xd9e58ebdce3d3803771ea6f9c6d8d71d58ab94920a781be2fdae6ac8de7e1db5",
"logIndex":0,
"removed":false,
"event":"asking",
"args":{"sender":"0x197d8fc7da84f7ee0a763db8d759255d1341e906","q":"0"}
}


texts: BAD BLOCK and "invalid difficulty" error when syncing ropsten testnet in geth

texts:
I had been connecting to the ropsten testnet for the past couple months in geth with no issues, and able to quickly sync to the latest block. Now when I connect to ropsten as follows (as I've always done):

geth --testnet --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024  --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"

geth attach

I get the following error every few minutes while it tries to sync:

  [09-29|19:31:30]

  #### BAD BLOCK ######### Chain config: {ChainID: 3 Homestead: 0 DAO:  DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10

  Metropolis: 9223372036854775807 Engine: ethash}

  Number: 1700000 Hash:
  0x279a2890d2b9d9c80da96d052173a5ea281417741aec6bc109efd1e779c2c83c

  Error: invalid difficulty: have 11864637714, want 11858882854

  #

In any case it's also only importing a handful of blocks a minute and it's only up to block 1731643 now, when at the time of writing ropsten is up to block 1769191 (so at this rate it'll never catch up).

I haven't found any information on the "invalid difficulty" error.


texts: What is the Long-Range-Attack in Proof-of-Stake? And how will this vector be mitigated with the Casper Proof-of-Stake implementation?


texts: How to disable 'Gas requirement not constant' warning in Solidity

texts:
I keep getting these warnings when compiling Solidity code:

Gas requirement of function [...] unknown or not constant.

I know that the gas requirement is not constant, and I've implemented a calculation to set an appropriate gas limit in my DApp's user interface.

Since I have addressed the issue, is there a way to disable this warning for a specific function or globally?


texts: Implications/Impact Analysis of increasing the transaction size to 64KB in tx_pool.go to support bigger bytecodes deployment

texts:
As I have increased the transaction size to 64KB in tx_pool.go and rebuilt geth to support bigger bytecodes deployment (i.e., bigger, more complex and sophisticated smart contracts), would like to know if there could be any unforseen implications/impact?

Thank you.


texts: using geth - retrieved ancestor is invalid

texts: I've recently started receiving the error "retrieved ancestor is invalid" when trying to sync my geth node with testnet using geth --rpcapi personal,db,db,eth,net,web3 --rpc --testnet. The sync runs great for a while (my last attempt synced up to block 207998), but this error pops up and nothing else will sync. I have upgraded my geth to 1.7.2-stable and have cleared my testnet chaindata twice, but I'm still having this issue. Any suggestions? I'm at a bit of a loss.


texts: CUDA ERROR : Cannot allocate big buffer for DAG

texts:
Windows Config
Windows 10
Ram 8GB DDR4
1TB HDD
Vertual Ram set max at 20000mb

Still having CUDA error.

GPU GTX 1060 3 GB x 2
GPU GTX 1060 6 GB x 3

Total 5 GPU


texts: Rinkeby transaction taking too much time

texts:
I've sent from one of my accounts to another account some ether's the transaction is verified but the ethers on both accounts are not updated

Transaction Hash: https://rinkeby.etherscan.io/tx/0xa2ef91d1200d50c6cb5b024987a27d5c2a35de86e69b15bffde9e5a8db80b218

UPDATE:
I added one more transaction in the opposite direction which doesn't seem to finish as well:
https://rinkeby.etherscan.io/tx/0x527a7cbb7e8b7af142dd40d0b89305d2694424ed548a4a1a6ec25846d7e75e23


texts: How to SHA3 strings and integers with Javascript

texts:
I want to hash two values(integer and string) in contract and get the same hash using these values at backend, but can't quite figure out what to do. Here are contract and JS code below.

pragma solidity ^0.4.0;
contract Contract {
    function hashIt(string a, uint b) returns(bytes32){
        return sha3(a, b);
    }
}

Input: "1", 1

Output: 0x79e6f3a7968620dde8ba64f1f6d03f034d481c27d094c568f6475e60a9dbc4dc

ethutils.bufferToHex(ethutils.sha3());

Input: ["1", 1],

Output: 0x4535a04e923af75e64a9f6cdfb922004b40beec0649d36cf6ea095b7c4975cae

web3.sha3()

Input: "1", 1

Output: 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6


texts:
I have a payable function that transfers ether to contract.

function test(...) public payable returns (bool) {
    ...
    address(this).transfer(msg.value);

    return true;
}

I found that above method fails without having a fallback function in the contract.

function () payable public {}

Can anyone explain this please?


texts:
Simple issue but couldn't find solution. When I run a console to interact with a function that returns uint in a smart contract, it shows in hexadecimal notation. Like this:

<BN: a>
(meaning the value 10 in decimal)

How do I specify the output format so I can see the value in decimal?
I don't think it's necessary for that matter, but the coding is as follows:

uint dist;
function getDist() public view returns (uint distancia){
    return dist;
}


texts: Using the Ethereum storage for document certification

texts:
I am working on a Document certification platform that is based on ethereum and I wanted to know if it is possible to use the ethereum storage as a way to keep the records of documents.

I know that the ethereum storage is not immutable like the blockchain is.


texts: Truffle: Migrate to ropsten, unknown network "true" error

texts:
I am trying to deploy a work in progress dapp to the ropsten network using:

truffle migrate --network ropsten

I have a geth instance running in terminal and I receive the following error:

Unknown network "true". See your Truffle configuration file for available networks.

This is my truffle.js file:

    module.exports = {
      networks: {
        development: {
          host: "localhost",
          port: 8545,
          network_id: "*" // Match any network id
        },
        ropsten: {
          network_id: 3,
          host: "localhost",
          from: "<<Address is usually here>>",
          port: 8545,
          gas: 2900000
        }
      }
    };

EDIT: I am using ubuntu for development


texts: Modify Struct on Upgradeable Smart Contracts

texts:
I have reviewed some techniques around Upgradeable smart contracts from starting point(Elena Dimitrova's Eternal Storage) to zeppelinOS's Unstructured Storage pattern. As I understood from posts that I have read, there is no secure&best pattern. Instead, the technique can vary dependent to your dApp design and business model. As far, most of the community thinks that zeppelinOS's approach is state of art.

I have a pain point on determining the strategy and ask for help to clarify my mind. In assumed scenario, I am required to hold identities of citizens for government on public ethereum chain. I have deployed a contract with following structure:

Contract CitizenController{
    ...
    struct Person{
        bytes name;
        uint birthDate;
        bool gender;
    }

    mapping (address => Person) people;
    ...
}

And the government suddenly made a new regulation that forbids holding gender publicly available data. And also they made storing irisInfo mandatory on publicly available data. Therefore, I am required to modify my struct to :

struct Person{
    bytes name;
    uint birthDate;
    bytes irisInfo;
}

I would not require gender any more and must store irisInfo in smart contract. In my comprehension, it can be achieved using Eternal Storage as the data is stored as KeyValue Pairs. Still, I can not say that it is not possible using Proxy Contracts.

In summary, is it possible to modify struct(add/delete field) in upgradeable proxy contracts ? If that is the case, could you provide a sample code like above ? If not, do you think that it would be possible soon ?

PS: I am open to reading suggestions about upgradeable smart contracts or rabbit holes of solidity


texts: how to implement privcacy-preserving light clients on Ethereum?

texts:
background：One key example is that can be used to implement privacy-preserving light clients (the light client hands the server an encrypted index i, the server computes and returns data[0] * (i = 0) + data[1] * (i = 1) + ... + data[n] * (i = n), where data[i] is the i'th piece of data in a block or state along with its Merkle branch and (i = k) is an expression that returns 1 if i = k and otherwise 0; the light client gets the data it needs and the server learns nothing about what the light client asked).
question:I want to know where the index is in ethereum source code?
how to implement pricacy-preserving communication between client and light based on index?


texts: How did 1inch token contract get the special address?

texts:
The 1Inch Exchange token contract address is 0x111111111117dc0aa78b770fa6a738034120c302, which is the same on both Ethereum mainnet and Binance Smart Chain mainnet.
As I understand, when deploying a contract, there is no way to specify an address. Am I wrong?
The two deployments on ETH and BSC are separate, so 1Inch managed to not only get a special contract address for their token, but also did that twice. What techniques can be used to accomplish this?


texts:
I have a function where one of its arguments is a string.
How would I check the string for leading and trailing whitespaces and remove those characters?

If i get something like this:

"    " => ""

or

"     foo" => "foo"

or

"foo     " => "foo"

In PHP I can use the method trim and it returns the string with whitespaces stripped from the beginning and end.

I did not find any solution on StackExchange.

How do I do a trim in solidity?


texts: Transaction stuck because of low gas price

texts:
i accidentally put the lowest gas price possible when i am about to send my eth.. is there any way to cancel / re-make my transaction??

i have read some articles telling that i should out-gassed my ether scan tx once.
here is my TX 0x7d4ca2478225e3e496b0e5e2b31a7baa2761954cb4db81355f81c74181f4efea..
https://etherscan.io/tx/0x7d4ca2478225e3e496b0e5e2b31a7baa2761954cb4db81355f81c74181f4efea


texts: Can I add leading zeroes at will when building an RLP-encoded transaction?

texts:
Suppose I'm building a transaction such as:

const raw = [
    new Buffer("0001", "hex"),
    new Buffer("23000000000", "hex"),
    new Buffer("21000", "hex"),
    new Buffer("0x00000000000000000000"),
    new Buffer("0xde0b6b3a7640000"),
    new Buffer("0x1234abcd")
]
const encoded = RLP.encode(raw);

Can I freely add/remove leading zeroes of those buffers without affecting the meaning of the message?


texts: ”:ENCODING/HEX: ODD LENGTH HEX STRING” error sending ETH [will pay 1 ETH bounty]

texts:
When I try to send Ether I get an error code that says:ENCODING/HEX: ODD LENGTH HEX STRING. Here the history, my PC had had issues working properly so I did a system recovery, then rebooted Mist wallet and recovered my keystore. However I have one issue I am concerned with that might be affecting it, I didn't save my keystore on a drive, instead, I printed it on paper (weird I know) and retyped the text character for character as it was on my printed copy of the original keystore. Now I can't send Ether or tokens but I can receive them with no problems.

Version: 0.9.0
OS & Version: osx
Node type: geth 1.6.6
Full Sync

My console is reading:

12consoleLogCapture.js:44 Unhandled rejection VersionError: The requested version (1) is less than the existing version (2). @ file:///Applications/Ethereum%20Wallet.app/Contents/Resources/app.asar/interface/wallet/3e2c5ebd8efbf7fc573dced0138d300ec5a4bff9.js:212:20967)
consoleLogCapture.js:44 Node started syncing, stopping app operation @ file:///Applications/Ethereum%20Wallet.app/Contents/Resources/app.asar/interface/wallet/3e2c5ebd8efbf7fc573dced0138d300ec5a4bff9.js:372:601
file:///Applications/Ethereum%20Wallet.app/Contents/Resources/app.asar/inte…/wallet/packages/ethereum_dapp-styles/fonts/SourceSansPro-ExtraLightIt.otf Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///sockjs/info?cb=k2g5d5vryg Failed to load resource: net::ERR_FILE_NOT_FOUND
3e2c5eb….js:416 renderAccountPage: 56.296ms
3e2c5eb….js:416 renderAccountPage: 26.191ms


texts:
This is the error i get.

  ParserError: Expected pragma, import directive or
  contract/interface/library definition.

This is my Solidity contract code.

pragma solidity ^0.4.6

contract Inbox
{

    string public message;

    function Inbox(string intialMessage){
        message = intialMessage;
    }
    function setMessage(string newMessage){
        message = newMessage;
    }

}

I cannot figure out why this parse error is occurring. I tried changing the solidity version as well. Didn't work out.


texts: How to sign transaction and send it via geth console?

texts:
According to https://github.com/ethereum/wiki/wiki/JSON-RPC .There are only two method to sign messages eth_sign and personal_sign . I think they're meant to sign message rather than transaction.However,as there are no any other method to sign transaction I planned to try them out.

I tried:
personal.sign("{'to':'0x177daf75686029aea26afa49d4e771e73bfc379c','value':'1000000000000000000','gas':2000000}",”0xa4916400009dd529d9c647e3088e776faa0a7168","asdf”)

on geth console and have already unlocked account for signing address.Then it showed error message as :

Error: invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go value of type hexutil.Bytes

Thereafter, I used sha3 to convert the json to hex as:

personal.sign(web3.sha3("{'to':'0x177daf75686029aea26afa49d4e771e73bfc379c','value':'1000000000000000000','gas':2000000}"),”0xa4916400009dd529d9c647e3088e776faa0a7168","asdf”)

This returned 0xf1ed845050ba57e2ca7a233f958f59f28df2fd5bc7d28fa69eb822e56b589e4c01c992cd285e7207361b15acdf73317c9ddeedc383173f6a92a2d3e78aa4f2531c in console.

I tried to confirm if it is valid signed transaction.Hence,I tried to push it on https://etherscan.io/pushTx.The site showed following error:

Unable to broadcast Tx : {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"rlp: expected input string or byte for uint64, decoding into (types.Transaction)(types.txdata).AccountNonce"}}.

Please can anyone give me solution how to generate signed transaction on geth console?


texts: Can a function with the same name as the contract be declared both as a function and a constructor?

texts:
A function with the same name as the contract is normally a constructor and it’s bytecode isn’t included in the resulting contract.

But is there a way to declare a function with the same name as the declared contract name so it’s both a constructor and a function inside the resulting contract with a signature in the function selector bytecode ?

If yes, was it introduced recently or is it part of the language nearly since the beginning ?


texts: What other blockchains support the EVM execution model?

texts:
In essence I'm interested in which other chains (mostly Layer 1) I can deploy Solidity smart contracts to?
I know of TRON. And I also know Cosmos, Polkadot and NEAR have at least some support. But does anybody know more details here and/or other blockchains with EVM support? I think Cardano also has planned EVM support for the future.


texts: Store data on ethereum block chain using react js

texts:
I'm trying to store data on ethereum blockchain by doing this

import storemetadata from "./storemetadata";

where i have the smart contract ABI in storemetadata
I now add name like so

storemetadata.methods.setName(1, 1, 0, "a", "b", "c").send(
    {
      from: accounts[0]
    },
    (error, transactionHash) => {
      this.setState({ transactionHash });
      console.log(error, "store name on blockchain", transactionHash);
    }
  );

now if i get data i get null, However if i use truffle console and do the following i can set and get data

SimpleStorage.deployed().then(function(instance) {app =instance})
app.setName(1,1,1,"dfg","yyt","drt")

not sure what I am missing. please help


texts: OpenZeppelin balanceOf(address) function Vs Mapping

texts:
The OpenZeppelin ERC-721 library has a function called balanceOf(address owner), which enables one to know how many tokens an address owns. Furthermore, one can also use a mapping in order to keep track of how many tokens an address owns, such as mapping(address => uint) ownerCount.
What are the advantages of using one over the other (in terms of gas cost and performance for instance), and when should one be used instead of the other?
Thank you. J


texts: Why cannot I get uint returns without 'view' modifier?

texts:
I have very simple contract as..

contract myContract {
    function foo() public returns(uint) {
        return 10;
    }

    function foo1() public view returns(uint) {
        return 10;
    }
}

But when I test my contract with truffle test.js(as follows).
Why the result is different with view and without view modifier?

here is parts of my test.js.

temp1 = await instant.foo1();
console.log("temp1 value : " + temp1);
assert.equal(temp1, 10, "should be 10 return");
temp1 = await instant.foo();
console.log("temp1 value : " + temp1);
assert.equal(temp1, 10, "should be 10 return");

And it is my result.


texts: Ethereum Solidity smart contract code Input Output Testing

texts:
I have written a solidity based smart contract. I need to test the code on web browser and mobile app. Please suggest the steps what I should do to test and execute the code on -

Web browser:- I am aware about Mocha and Metamask but do not know
how to interface the smart contract code to be tested on Mocha or
Metamask. Any pointers or tutorials are well appreciated.
Mobile App:- What and how should I execute the smart contract code
on Mobile App. Any pointers or tutorials are well appreciated.


texts:
Suppose I have the following sentence in writing:

"MyCoolDApp is an application built on the Ethereum _______."

What is the best word in the blank? Platform, Network, System, or Blockchain?


texts: eth.getBalance(eth.accounts[0]) always 0 on geth console

texts:
I want to deploy smart contract on rinkeby test network. I create account in Rinkeby test network.And connect with "Ethereum geth node".I successfully funded "https://faucet.rinkeby.io/". I also check balance in requesting account address on "https://rinkeby.etherscan.io/address/ce82bd5a2a5ea3582446ae117576278fee5dee3f".

But when I check on geth console with eth.getBalance(eth.accounts[0]) so account balance is 0.Also when I check eth.accounts[4]) to eth.accounts[7] so it show value 3000000000000000000. And "eth.accounts[8]" is my original funded balance 7500000000000000000. " It is the request account address value.eth.syncing" is also False.

So My question is why eth.accounts[0] balance is 0 and other accounts value 3000000000000000000? .Why eth.syncing is False?.While I connect ethereum node to rinkeby test-network last 15  hours??


texts: Is it possible to issue an Ethereum token with its own proof of work algorithm?

texts: If I want to issue a token on Ethereum, but have that token function according to its own proof of work algorithm (for example, double SHA256 like Bitcoin), is it possible to do that?  And if so how could I implement it?


texts: GETH ~ why do i get ERROR: no space left on device

texts:
While downloading blockchain im getting this error

  Fatal: Error starting protocol stack: write /root/.ethereum/geth/chaindata/230944.ldb: no space left on device

how this can be resolved? Im downloading it for learning purpose, so i can learn to develop ETH based websites and wallets and mining etc...


texts: Truffle Console not working, opens truffle.js instead.

texts:
Am currently trying to learn Dapps, and trying to initiate Truffle. But, when I use the command "truffle console" in the Git CMD window, rather than opening the console, it opens up the 'truffle.js' file in my Adobe Brackets for editing.
Not sure what to do here.
Am attaching the images of the input and the output.


texts:
I can subscribe to all events in ethereum network (logs, pendingTransaction etc) so I can get only newly generated events (while I am subscribed). For my analysis I need to retrieve all logs from block0 to blockN(current). How can I do that using web3js?

Please note I am not interested in past events of my contract or account etc. I need all events on ethereum from beginning


texts: ERC20 token standards have a variable call decimals but all its functions parameters are uint256, how can I send tokens in decimals. Ex: 0.01 MFT (MyFirstToken)


texts: Solidity OpenZeppelin Documentation: Import other Contract not working

texts:
I just completed the whole documentation for OpenZeppelin and everything was working fine except the import command.
I created a folder in the folder Contracts and placed Auth.sol in there.
Paths:
[myContract\contracts\Box.sol]
[myContract\contracts\access-control\Auth.sol]
In Box.sol i placed following line right before opening contract Box{}
import "./access-control/Auth.sol";

Then i want to compile with
npx oz compile

and get the following error:
× Compiling contracts with solc 0.7.0 (commit.9e61f22b)
Compilation errors:
contracts\Box.sol:4:1: ParserError: Source "access-control/Auth.sol" not found: File import callback not supported
import "./access-control/Auth.sol";
^-------------------------^

When i try
import "openzeppelin-solidity/contracts/access-control/Auth.sol";

I get:
Could not find openzeppelin-solidity/contracts/access-control/Auth.sol imported from C:\Users\R...\Desktop\dev\myContract\contracts\Box.sol
× Compiling contracts with solc 0.7.0 (commit.9e61f92b)
Compilation errors:
contracts\Box.sol:4:1: ParserError: Source "openzeppelin-solidity/contracts/access-control/Auth.sol" not found: File import callback not supported
import "openzeppelin-solidity/contracts/access-control/Auth.sol";
^-------------------------------------------------------^

I tried several things like changin to an absoluth path or do it without dot (.) but nothing worked for me. Could anyone help me here?
Link to OZ topic


texts: Is it possible to provide some manual data to create private key for the ethereum account?

texts: We were trying to provide some manual data to create the private key if I want to create a new ethereum account using this private key.


texts: How can I return dynamic string array in Solidity?

texts:
How can I return a dynamic string array? I came across serialization and deserialization. How can I serialize and deserialize dynamic string array ?

pragma solidity ^0.5.0;

contract Abc{
    string[] st;

    function add(string memory newValue) public {
        st.push(newValue);
    }

    // return st


texts:
I am trying to retrieve the sender address within a transaction in Go and I am facing some issues.
As I understand, in order to retrieve the sender of a transaction, you can either try to get the signer of a transaction via the EIP155Signer type, treat the transaction as a message and try to get the .From() field or try to calculate the sender address by the rsv parameters of ECDSA .
I have implemented the first two functions and none of them seem to work properly though. Below you can see both the implementations.
Signer attempt:
func GetSender(transaction *types.Transaction) (*string, *error) {

    signer:= types.NewEIP155Signer(transaction.ChainId())

    sender, err := signer.Sender(transaction)

    if err == nil {

            return nil, &err

    }

    res := sender.String()

    return &res, nil

}

As message attempt:
func GetSender(transaction *types.Transaction) (*string, *error) {

connection, error := connectionUtils.EstablishConnection()

if error != nil {

    return nil, &error

}

chainID, error := connection.NetworkID(context.Background())

if error != nil {

    return nil, &error

}

message, error := transaction.AsMessage(types.NewEIP155Signer(chainID))

if error == nil {

    return nil, &error
}

ok := message.From().String()
return &ok, nil

}

This is the test function:
func TestGetSender(t *testing.T) {

    conn, _ := connectionUtils.EstablishConnection()

    txHash := common.HexToHash("0xa85ecc39970bc571c3d4f3b68f9b44de9bb0542748f3ecf2d9179c5229bea532")

    tx, _, _ := conn.TransactionByHash(context.Background(), txHash)

    res, err := GetSender(tx)

    if *err != nil {

            t.Fatalf("FAILED, Could not get the signer of the transaction")

    }

    if *res == "0x28ed88c5f72c4e6dfc704f4cc71a4b7756bc4dbc" {

            t.Logf("PASSED: Could verify the sender of a trnasaction")

    } else {

            t.Errorf("FAILED: COuld not verify the sender of a transaction")

    }

}

The establishConnection is a wrapper for the client and it is working as expected(passing the tests and returning a valid connection).
This is the terminal output when I am using both these functions:
--- FAIL: TestGetSender (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x79fd1c]

goroutine 18 [running]:
testing.tRunner.func1(0xc00017c000)
/usr/lib/go-1.13/src/testing/testing.go:874 +0x3a3
panic(0x823da0, 0xba9d60)
/usr/lib/go-1.13/src/runtime/panic.go:679 +0x1b2
transactionUtils.TestGetSender(0xc00017c000)
/home/xyderos/artemis/utils/transactionUtils/transactionUtils_test.go:49 +0xcc
testing.tRunner(0xc00017c000, 0x8bb9d8)
/usr/lib/go-1.13/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
/usr/lib/go-1.13/src/testing/testing.go:960 +0x350
exit status 2
FAIL    transactionUtils    0.020s

I am running a Go-Ethereum node in fast mode with snapshot disabled. I believe the node is fully synced (not sure, imported all the headers and now it constantly imports new chain segments) with snapshot = false since I want to focus on syncing the node and benching my machine with that.
Anyone has an idea of what is wrong or a possible explanation?
I was thinking that if my solutions are not correct, I should try to retrieve the sender via the rsv parameters.
Thank you for your time in advance!


texts: How to fix "Transaction Error. Exception thrown in contract code."

texts: How do I determine what functions aren't implementing? I will paste the code from both the token and crowdsale contract if needed (which I suspect it will be).


texts: what are the possible ways to create block quickly

texts:
I have a private blockchain network. When I send a transaction, it goes to pendingtransaction.  Once miners complete mining, it stores into the block. This process takes lots of time.

How can I store transaction quickly (within few seconds)?

Can we decrease time interval between blocks so that i don't need to wait?
Can i increase mining speed?
Or
Is there another way to solve it?


texts: What is the default cache value of Geth?

texts:
According to the help page of Geth, --cache value defines
Megabytes of memory allocated to internal caching (default = 4096 mainnet full node, 128 light mode) (default: 1024)

I don't quite get it, is the default 4096 or 1024 when running with the defaults (i.e. fast sync, automatically switching to full mode later on)?
And is there a way I can check this (e.g. with the Geth JavaScript console)?
I'm asking because I assume I've got some memory issues on a Intel Pentium NUC with 8 GB of RAM. Maybe, if the default is 4 GB, it helps setting --cache 1024 to avoid these memory issues.


texts: How do I set up the azure truffle boxes?

texts:
Hi I was looking through the newly added azure-boxes on truffle boxes such as the azure-simple-marketplace-box and was wondering how to set up the front-end for these boxes.

Is it just suppose to be a smart contract that can be deployed to testnets? Or do I need to use use and install azure?

If anyone knows anything please help me? :)


texts:
I wanted to run web3.js in the browsers of my users. The tasks range from extracting token name and token symbol from token address to deploying contracts.

But for example Ethereum Wallet starts slowly. I assume (right?) that web3.js would also load slowly.

What are the ways to overcome this problem? Should I run a node (which software does this?) on my server? If yes, can I make my node to serve only to my clients (not to everybody in the Net) in order not to become slow?

Or maybe the above described problem makes using web3.js unfeasible at all? Should I instead interact with the user using Python (my primary programming language for the project) AJAX, without web3.js?


texts: Separate contract calling mint from token contract

texts:
I have a standard ERC20 token contract with minting functions:

pragma solidity ^0.4.11;

import "./Stake.sol";
import "./Mint.sol";

contract Token is Stake, Mint {
    //omitted standard ERC20 text
}

The minting contract that this inherits from is the following:

pragma solidity ^0.4.11;

import "./BaseToken.sol";

contract Mint is BaseToken {

  // Mint state
  address public centralMinter;
  uint256 public totalMinted;

  // modifer
  modifier onlyMinter {
    if (msg.sender != centralMinter) revert();
    _;
  }
  function Mint() {
    // constructor
  }

  function mint(address _to, uint256 _amountToMint) onlyMinter() {
    balances[_to] += _amountToMint;
    totalSupply += _amountToMint;
    Transfer(this, _to, _amountToMint);
  }
}

Now, I have a Relay contract that inherits Token:

pragma solidity ^0.4.11;

import "./Token.sol";

contract Relay is Token {

  uint256 public approvalCount;
  function Relay() {
    // constructor
  }

  modifier onlyOwner {
    if (msg.sender != owner) revert();
    _;
  }

  function approveTransaction() {
    approvalCount += 1;

    if (approvalCount == 3) {

      mint(msg.sender, 1);
      kill();
    }
  }

  function kill() onlyOwner() {
    selfdestruct(owner);
  }

}

This Relay contract gets created by a separate contract. I run through everything in the truffle console and on the 3rd approveTransaction call I get the following:

truffle(development)> relay.approveTransaction()
Error: VM Exception while processing transaction: invalid opcode
at Object.InvalidResponse     (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:37312:16)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:220420:36
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:204149:9
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:205574:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:73069:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:73359:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:73514:12)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:73474:24)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)

Not really sure why this is happening. At first I thought it was because of the onlyMinter, but that wasn't it. The minted tokens are supposed to go to some arbitrary address. Any ideas? Thank you.


texts: Why is there a difference between bytecode size of same file but with different solidity compiler?

texts:
I am compiling following code using Remix IDE.

contract Ballot {

    struct Voter {
        uint weight;
        bool voted;
        uint8 vote;
        address delegate;
    }
    struct Proposal {
        uint voteCount;
    }

    address chairperson;
    mapping(address => Voter) voters;
    Proposal[] proposals;

    /// Create a new ballot with $(_numProposals) different proposals.
    constructor(uint8 _numProposals) public {
        chairperson = msg.sender;
        voters[chairperson].weight = 1;
        proposals.length = _numProposals;
    }

    /// Give $(toVoter) the right to vote on this ballot.
    /// May only be called by $(chairperson).
    function giveRightToVote(address toVoter) public {
        if (msg.sender != chairperson || voters[toVoter].voted) return;
        voters[toVoter].weight = 1;
    }

    /// Delegate your vote to the voter $(to).
    function delegate(address to) public {
        Voter storage sender = voters[msg.sender]; // assigns reference
        if (sender.voted) return;
        while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender)
            to = voters[to].delegate;
        if (to == msg.sender) return;
        sender.voted = true;
        sender.delegate = to;
        Voter storage delegateTo = voters[to];
        if (delegateTo.voted)
            proposals[delegateTo.vote].voteCount += sender.weight;
        else
            delegateTo.weight += sender.weight;
    }

    /// Give a single vote to proposal $(toProposal).
    function vote(uint8 toProposal) public {
        Voter storage sender = voters[msg.sender];
        if (sender.voted || toProposal >= proposals.length) return;
        sender.voted = true;
        sender.vote = toProposal;
        proposals[toProposal].voteCount += sender.weight;
    }

    function winningProposal() public constant returns (uint8 _winningProposal) {
        uint256 winningVoteCount = 0;
        for (uint8 prop = 0; prop < proposals.length; prop++)
            if (proposals[prop].voteCount > winningVoteCount) {
                winningVoteCount = proposals[prop].voteCount;
                _winningProposal = prop;
            }
    }
}

First, I compiled the code with version 0.4.19 and then compiled same code by changing version to 0.4.25. The bytecode size is greater for version 0.4.25.

I was working with a smart contract in my system, I changed the version of all the smart contract to 0.4.25 from 0.4.19. Because 1 smart contract is not getting deployed as the size is getting increased.


texts: web3.py - How does web3.auto choose a provider node?

texts:
I'm having this other issue which has forced me to rely on either Infura or web3.auto in order to call getTransactionReceipt.  I've noticed that when I create a w3 instance from web3.auto it almost always successfully returns a receipt when I call getTransactionReceipt. This leads me to wonder how web3.auto chooses a provider node:

Does it only select full nodes?
Does it ever select parity pruning nodes or light nodes?
Are there any other restrictions?

I'm curious for 1, and for 2 I'd like to use this answer to apply it to my above-linked issue to see if I can determine why my parity node always returns None when I call getTransactionReceipt.


texts:
I'm creating an authentication system using python and web3.py.
I'm trying to authenticate a user using

from web3.auto import w3

msg = 'sdb41554xcb4xc548cxd84dxcb'
message = encode_defunct(text=msg)
signed_message = w3.eth.account.sign_message(message, private_key=private_key)
x = w3.eth.account.recover_message(message, signature=signed_message.signature)

if x.lower() == addr.lower():
     return 'AUTHENTICATED'

where addr is the account address of the user store in DB.

For this, the user has to provide his private_key every time. But what I want is that the user only provides the passphrase(which was earlier used while creating the account). His public_key is already stored in Database with his profile.

My question is:

  Is there any way that whenever the user provides his passphrase and
  public_key(coming from DB), private_key is automatically retrieved and thus can be
  used to sign the message? Any library or something present for the same?

I don't want the user to remember his private_key for the whole time.(While passphrase can be remembered)

Other way: I can import the account in Metamask and whenever he logs in, Metamask prompts open to sign the message. But this will make Metamask compulsory for the users which I don't want.


texts: What is the advantage of --asm option in solc, how can we compile the contract using --asm option in online remix tool?

texts:
Kindly guide me the advantage of --asm option in solc compared to run-time and deployed opcode facility in REMIX, and how can we compile the contract on online REMIX tool using --asm option?
Zulfi.


texts: Automate mining based on a trigger in Geth

texts: Currently, I am manually running the miner.start() function every time I want to mine in geth. How can I add a trigger in such a way that mining takes place automatically when there are 5 transactions pending?


texts:
I'm a 19 y/o enthusiast in cryptocurrencies and blockchains.
Did the NFT project [like crypto punks] first generate all the possible combinations for creating the x amount of unique "objects" with a local script (let's say, for example using python) and then in some way they minted all these objs on the smart contract, or did they generate all these objs inside the smart contract? (with solidity for example).
Thanks in advance for your answer and I hope you have a nice day!
Simone


texts: Ether withdrawal shown as "internal" transaction

texts:
I requested a withdrawal of 490usd of eth to this address :
0x4fc9bbcf8fd82221ffa0508cac3e094cf7123de7
from bitstamp. The transaction showed "finished" in bitstamp but I never received the money! Can someone tell me why have I not received the money yet? It shows as internal transaction.


texts:
I have a not constant function in my contract, with a boolean return value, when i call this function via web3, i always get 'undefined'

Contract myContract {
     function setFinished(bool _newStatus) public ifProducer returns(bool){
        done = _newStatus;
        witdrawFunds();
        return true;
     }

var result = myContract.setFinished(true,{from: web3.eth.accounts[0], gas:3000000}, function(err, res){});

neither result nor res get me the return value.


texts: How can we detect if tokens are transferred to our smart contract and avoid "allow"?

texts:
Imagine you have a smart contract that accepts all forms of ERC20s. You want users to call a function by which they will send you their ERC20s and in exchange receive a greeting.

Technically we can do that by implementing the famous:

function transferFrom(address from, address to, uint tokens) public returns (bool success);

The problem with transferFrom is that it requires the user to first call

function approve(address spender, uint tokens) public returns (bool success);

How can we avoid the approve part? I can see that someone proposes ERC223 but I'm not sure how that would help and it's unclear. I was thinking at wallets like MetaMask and how they handle token transfers but I think they just call transfer();


texts: How does transaction is encrypted and decrypted? Should all the peers hold the public key of every other peer?

texts: Let's say Peer A sends a transaction to contract.How peer B and peer C will be able to see this.Does they require to do encryption.If so then how?Does each and every peers should have the public key of every account?