texts: Payable function that should not accept the money if X but still write changes

texts:
I have a function that is payable. Upon some checks, if it meet the condition, it should write some changes BUT refund the payable amount that was just sent.
See:
function rent(uint256 tokenId, uint256 period, address payable owner) onlyOffPause() payable public returns (bool) {

require(period > minMonthBasic && period <= maxMonthBasic);

require(owner == ownerOf(tokenId));

//this allow owner to change renting price so it can be used when due date care.

//if marked as rented, require the sender to be the actual renter. this allow renew priority under 31 grace before evict. If not rented, accept anyone to start a rent.
if(plotdata[tokenId]._rented){
    require(msg.sender == renterOf(tokenId));

    //require the basic care date to be due, this giving a 31 days grace for any owner or even renter

    require(checkBasicCare(tokenId) == true);

    //if rentingPrice 0, removing renter and refunding them for the period left AND CANCEL THIS FUNCTION

    if(plotdata[tokenId]._lastRentingPrice == 0){
        plotdata[tokenId]._rented = false;

        plotdata[tokenId]._renterOf = address(0);

        // !!! IT SHOULD NOT ACCEPT THE MONEY AT THIS POINT BUT STILL KEEP THE PREVIOUS CHANGE AT THE RENTER OF AND RENTED

    }

}

...


texts:
geth (and swarm) seem to require a lot of memory, and there are also reports that they tend to an all you can eat approach to system limits.

1) What are the actual memory requirements for geth?

2) What is the best way to limit its usage? (ulimit, for example, uses ENOMEM as its gentlest approach which causes out of memory panics in geth, not very helpful)


texts:
I'm talking for end-production purposes and I'm interested what server specification and which hosting services dAPP developers use.
Considering my scenario, I made a decentralized application in React however I still need server to read Blockchain instruction on each request of the user.
I haven't released my project yet, it doesn't contain any forms of authentication, it's 100% Blockchain based (fetching & writing instruction through MetaMask) and I was thinking to go by this dedicated server:
2TB Storage (RAID-10)
Unlimited Bandwidth
8 CPU Cores, 16 Threads (Intel based : E5-2630v4 at 2.4GHz per core).
16GB DDR4 RAM

I hope it can sustain a good amount of users.
I investigated different hosting services for the front end of dAPPs such as TMDHosting
What type of hosting services do you use for dAPPs?
Is a Blockchain request made by the user 'heavy' on the server side?


texts: Clique network: Sign with multiple accounts in a single node

texts:
Is it possible to multi-sign a block, by a single geth node (with multiple unlocked sealer-accounts)?
Suppose we have multiple sealer accounts (in a clique network). Is it possible to unlock some of these sealer-accounts in a single instance of geth, and then we expect it to sign new blocks with all of these unlocked accounts when mining?

I launched a two-sealer clique network and unlocked both of them in my first node. But it couldn't sign (mine) blocks, alone!
There is no problem when I added the second node and unlocked one of those accounts in that node (and started mining).


texts: Can't transfer more than 9007000000000000 tokens at once?

texts:
I'm using the Zeppelin ERC20 code and I can't seem to transfer more than 9007000000000000 token "cents" at a time.

Address a has a balanceOf 1000000000000000000000000 (10 million tokens * 1000000000000000000 (because I'm using 18 decimals)). However, when I transfer('b', 1000000000000000000000000) from account a, Remix says: Error encoding arguments: Error: Assertion failed.

It gives me the same error for 100000000000000000000000, 10000000000000000000000, 1000000000000000000000, all the way down to 9007000000000000 (which it lets me transfer; it fails with slightly more (9008000000000000)).

balanceOf for both accounts checks out correctly afterwards.

Also, when I comment out the assert lines in SafeMath, Remix gives me the same error. There are no other assertions in the code.

What's going wrong here?

pragma solidity ^0.4.15;

library SafeMath {

  function sub(uint256 a, uint256 b) internal constant returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  function add(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

using SafeMath for uint;

mapping(address => uint256) balances;

function balanceOf(address _owner) constant returns (uint256 balance) {
  return balances[_owner];
}

function transfer(address _to, uint256 _value) returns (bool) {
   balances[msg.sender] = balances[msg.sender].sub(_value);
   balances[_to] = balances[_to].add(_value);
   Transfer(msg.sender, _to, _value);
   return true;
 }


texts: Why is the holder balance more than total supply? Why has nothing been sent to the contract?

texts:
My token is constructed with 100,000,000 supply. Each transaction, 0.007% is burned and a further 0.003% is sent to the contract, making it part of the dividend pool. Here is the transfer function :

function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));

uint256 tokensToBurn = value.div(100000).mul(7);
uint256 tokensToDividend = value.div(100000).mul(3);
uint256 tokensToTransfer = value.sub(tokensToBurn).sub(tokensToDividend);

_balances[msg.sender] = _balances[msg.sender].sub(tokensToTransfer);
_balances[to] = _balances[to].add(tokensToTransfer);

_totalSupply = _totalSupply.sub(tokensToBurn);
_totalDividend = _totalDividend.add(tokensToDividend);

emit Transfer(msg.sender, to, tokensToTransfer);
emit Transfer(msg.sender, address(0), tokensToBurn);
emit Transfer(msg.sender, address(this), tokensToDividend);

return true;

}

After transferring 1 million tokens from Address1 to Address 2, the balances were as such:

Address 1 : 99,000,100 - Incorrect, should be 99,000,000
Address 2  : 999,900 - Correct

Total Supply : 99,999,930 - Correct, suggests that 70 have been burned.

However, you'll notice that the combined balance of the two addresses is 100,000,000, and there is no contract balance, which suggests something has gone wrong. The supply reflects what should be happening, yet total balance is inconsistent.

What have I done wrong?


texts: ERC223, drawbacks and exchanges still not supporting it? Should I just use HasNoTokens?

texts:
I know it has been discussed many times and in many articles on ERC223, for replacing ERC20.

We are launching our tokens and hopefully ICO soon too, it seems that we should go for ERC223, since more and more developers adopting it. Before we go further, I would like to know more practical drawbacks and any exchanges that still not supporting it? Any existing popular token using ERC223?

AFAIK, implementing Openzeppelin's HasNoTokens should (kind of) fix the lost token problem. Is that good enough?


texts: Solidity Maps Content Listing using Loops

texts:
I am developing a test scenario in Remix (Solidity).  I have seen a few sample codes, but am still unclear how this is done.  I have attached a sample code (not complete) that would help clarify this.

I have two questions for the scenario below:

How to I create a loop for the Map to print the current list of registered participants.  I am using events to do this.  But I need a loop to go over the registered participants.
When I delete participant.   How can I treat the array of registered keys.  participantsKey

thanks,

pragma solidity ^0.4.11;

contract RaceParticipants {

    struct Participants {

        bytes32 id;
        bytes32 name;
        uint age;
        bool isValue;

    }

    mapping (bytes32 => Participants)  participantsMap;

    bytes32[] participantsKey;

    event LogParticipants (bytes32 id, bytes32 name, uint age);

    function ListRegisteredParticipants () {

        for (.....) {

            LogParticipants (id, name, age);

        }

    }

    function DeleteRegisteredParticipants (bytes32 _id)
        returns (bool flag) {

        if (participantsMap[_id].isValue) {

            delete participantsMap[_id];

            return true;

        }

        return false;

    }

    function RegisterParticipants (bytes32 _id, bytes32 _name, uint _age) returns (bool flag) {

        if (!participantsMap[_id].isValue) {

            participantsMap[_id].id = _id;
            participantsMap[_id].name = _name;
            participantsMap[_id].age = _age;
            participantsMap[_id].isValue = true;

            participantsKey.push(_id);

            return true;

        }

        return false;

    }

}


texts: How can i properly git a truffle/react project

texts:
Here is what i've done in a blank directory:
$ truffle unbox react
$ npm install @openzeppelin/contracts
$ npm install @openzeppelin/test-helpers
$ npm install @truffle/hdwallet-provider

Then, i have create a .gitignore (in root directory):
build
node_modules
client/src/contracts

I have run:
$ git add .
$ git commit -m "message"

And i have pushed this local git to a github repository
I have cloned the github repository on a second computer.
I need to run this commands again to make runnable my project on the second computer:
$ npm install @openzeppelin/contracts
$ npm install @openzeppelin/test-helpers
$ npm install @truffle/hdwallet-provider

My question is how can i avoid to run this commands ? I have tried to run "npm install" but it does not work. I have no package.json at the root of my project.
Have i made something wrong ?
Thanks


texts:
How things work

I have a Factory contract, FContract.

FContract can be called by a user as many times as they want, creating instances of, let's call it, contractA. Thus, they're able to own as many contract instances of contractA, deployed by FContract, as they want.

Every instance of contractA can store distinct keys. Some keys are for this, some keys are for that, and some other keys are for signing purposes. So, inside the contract the user stores the sha3 of the public key that they created.

The user creates keys through the frontend (keys are not created by the contracts!). For example, the routine that the user calls to create keys, follows these steps (I found this on another project):

Produce some randomHex(32) through web3.utils.randomHex(32)
Concat 0's to the end of the produced hex, so it is == 67 digits
set publicKey = web3.eth.accounts.privateKeyToAccount(privateKeyWithConcat).address
set producedKey = web3.eth.utils.sha3(publicKey)

The issue & What I want to achieve

I want the users to be able to sign messages with the keys that they produced.
They will choose one of the "signing keys" and then sign the message.

But the issue is that I do not have any idea on how to store (or retrieve) the private key.

Am I losing something?

Also, why hashing the public key by using sha3? What are the benefits of it?
I can't really think of any, while storing the hashed public key instead of the real public key, uses much more space.

**Contracts interactions are done with Metamask

Edit: The only possible solution I can think of is that the user will have to "write down somewhere" the produced private key and, at the phase of signing, the system will ask him to provide it with it. But is this the only feasible solution?


texts:
I'm new to Solidity development and I'm trying to figure out the best way to test a function which sets the values of a struct in my Truffle environment.

Firstly, is it expected that the result of the promise returns in the format below:

[ BigNumber { s: 1, e: 0, c: [ 5 ] }, 'John' ]

And if so is this the correct pattern to test the correct property has been set by the setter method (in this case name: John):  assert.equal(res[1], "John");

See below for the example contract I'm attempting to test:

./contracts/Adoption.sol:

contract Adoption {

struct Dog {
    uint age;
    string name;
}

Dog[] public dogs;

function createDog(uint _age, string _name) public {
    dogs.push(Dog(_age, _name)) - 1;
}

}

./test/Adoption.js

return Adoption.deployed()
  .then(function(instance) {
    instance.createDog(5, "John");
    return instance.dogs(0);
  })
  .then(function(res) {
    // dog age should equal 5
    assert.equal(res[0], 5);
    // dog name should equal John
    assert.equal(res[1], "John");
  });


texts: Not able to unlock account using GETH on testnet

texts:
I am using GETH console to unlock the account but i have been consistently getting error "Error: no key for given address or file". I looked into "C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore" and see two files present. could you please guide me if i am doing anything wrong. below is result

of command I executed.

-------------------------------------------------------------------
**List of account on testnet using Geth**

C:\Data\geth-alltools>geth --testnet account list
INFO [07-27|14:05:40.873] Maximum peer count                       ETH=25 LES=0 total=25
Account #0: {407c9c2b699f2380561c2bb13a400e1ea9149930} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T16-37-59.248164300Z--407c9c2b699f2380561c2bb13a400e1ea9149930
Account #1: {2b45bdd81e75be0502469ac81b1089d39cf5c051} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T17-09-09.768503000Z--2b45bdd81e75be0502469ac81b1089d39cf5c051

-------------------------------------------------------------------
**Trying to Unlock the account**

C:\Data\geth-alltools>geth --testnet attach http://localhost:8545
Welcome to the Geth JavaScript console!

instance: Geth/node1/v1.8.12-stable-37685930/windows-amd64/go1.10.3
 modules: admin:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 web3:1.0

  personal.unlockAccount("2b45bdd81e75be0502469ac81b1089d39cf5c051")
  Unlock account 2b45bdd81e75be0502469ac81b1089d39cf5c051
  Passphrase:
  Error: no key for given address or file

Update:

Created a new account by using GETH in testnet and searched for the key but still getting the same issue

C:\Data\geth-alltools>geth --testnet account new
INFO [07-27|15:31:13.992] Maximum peer count                       ETH=25 LES=0 total=25
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {04db25008887fb28e0b8562b9c27f7d6ba0c751f}

file got created in C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore

C:\Data\geth-alltools>Geth --testnet account list
INFO [07-27|15:33:20.217] Maximum peer count                       ETH=25 LES=0 total=25
Account #0: {407c9c2b699f2380561c2bb13a400e1ea9149930} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T16-37-59.248164300Z--407c9c2b699f2380561c2bb13a400e1ea9149930
Account #1: {2b45bdd81e75be0502469ac81b1089d39cf5c051} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T17-09-09.768503000Z--2b45bdd81e75be0502469ac81b1089d39cf5c051
Account #2: {04db25008887fb28e0b8562b9c27f7d6ba0c751f} keystore://C:\Users\AppAdmin\AppData\Roaming\Ethereum\testnet\keystore\UTC--2018-07-27T19-31-23.029658500Z--04db25008887fb28e0b8562b9c27f7d6ba0c751f

Following Command was run on geth console

  personal.unlockAccount("04db25008887fb28e0b8562b9c27f7d6ba0c751f", "Password",300)
  Error: no key for given address or file


texts: How do you activate an else statement after a web3.js call is thrown?

texts:
General purpose of code:

I am trying to create a helper function that returns true if an element exists in a dynamic array in solidity, and false if an element does not exist at a certain index location. The purpose of this function is to help the findLastIndexLocation function determine the length of a dynamic array.

Problem I am having:

When I call the index location of an element that does not exist (because we reached the end of the dynamic array), the call is Thrown and there is an Error message.

Concise question for you:

I would like to include logic in the if statement of the checkIndex function to detect this throw and return false.

Can you help me with that?

// the goal of the code below is to detect the last index location in a solidity array
// Note: from my understanding, solidity cannot return arrays

// this variable exists to catch the last index location of a certain array
let lastIndexLocation = null;

// this is a "helper" function for the findLastIndexLocation function below
let checkIndex = async (account, index) => {
    if(await contractInstance.methods.notary(account, index)
        .call((error, result) => {
            // issue is in this code block
            // if result.timestamp or result.digitalFingerprint is undefined, a Throw takes place.
            if(result.timestamp && result.digitalFingerprint) {
                return true
            } else {
                return false
        })
    ){
        return true
    } else {
        return false
    {
};

let findLastIndexLocation = async (account) => {
    index = 0;

    // start with if statement to check if an array even exists
    if ( await checkIndex(account, index) != true) {
        return 'empty array: no entries where recorded';
    } else {
        while(await checkIndex(account, index)) {
            if(await checkIndex(account, index)) {
                index++;
            } else {
                lastIndexLocation = index - 1;
                return lastIndexLocation;
            }
        }
    }
};


texts:
I am busy designing a system to use smart contracts. Essentially a user selects a digital item from a website adds them to a basket, enters their wallet address and clicks "pay".

Before a contract can be accepted, some checks need to be run:

Check whether the user has sufficient funds for the transaction
Make sure the digital items are still available (they are managed in the blockchain)

If either fail, then the contract will fail.

My question is simple, what is the cost if a contract fails and who pays this?


texts: Is it possible to create a unique hash inside geth?

texts:
When we make a transaction call, we get the transaction hash right away. As mentioned here we could not get transaction's hash inside the contract's function. Would it be good idea to set a variable of the contract with the transaction hash value right after it has been generated?

 > myContract.hello();
"0x41f6c6fbdfd4184172d61b390922270db087519137c43d3052fbad33876964f7"
> myContract.setUniqueHash("0x41f6c6fbdfd4184172d61b390922270db087519137c43d3052fbad33876964f7");

Goal: I want to use a unique hash value inside my contract as a key. Externally setting a unique value seems more efficient in gas wise.

[Q1] Inside geth console, is it possible to create an unique hash? If yes I could submit it into my contract as an argument instead of a transaction hash.

Would following might help? web3.sha3("Print(helloWorld)") as an unique hash. Worst case maybe I can add a file into ipfs and use its hash as key.

[Q2] Is there any way to create unique hash inside solidity?


texts: Difficulties to install Ethereum command line

texts:
I tried to install command line tools to Ethereum.
I follow this tutorial

I already do this commands :

brew update
brew upgrade
brew tap ethereum/ethereum
brew install ethereum

And after I do this : geth console

But since for 30 min I have this:

What is it? I think this downloads something but where?

Moreover I read the tutorial and after this command I must connect to private network. But can I connect to main network? If it's possible how can I do this?

I'm beginner, and I don't have any accounts, so before connect to a network, must I create an account?


texts: Where can I find slides or videos from Devcon3?

texts:
I noticed some good feedback from this previous discussion, so I decide to reask :)

Day 1 Streaming
Day 2 Streaming
Evolution of Smart Contract Security in the Ethereum Ecosystem


texts: Confusion around Truffle, Ganache and Meta Mask

texts:
I am building a simple contract.

In truffle when I give 'truffle develop' command, I get following information:

On the Ganache, I have this:

And finally on Meta Mask, I see this:

here, Shikhar is the custom RPC

I think the network which 'truffle develop' shows is the one where my contract is getting compiled.

I am not able to figure out how can I sync the network and accounts in these 3.

Please help.

Thanks


texts: Tracking transfers of ERC-721 tokens from another contract

texts: I have an ERC-721 token manager contract and an ERC-721 token contract. The manager contract is responsible for creating new ERC-721 contracts and minting new tokens within those contracts, as well as keeping track of wallets that have tokens and which tokens they own. Just realized a potentially fatal flaw - since I am keeping track of wallets that own tokens IF a token is traded outside of my platform the token manager contract will be out of sync. Anyone have any thoughts or ideas about how I can make this work, or a better solution to track which wallets have tokens in which ERC-721 contracts.


texts: Server knows that a message is coming from owner of a token?

texts:
So I am trying to understand ethereum better, am an amateur. So excuse my naivete  here. I am trying to think through this scenario to know if its possible, or how it could be implemented. If any of my current understandings are wrong please correct me.
Bob buys an NFT. On the ether blockchain you can now see the public address of Bob, the owner of the NFT.
Then I have a server running an API, and I want this server to only run a certain request on its API if the server can discern it is coming from Bob, the owner of that particular NFT.
Is there someway that Bob can sign a request sent to the server, so then the server can look at the public address of Bob on the NFT on the blockchain, and discern the request actually is coming from Bob?


texts: Fast syncing showing endless importing new state entries Geth 1.7.3

texts:
I used this command to sync to the chain

geth --fast --cache=1024 --rpc --rpcaddr "localhost" --rpccorsdomain "*" --rpcport 8545 --rpcapi="db,eth,net,web3,personal,web3" upgradedb

And then when I was nearing the latest block it showed me the log below

INFO [01-25|09:04:47] Imported new state entries               count=1111 elapsed=5.767ms   processed=578324 pending=7057  retry=247 duplicate=0 unexpected=589
INFO [01-25|09:04:47] Imported new state entries               count=1230 elapsed=7.861ms   processed=579554 pending=6333  retry=3   duplicate=0 unexpected=589
INFO [01-25|09:04:47] Imported new state entries               count=692  elapsed=5.302ms   processed=580246 pending=8732  retry=59  duplicate=0 unexpected=589
INFO [01-25|09:04:48] Imported new state entries               count=380  elapsed=1.089ms   processed=580626 pending=11689 retry=6   duplicate=0 unexpected=589
INFO [01-25|09:04:48] Imported new state entries               count=606  elapsed=2.862ms   processed=581232 pending=13363 retry=147 duplicate=0 unexpected=589
INFO [01-25|09:04:48] Imported new state entries               count=1094 elapsed=14.179ms  processed=582326 pending=13632 retry=57  duplicate=0 unexpected=589
INFO [01-25|09:04:49] Imported new state entries               count=1088 elapsed=7.410ms   processed=583414 pending=13311 retry=4   duplicate=0 unexpected=589
INFO [01-25|09:04:49] Imported new state entries               count=1341 elapsed=17.202ms  processed=584755 pending=12515 retry=6   duplicate=0 unexpected=589
INFO [01-25|09:04:49] Imported new state entries               count=1070 elapsed=9.520ms   processed=585825 pending=12432 retry=6   duplicate=0 unexpected=589
INFO [01-25|09:04:50] Imported new state entries               count=1378 elapsed=8.078ms   processed=587203 pending=11904 retry=4   duplicate=0 unexpected=589
INFO [01-25|09:04:50] Imported new state entries               count=1131 elapsed=10.760ms  processed=588334 pending=11949 retry=4   duplicate=0 unexpected=589

Based from the duplicate and unexpected values, it's basically the same thing. Does this mean that I haven't still synced in the Main Network? It's becoming endless unlike the one in the Test Network. My wallet balance isn't updating because of this and I think it's due to --fast needing to have a completely synced chain before updating the balances. Is there a solution to this?


texts: How to query local Ethereum blockchain for a specified transaction?

texts:
I want to find specified transaction.
How can I query my local Ethereum blockchain from the console?


texts: How can we access private blockchain from another network?

texts: I have private Ethereum network running on my local network with two sealer node and one bootnode. I have deployed the private blockchain and configured it using geth. Now I want to create another node from another network to connect to that private blockchain deployed. How can I do that if I want to access a contract from the new node?


texts: how remix generate functions of a smart contract after deploy?

texts:
When a smart contract deployed on Remix it gives a UI from where we can interact with Smart contract.

How Remix generate it?
Do Remix also use web3js library to interact with smart contract?


texts: Is it possible to successfully complete several sequential (order-dependent) token transfers within 1 transaction?

texts:
Is this an example of such?
https://kovan.etherscan.io/tx/0x5d11fca70dd134628641bc1ce07b7185418748e5e9820b45b608d9526e629136

Might using inline assembly allow for this?


texts: Invalid implicit conversion from bytes32 to bytes memory requested

texts:
Error in given code,

Invalid type for argument in function call.

 return ecrecover(operationHash, v, r, s);

And,

 function sendMultiSigToken (address toAddress, uint value, address tokenContractAddress, uint expireTime, bytes signature, uint sequenceId) public onlySigner{
    //verify the other signer
    var operationHash = keccak256("ERC20", toAddress, value, tokenContractAddress, expireTime, sequenceId);

  //error in verifyMultiSig's operationHash argument

    verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);
    EERC20Interface erc20instance = EERC20Interface(tokenContractAddress);
    if(!erc20instance.transfer(toAddress, value)){
        revert();
    }
}

How to solve these errors? I am using 0.4.10 version compiler.


texts:
I try to design a DApp and I need some help regarding the architecture design.

My use case is a market place - where seller can sell their products and buyers can buy their products. The DApp should work fully decentralized. The marketplace should work on the mobile phone as an app.

The first elements is a app in the IOS and android store that’s clear for me. But where is the blockchain? Therefore, I read this article. It says that:

  “This means, every person who wants to interact with a dapp (Decentralized Application) will need a full copy of the blockchain running on their computer/phone”

But what happened if I design the architecture in that what that a setup a central server where every IOS App connets and on this server there is running one instance of the blockchain.

Based on the user credentials (ID and Private Keys) the users can add some new information into the blockchain. The replication of the blockchain will be done by all other nodes (who are using for example Ethereum) and must not be done by “my” clients.

I know that this design is wrong and crosses the principles of blockchain and decentralisations but does it work? And what are the arguments against this design?


texts: Is there a thread leak in Ethereum Web3J

texts:
As part of our plans to integrate blockchain technology, I am looking at Ethereum and playing around with the java API (web3j). One obviously starts with the examples but I found that the VM does not actually stop after all example code has completed. The example code seems to be cleaning up all the resources it acquires but since the VM is not actually stopping, I am assuming it is leaving some thread running and the VM is waiting on that thread to complete.

I have added the following at the end of the Main#run() method:

System.out.println("Main done, expect the VM to quit anytime now");

and that prints out fine so the code completes. I have also added a shutdown hook but that never gets invoked.

I was wondering if anybody else is experiencing the same thing and how they have solved it or if there is perhaps a more fundamental flaw in the Web3J library that does not cleanup acquired resources?

Many thanks!


texts: Balance Of and the amount raised does not increase sender an account

texts:
Can someone give me a hint or correct what is wrong with the code. Maybe it is obvious where the error is but I do not see it and I'm stuck. What to do next ?.
The code is here:
https://ropsten.etherscan.io/address/0xc3ec072c279043ad2e56f4b5683b78337ed614d9

function () payable public {  }

function buy () payable public whenNotPaused beforeDeadline afterStartTime saleNotClosed {
    require(msg.value >= minContribution);

    // Update the sender's balance of wei contributed and the amount raised
    uint amount = msg.value;
    uint currentBalance = balanceOf[msg.sender];
    balanceOf[msg.sender] = currentBalance.add(amount);
    amountRaised = amountRaised.add(amount);

    // Compute the number of tokens to be rewarded to the sender
    // Note: it's important for this calculation that both wei
    // and PDT have the same number of decimal places (18)
    uint numTokens = amount.mul(rate);

    // Transfer the tokens from the crowdsale supply to the sender
    if (tokenReward.transferFrom(tokenReward.owner(), msg.sender, numTokens)) {
        FundTransfer(msg.sender, amount, true);
        // Check if the funding goal or cap have been reached
        // TODO check impact on gas cost
        checkFundingGoal();
        checkFundingCap();
    }
    else {
        revert();
    }
}

what to do to fix it ? (Remix Ropsten does not update a sender balance of).

Any help is very much appreciated.Robert


texts: I sent Ether from coin base to my ledger nano S. I have triple checked the address and it is correct. Conibase and etherscan show the transaction completed. However it is not showing up in my Ether wallet on my ledger nano s. Also when I look at my deposits on my ledger nano s and withdraws my balance at the top is short ~1/2 ether. Has anyone else seen this? I appreciate your help.


texts: Why is the recursion in the namehash algorithm?


texts: Why is my full node stuck always out of sync?

texts:
I have a 16g ssd ubuntu, I run the command:

geth --ropsten --syncmode=full --gcmode=archive

Checking the "eth.syncing" in the console attached, I get always current block is ~100 blocks behind.
How can I understand what is the problem?


texts: Parity all pending transactions (not local)

texts:
From some version of Parity, it began to start like this

And now, when i try to get all pending transactions from the whole pool, i'm getting only these local. But i need to get ALL as earlier. How to do it?

web3.eth.subscribe('pendingTransactions', (e, r) => {
if (!e) {
    console.log(r);
}

});


texts: In what cases if any, does a transaction get lost from the network forever?

texts:
Is it possible for a transaction that was included in the pending pool across multiple nodes, to become lost from the network forever (i.e. get dropped by all nodes)?

If yes, in what cases is that possible?

P.S. There are a few similar questions but with seemingly conflicting answers.
Some say that transactions cannot be dropped from the network (e.g. What happens to transactions in Uncles?), and others say that it is indeed possible for a transaction to get dropped by the network (e.g. What happens to transactions in orphaned/forked blocks?).


texts: Code Example: Waiting for N blocks then running a method?

texts:
I'm new to Javascript and Etherjs. I'm trying to interact with a specific contract in the following way. The contract has two functions, hi and bye. I want to
first run contract.hi();, wait N blocks while printing the number of each block to the console, then afterwards run contract.bye();. I'm using AlchemyAPI to connect to the testnet.
I'm guessing something like:
it("Greeting", async function() {
   await contract.hi();

   for(let i = 0; i < N; i++){
      \\What to put here?
      console.log(await ethers.provider.getBlockNumber());
   }

   await contract.bye();
});


texts: Geth stuck at Block #2721823 "invalid v, r, s values"

texts:
title says it all: Geth syncing stucks at block 2721823 ... I downloaded the newest version 1.5.4, started first with the flag -removedb, than with -fast -cache 2048.

Everything went smooth, untill this block.


texts:
When I compile a blank contract:

contract A {}

with

solc --optimize --optimize-runs 300000 --opcodes test.sol

I get:

PUSH1 0x60 PUSH1 0x40 MSTORE PUSH1 0x6 DUP1 PUSH1 0x10 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN PUSH1 0x60 PUSH1 0x40 MSTORE STOP

What is it? As I understand this bytecode not the code of contract, but code which during execution generate contract. But I don't get, what is going on.

Probably

PUSH1 0x60 PUSH1 0x40 MSTORE

is a pattern to allocate 64 bytes(0x40) in memory. If yes, why we need manually allocate it?

There are a few lines in Yellow paper about separation 'code' and 'data'. I can see it, when run solc with --asm-json. But how this two parts actually interact?

I feel like I missed a very important paper or manual where everything is cleared. Where can I get it?

To summarize:

What does bytecode of blank contract do? If it is possible, I need explanation for each opcode.
How interact code and data sections of contract?
Where I can find full info about how evm works?


texts:
I have the following tuple:
( , , uint256 standardDepositAmount, , )

I need to use the standardDepositAmount in a require, like:
require(standardDepositAmount == something)

how can i do that?


texts: Do Graph queries have a maximum response size?

texts:
I'm running a Graph node for a personal project and I'm wondering if there is a defined maximum response size for queries. I see that pagination is an option according to the documentation, but it's not required.
Do thegraph.com nodes have a max response size? when do I need to use pagination?


texts: Best way to debug Large / Optimized contracts in Mix

texts:
I have a contract which is very long. It can't be deployed without compressing it first and so it makes it impossible to properly debug it in mix.

As anyone found a workaround than working on smaller chunks ? I'm finding it difficult to debug only using javascript since transactions are taking 15-30sec to process.


texts: Are there any drawbacks for making difficulty static on a private chain?

texts: I have made difficulty static in my private block chain, so I can have static response time. Are there any drawbacks of doing this?


texts: How can i find out the ERC20token balance by different contract address in solidity?

texts:
I want to konw how to get the balance of ERC20token with different contract address in solidity....(And i just run in the superblock,which is in my localhost)

Such as ERC20token smartcontract, just is the token balance of accounts, i want to make a smart contract to use token contract address and account address to find out the token balance of different accounts or different token


texts: I sent ETH to my receiving contract address

texts:
I sent ETH to one of my receiving address which is contract address. But this receiving contract address was my personal trading wallet address. But, no transaction I'd has been received. When will I get transaction id and said ETH?

Receiving address: 0x0397070137FC164d467F4b17dcAE0986d5dd5890


texts:
I'm taking my first steps in Ethereum development.

What I'm trying to do is write a function that accepts an address and send it 1 ETH.
I don't understand how to check if the contract has sufficient funds, tx.origin.balance is in wei format, how can I convert wei into eth.

function refillAccount(address receiver) payable returns(bool isRefilled) {
    if (tx.origin.balance < [1 eth]) {
        refilledAccounts[receiver] = false;
        return false;
    }

    if ( !refilledAccounts[receiver] ) {
        refilledAccounts[receiver] = true;
        if( !receiver.send(1 ether) )
        throw;
        return true;
    }
}


texts:
I would like to create a smart contract and tokens on Ethereum platform. Is it legit to copy someon's elses contract code and change it slightly to be unique and has a green checkmark on Etherscan?

thanks.


texts:
What is the best way to handled nested contract call with web3 1.0? I'm trying to collect all data needed and format it into something useable. It could require 2 or 3 calls though. Is there a easy way to handle it, to know when all async calls have finished?

this.contract.methods.getPlayerAnimals(this.address)
.call({ from: this.address })
.then((animals) => {
  for (var animal of animals) {
    this.contract.methods.getAnimal(animal)
    .call({ from: this.address })
    .then((animalContract) => {
      this.playerAnimals.push(fullAnimal)
    });
  }
  this.socket.emit('playerAnimals', this.playerAnimals)
});


texts: Transaction doesn't get reverted when I add gas parameter in web3

texts:
I have a function with modifier that I call through web3.py.
If I do this function call without using the gas parameter, like this:

MyContract.functions.preBid(100, 10, 0).transact({'from': accounts[0]})

it gets correctly reverted because of its input. But if I call this function using the gas parameter (which is necessary because otherwise, I would run into an out of gas problem later in the transaction) my function doesn't get reverted:

MyContract.functions.preBid(100, 10, 0).transact({'from': accounts[0],'gas': 50000000})

Does anyone know why this happens?


texts: Token Contract Created by Factory Contract is not Showing up in metamask

texts:
I have a FactoryToken Contract Deployed and its function "newToken" Creates a new token contract. Every thing is working fine on Remix IDE but when i call the FactoryToken's function To create new token contract from Web GUI using TestRpc then it creates a new Contract But when i Add that address into the metamask account section ==> Add Token there it shows nothing. No information about the created token.

Code is working fine with Remix IDE on Ropsten Test Net but not with the TestRpc Accounts.

Below is the Factory Contract:

pragma solidity ^0.4.18;

import "./TestToken.sol";

contract FactoryToken {

  // index of created contracts

  address[] public contracts;

   mapping (address => bool) created;
  //Crowdsale public theObj;
  address newContract;

  string public  name ;
  string public  symbol ;
  uint256 public  decimals ;

  // useful to know the row count in contracts index

  function getContractCount() public constant returns(uint contractCount)
  {
    return contracts.length;
  }

   function getToken() public constant returns (string,string, uint256) {
       return (name, symbol,decimals);
   }

  // deploy a new contract

 function newToken(string _name, string _symbol, uint _decimals) public returns(address objAddress){

    newContract = new WILDToken(_name,_symbol,_decimals);

    contracts.push(newContract);

    return newContract;
}

   function verify() public constant returns (address) {
        return newContract;
    }
  //function GetAddress() public view returns (address) {

   // return (c);
  //}
}

In the function newToken, I am creating a New contract for Wild Token with the parameters Name, Symbol and Decimals

 function newToken(string _name, string _symbol, uint _decimals) public returns(address objAddress){

        newContract = new WILDToken(_name,_symbol,_decimals);

        contracts.push(newContract);

        return newContract;
    }

In my Html page with Web3 and TestRpc, I am Using the following code to create a New Token Contract

 $("#create").click(function () {

            Coursetro.newToken("My New Token", "MNT",18, { from: web3.eth.accounts[0], gas: '1000000' });

        });


texts: I read about a couple of solutions for storing within the blockchain, but I was wondering what would be the best approach to storing an array of addresses that have bought an token. I want to be able to call this array and display it on my frontend.


texts: Why swapping some tokens require more gas fees than others?

texts: I noticed that swapping some tokens in Uniswap to exactly the same amount of ETH, at the same time, has much higher gas fees than other tokens. Why is this? Aren't the swap transactions identical for all tokens?


texts: Parse Error before Event definition in solidity

texts:
pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract DieselPrice is usingOraclize {
    function DieselPrice(){

        event one(string description);
        event newDieselPrice(string price);
    }
    function DieselPrice() {
        update(); // first check at contract creation
    }

    function __callback(bytes32 myid, string result) {
        if (msg.sender != oraclize_cbAddress()) throw;
        newDieselPrice(result);
        DieselPriceUSD = parseInt(result, 2); // let's save it as $ cents
        // do something with the USD Diesel price
    }

    function update() payable {
        one("Oraclize query was sent, standing by for the answer..");
        oraclize_query("URL", "xml(https://www.fueleconomy.gov/ws/rest/fuelprices).fuelPrices.diesel");
    }

}


texts: Backup blockchain from a running geth fullnode

texts:
I need to make backups from my running node to be able to start a second node quickly or to restore the node quickly if it gets corrupted.
Does geth export work on a running node? is it a good option or is geth import too slow to get a new node running
what are other options? can I just copy data while the node is running?


texts:
I have created structure with 16 elements and received solidity compiler error.

  Exception during compilation:
  /src/libsolidity/../libevmasm/Instruction.h(217): Throw in function
  dev::solidity::Instruction dev::solidity::swapInstruction(unsigned
  int) Dynamic exception type:
  N5boost16exception_detail10clone_implIN3dev8solidity13InvalidOpcodeEEE
  std::exception::what: InvalidOpcode [PN3dev11tag_commentE] = Invalid
  SWAP instruction requested.

How do you get around situation like this?
The contract compiles fine if structure has 15 or less elements.

I was thinking about storing multiple values in form of JSON string in one variable, but this gets cumbersome as each datatype has to be first converted to bytes and then it can be concatenated.

Any ideas?


texts: Huge amount of gas being used for small computation

texts:
I have just added one other part to my contracts addUser method (setting the isPermitted field) and it has blown up the amount of gas it uses to the point I keep getting out of gas exceptions. The code of my contract that corresponds to this is

contract UserStorage{
  struct location{
      bytes8 latitude;
      bytes8 longitude;
      bool checked;
  }

  struct userData{
      bool isPermitted;
      bytes ownData;
      mapping (address => bytes) friends;
      address[] friendsList;
      mapping (bytes10 => location) locations;
  }

  mapping (address => userData) private users;

  function addUser(bytes ipfs, bool permitted){
      users[msg.sender].ownData = ipfs;
      users[msg.sender].isPermitted = permitted;
  }
}

I am calling this using a web3j wrapper in android with

userStorage.addUser(new DynamicBytes(ipfsHash), new Byte(true)).get();

It is storing ipfs data to the users account. It's using on average 5 million gas for that one operation, reporting as bad instruction on etherscan. Any idea why it's so high and what I can do to lower the gas usage? Thanks.


texts: Benefits of library versus a plain contract (upgradeability)

texts:
I'm trying to find what the benefit is of a library. I found the following statements. (Please correct me if i'm wrong)

Cost less gas to deploy
Uses the storage of the calling contract
the library and contract are compiled separately but the library gets linked into the contract as a part of it when deploying.

The major downside I see of a library is that it's a part of the contract. Meaning if I want to update the library I need to redeployed I also need to redeployed the linked contract. If the library was just a plain contract I only need to redeploy that contract and set the reference again to the other contract.

contract Lib {
    //Some code
}

contract A {

    Lib someLib;

    function setLibReference(address libAddress) public {
        someLib = Lib(libAddress);
    }
}

For me this seems as a major downside or am I wrong in this?


texts: How to send ether from sender account to a given account

texts:
I am new to solidity and trying to develop a small smart contract. I want to send ether from the sender account to a given account. But I always get this error "VM error: revert. revert The transaction has been reverted to the initial state. Reason provided by the contract: "Insufficient balance". Debug the transaction to get more information."
pragma solidity >=0.5.0.0 <0.9.0;

contract SimpleTranaction {
    address  payable public receiver =  0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;

    function sendTo(uint amount)   public  payable  {

        require(msg.sender.balance < amount, "Insufficient balance");
        receiver.transfer(amount);
    }
}

I use Remix IDE. The sender account has an enough balance

What could be the reason for this? Am I doing something theoretically wrong? If so what is the best approach to do this?


texts: Will I be able to mine having my whole blockchain imported using the --fast flag? (Geth)

texts:
Having the same problem as in this question: Corruption on data-block while synchronising I restarted my synchro on the fresh/empty data directory using the --fast flag. According to this answer: What is Geth's "fast" sync, and why is it faster? I am aware that fast synchronisation imports receipts only, not the results.

So my question is: will I be able to mine having my whole blockchain imported using the --fast flag?


texts: ECDSA Transaction Signature Values (V-R-S) -- Interpreting and presenting it to layman users

texts:
In Quorum + Web3, I used getTransaction and it returned me the necessary details and also V-R-S. Understand that VRS is part of the ECDSA signature.

There is a need to interpret and present these seemingly random hashes (I know they are not) to users to conclusively persuade them that this transaction is indeed performed by some party.

How would one decipher and explain ECDSA VRS to layman?


texts:
I know parity can run as a daemon because the --help has a usage parity daemon <pid-file> [options] but no further help/clues/documentation is provided. What is <pid-file> ? A process ID file, and what is that? If it is supposed to be a systemd unit file why doesn't it say so.

The only other clue I can find after searching and searching is this:
https://daowiki.atlassian.net/wiki/display/DAO/Ethereum+network
It says to edit the parity.service and parity.conf file, however both of those do not exist. I can try creating them but then why is there NOTHING when googling on this. I can't be the first and only person on this planet to want to run parity as a daemon. (I don't want this question to sound negative. I really appreciate the great contribution the ethcore team and their parity project has given to the Ethereum community!)

Ubuntu 16.04
parity v1.2.2


texts: How to receive/swap tokens on a new Solidity contract?

texts:
hope you can assist me on this matter:

Scenario:

One year ago a token has been created. Right now, the developer wants to add some nice feature for the users.

The users need to send X amount (let's call it 100) tokens to a new contract, where those 100 tokens are swapped against 1 new token.

The caveat is that the developer has no more owner acccess to the original contract.

Now the question is;

How can a new contract receives X amount of old tokens.
How can the amount sent be checked.

So i'm looking for a way to swap coins from the old contract.

Thank you for helping me out :-)


texts: How can I calculate the gas fee of a swap on Uniswap?

texts:
According to gas tracker on Etherscan the average gas price is 212 gwei and the average Uniswap swap estimate is $70.26 which implies that the gas fee is around 201101.
To my knowledge swap gas fee is 21000 or so. What other operations are associated with a Uniswap swap that burn the extra gas?


texts: How to list all the contracts currently on the blockchain?

texts:
I know one way to interact with contracts is, in the geth interface, to use the command:
 eth.contract(ABI).at(Address)

But for this I will need to know the ABI and address of the contract in advance.
What if I want to browse the contracts currently in the blockchain (like browsing the apps in play-store)?


texts: Truffle test error: setter does not works

texts:
I have very basic contract like this:

pragma solidity ^0.4.0;

contract Playground {
    uint public tokenPrice = 1;

    function setTokenPrice(uint newTokenPrice) public returns (uint) {
        tokenPrice = newTokenPrice;

        return tokenPrice;
    }
}

and correspondig test:

  it("should have token price changeable and publicly visible", () => {
    let instance;

    return Playground.deployed().then(inst => {
      instance = inst;
      return instance.tokenPrice.call();
    }).then(price => {
      console.log('Initial price:' + formatNumber(price));
      return instance.setTokenPrice.call(2);
    }).then(price => {
      console.log('Price immediately after change:' + formatNumber(price));
      return instance.tokenPrice.call();
    }).then(price => {
      console.log('Price after get:' + formatNumber(price));
      assert.equal(price, 2, format(price, 2, "Token Price"));
    });
  });

This test checks initial value of token price then change it and check again. But it seems that setter does not work! Here is the output:

Initial price:1
Price immediately after change:2
Price after get:1

I.e. value that updated in setter returned correctly but when I am getting it again - it returns old, not updated value. What is wrong here?

Tests are running in local testrpc instance. In Remix data updated as expected.


texts: I deployed my contract using Remix solidity compiler and Metamask but i don't know how to develop front end to interact with the deployed contract?

texts: Here's link of my deployed contract: https://ropsten.etherscan.io/tx/0xde3ffc9ee6fae07db8b82d53cdd4f07f645ecab5866a2fd20b4d2affde0676d8


texts:
I'm making a subcurrency with solidity. I'm confused at implementing the transfer mechanism.

Here's my code:

function SubCoin(){
      balances[msg.sender] = totalPoints;
}

function send(address to, uint256 valueInmWard) {
    if (balances[msg.sender] >= valueInmWard) {
      balances[to] += valueInmWard;
      balances[msg.sender] -= valueInmWard;
      PointTransfer(msg.sender, to, valueInmWard);
    }
  }

I'm stuck at setting the msg.sender address. I only know I can use:
 web3.eth.defaultAccount = web3.eth.coinbase; to send from eth.accounts[0]. I call SubCoin.send.sendTransaction(web3.eth.accounts[1], 1000); in web3 to perform the action.

If I would like to send among eth.accounts[1], eth.accounts[2]..., how should I specify the msg.sender in web3?


texts: truffle test get different results between ganache-cli and local geth

texts:
When I run truffle test on ganache-cli, it will pass the test but when I run the same truffle test commnad on local geth node, it will fail with error saying invalid address at the method which takes address as a parameter (even though parameter address has no problem).

However when I deploy contracts to the local geth node and call the method that I get an error, there was no problem.

Here are the truffle.js setting:

module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*',
      gasPrice: 0,
      gas: 6600000,
    },
  },
  compilers: {
    solc: {
      version: '0.4.25',
    },
    settings: {
      optimizer: {
        enables: true,
        runs: 200,
      },
    },
  },
};

version

Truffle v4.1.14 (core: 4.1.14)
Solidity v0.4.24 (solc-js)
geth (docker) ethereum/client-go:release-1.8
Ganache CLI v6.3.0 (ganache-core: 2.4.0)


texts: How to get liquidity Address on panckswape

texts: Im trying to learn about create token in BSC. Now Im trying to add liquidity by contract, but i dont know the address of my liquidity pool that I created in panckeswap. Where can i take it? Thanks


texts:
I wrote a function that takes two strings as arguments and compares them and returns bool value. Here is the code.

function compareStringsbyBytes(string s1, string s2) public pure returns(bool)
{
bytes memory s1bytes = bytes(s1);
bytes memory s2bytes = bytes(s2);
if(s1bytes.length!=s2bytes.length) {
    return false;
}
else{
    for(uint i = 0;i<s1bytes.length;i++)
    {
        if(s1bytes[i] != s2bytes[i])
         return false;
    }
    return true;
}
}

The contract deployment failed in this case with transaction out of gas error. Can someone help me understand the problem with this code?

Thanks!!


texts: Error when using string type as a mapping key

texts:
The following code doesn't compile, because compiler needs a mapping key to be of fixed-size type in order to create accessor for a public mapping. I'm using here string type. My strings are 24 byte hex strings.

My question:

How would you cast string to any fixed-size type that can be used
as a mapping key?
Do you have any advice on how to make the code more effiecent?

pragma solidity ^0.4.6;
contract C {
    struct User {
         uint balance;
    }
    mapping (string => User) public accounts;
    function newUser(string id, uint balance) {
         accounts[id] = User(balance);
    }
}

  Error: Unimplemented feature: Accessors for mapping with dynamically-sized keys not yet implemented.


texts: What is the correct way to check if an address is zero?

texts:
I remember reading that the correct way to check if an address is 0x0 or not is  _addr == address(0) and not _addr == 0. However, I'm unable to find any difference between the two when I run the following:

pragma solidity ^0.4.19;

contract Test {
    bool public isResult1 = false;
    bool public isResult2 = false;

    function isAddressZero1(address _addr) public {
        isResult1 = (_addr == address(0));
    }

    function isAddressZero2(address _addr) public {
        isResult2 = (_addr == 0);
    }
}

Is there a known issue with _addr == 0 or is the explicit typecasting just to be safe?


texts:
I have seen many posts around the division operation in Solidity e.g. Cant' do any integer division. Firstly, the error I am facing is different. Secondly, I am ensuring that, all numbers in division operation are set to uint256. So, I am not sure, what this error means and how to fix this.

This is with Ethereum testrpc.

Solidity function

function getQuotient() returns (uint256) {

    uint256 numMembers = uint256(someStruct.someArray.length);
    uint256 sampleSum = someSameplSum; //set to uint256 elsewhere
    uint256 avgNum = sampleSum / numMembers;

    return avgNum;
}

Error

Error: Error: VM Exception while executing eth_call: invalid opcode
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:59368:17
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:69306:5
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:11335:9
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:7895:16
    at replenish (/home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:8415:25)
    at iterateeCallback (/home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:8405:17)
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:8380:16
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:11332:13
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:69302:9
    at /home/ubuntu/node_modules/ethereumjs-testrpc/build/cli.node.js:63982:7
    at Object.InvalidResponse (/Users/nsubrahm/node_modules/web3/lib/web3/errors.js:38:16)
    at /Users/nsubrahm/node_modules/web3/lib/web3/requestmanager.js:86:36
...


texts: How to track deposits into my account using web3.py

texts: I'm learning how to build blockchain applications. I'm using Django and Web3.py to create one. I wanna know if there's a way to listen for deposits into wallets I will be creating in the application. For Bitcoin, I use Block.io and the have a notifications API which sends notifications to my webhook URL. I can't find a way to do this in web3.py. Any ideas?


texts:
I've created a voting game on eth blockchain. I would like to make a function, that only address with previous transaction history(not a fresh address) can call. So doesn't allow people to create a fresh account to upvote their favour project.

Feel free to check the game out -> https://www.youtube.com/watch?v=3Q7dwniXz_Y


texts:
I'm new to Ethereum and i just setup my first Node. Basically i needed a way to query the Ethereum blockchain to retrieve data, so i decided to setup a light node on a VPS using Geth.
Everything seems to work, the node is up, but now what i don't understand is what i need to do in order to query the node and get Ethereum data. For example, when i use Web3JS or Web3py, what url do i need to set on my provider, in order to access my own node? Thanks in advance!


texts: What value to set for Web3 provider when dapp is deployed to Heroku or other Hosting site

texts:
I am trying to host my dapp on Heroku and smart contract on Rinkeby network.
My dapp has a front end in node.js and jquery and an express backend server that I use to listen to solidity events and to 'get' and 'put' data from 'Mlab' mongodb offchain server.
The app works perfectly fine on my Local Ganache and my server.js and below line of code to get the web3 instance.

const provider = new Web3.providers.HttpProvider("HTTP://127.0.0.1:8545");

My question is while deploying the server.js to Heroku should I keep this web3 provider setting same or does it need to be changed to some other value, please suggest.


texts: Algorithm to check if my ethereum account has successfully deposited to eth2 validators deposit contract

texts: The eth2 phase 0 validators deposit contract implements a sparse merkle tree. Which algorithm can check if there is a successful deposit from my account? (Pseudo code)


texts: Transaction fails if the called function is not found

texts: Trying to set a token fallback sort of function here. Main problem: if the receiver has code but does not include the specific function I try to execute it fails. Any way to call an external function, without the transaction failing if the function didn't exist? Like, you try to execute a certain function but if it isn't there is not a big deal.


texts: Balance should not be zero on this address I suppose

texts:
for address

https://ropsten.etherscan.io/address/0x00916c608868c68f4cd8bea6786ab40b24b55392

balance is shoving 0

but from transactions it should be little more than one ether

I believe there is simple explanation but I cant figure it out


texts:
I need to understand a couple of things:

What is the maximum value an int and uint can store?
Are the maximum values stored in int and uint the same?


texts: Issue with `TRANSFER_FROM_FAILED` when calling Uniswap contract - but I am approving the token!

texts:
My code is pretty simple
function swapForEth(address tokenAddress,
    uint amountIn,
    uint amountOutMin,
    address to,
    uint deadline) external onlyOwner payable {

    require(IERC20(tokenAddress).approve(UNISWAP_ROUTER_ADDRESS, uint256(-1)));

    address[] memory path = new address[](2);
    path[0] = tokenAddress;
    path[1] = uniswap.WETH();

    uniswap.swapExactTokensForETH(amountIn, amountOutMin, path, to, deadline);
}

As you can see. I am approving the token with uint256(-1) so not sure the error i am getting in my transaction is TRANSFER_FROM_FAILED
Please see transaction here https://kovan.etherscan.io/tx/0x86d4667699a86bc0bd49d7ae54bfb51b406c25f08b499b0a607e2d974bb68c68
I'd verify the contract bytecode but unfortunately I've changed my contract a bit since then so having some trouble doing so lol... if needed can post a larger portion of the contract


texts: I just have started to learn Smart Contract.  I have to design front end in ASP.NET. Can I call Contract from it?


texts: Check if Metamask was just installed after asking the user to do so

texts:
In an effort to make my dApp more user-friendly, especially for onboarding, I'm trying to guide new users into installing Metamask.
If no web3 provider is present, I show the user a "Create your wallet" button. When they click on it, they are headed to Metamask.io in a new tab.
The trouble arises when they install Metamask and go back to my dApp. There doesn't seem to be a way of detecting if a web3 provider is installed without reloading. I can't just programmatically reload the whole page, and asking my disengaged potential user to reload feels like very bad UX.
I created the following code snippet taken from Metamask's documentation to illustrate this behaviour.
<html>
<body>
  <script language="javascript">
  function checkProvider () {
    if (typeof window.ethereum !== 'undefined') {
      console.log('you already have a web3 provider');
    } else {
      console.log('please install Metamask');
    }
  }
  var interval = setInterval(checkProvider, 1000);
  </script>
</body>
</html>

Basically it checks every second if you have a web3 provider. Since it can't run without a webserver, I put it online so you can quickly test it.
If I don't have Metamask installed, I get the expected message:

But after I install it and go back to this page, the same message keeps appearing:

Only after a refresh does my snippet detect metamask:

I can't be the only one facing onboarding issues with web3 providers. What workarounds have you thought of?


texts: (closed) I deployed the contract with remix but truffle didn't deploy, why?

texts:
i want to deploy my contract to Rinkeby or Ropsten testnet with truffle. But I give an error like this:
ran out of gas (using a value you set in your network config or deployment parameters.)
   * Block limit:  0x989680
   * Gas sent:     10000000

again I set as 10000000 (last block gas limit) the gasLimit value on the remix when I deploy the contract to Rinkeby testnet, remix published the contract.the remix result: after he deployment:
and the Rinkeby txHash is this: https://rinkeby.etherscan.io/tx/0xea528c900c6ea9751c3a1c8f7b221dfd52a2da5b06ab2998d2789978e20d591a
the contract does not appear to be installed correctly .
How can I deploy the contract with truffle to Rinkeby or ropsten testnet?
thank you


texts: Get contract bytecode and creator from contract address on Geth console

texts:
I can get contract bytecode and it's creator via this URL.
https://etherscan.io/address/CONTRACT_ADDRESS
[example: https://etherscan.io/address/0x5a3e58c7cf09217d2a5385bf96c02673ed1187bb#code]

I would like to get it on geth console but not found solution during several days.
I think there will be a way since etherscan provide it.
My try was using web3, but no success, any kind of help will be much appreciate!


texts: How do ethereum validate a OLD transaction(say 10k blocks ago) without sync/replay-ing the full node?

texts:
When a full node receives a freshly mined new block, it seems straightfoward how we could validate all the transactions contained in the block. As we already the current world state, we could just apply all the Txs in the new block and check the resulting stateRoot against the state root from the new block. If it's identical, then we are sure the new block is valid(assume the pow part is okay)

Understanding that it is also trivial to check the inclusion/exclusion of a particular transaction, how can we check if a transaction included in a old block is valid?

I'm asking because it seems for validating old transactions, we don't have access to old world state then(only stateRoot, unless we took additonal snapshot, but that's not really the Ethereum default behavior?)

EDIT: Understanding that Ethereum is always making sure that the current state & coming transactions are valid(which is doable as mentioned above), what I am asking is more relevant to Ethereum-based sidechains (or more specifically, Generalized Plasma Sidechains).

So we may need to validate a relatively old transactions in future, when the world state has already been mutated. I want to understand if it is necessary to keep a lot of world state full snapshots in order to achieve this. Or would stateRoot suffice?


texts: How should I store mainnet truffle artifacts?

texts:
Obviously, I shouldn't upload my private key or personal infura credentials to my repo, but I was wondering what was the best way to track main net truffle artifacts.

Generally speaking, for test nets I upload my test artifacts, would be a good idea to deploy to mainnet in a separate repo? What are the current best practises?

Edit The json file produced from running truffle migrate are what I am calling truffle artifacts.


texts: error building solidity compiler with `brew upgrade`. build from source?

texts:
This is the error message I got after recently running brew upgrade:

The command which solc, still outputs:

/usr/local/bin/solc

Is this a problem?

Maybe I should uninstall and reinstall my solidity compiler?

Or, rather- does it even make sense to have it installed using homebrew? In fact I'd prefer to build it from source.


texts: web3js send transaction failed when contract modify mapping data , but remix work

texts:
first, web3 version: 1.0.0-beta.36

the contract code is:

pragma solidity ^0.4.25;

contract Main {
  struct Model {
    uint256 key;
    uint64 createTime;
  }

  Model[] public models;

  mapping(uint256 => address) public modelOwner;

  function total() view public returns (uint256) {
    return models.length;
  }

  function getData(uint256 _tokenId) view returns ( uint256, uint64){

    Model _model = models[_tokenId];
    return  (_model.key, _model.createTime);
  }

  function createData(uint256 _key, address _owner) returns (uint){

    Model memory _model = Model({key : _key, createTime : uint64(now)});

    uint256 newModelId = models.push(_model) - 1;

    // modelOwner[newModelId] = _owner;

    return newModelId;
  }
}

I send transaction by remix and web3.js:

myContract.methods.createData(
 key,
 addressA
).send({
 from: addressB
})

the problem is :

when I remove the code modelOwner[newModelId] = _owner; in function createData, web3 and remix both work (List models increase);
when I add modelOwner[newModelId] = _owner;, remix work, but web3 failed, because the result of the method getData returned is not correct (List models not increase);


texts: What happens when you send a non-state-changing transaction to the transaction pool

texts: I understand that there are 2 endpoints for smart contracts. Call() for running view/pure function and SendTransaction() for state-changing transactions. Obviously a state-changing transaction sent to Call() would be reverted, but what happens in the inverse? Could the transaction still be mined and added to the chain? And can gas be consumed if gas was added?


texts: personal.unlockAccount() Error: Invalid JSON RPC response and crashes Geth

texts:
It's launch of Geth:

geth --testnet --fast --rpc --verbosity 0

The start of interaction with console:

geth attach ipc:/.../geth.ipc

Console works great but when I inputs the following command:

personal.unlockAccount(eth.accounts[0], "psw", 0)

(different parameters: with/without duration, "eth.coinbase" or just adress name instead of eth.accounts[0], etc)

console is blocked for several minutes. At the same time Geth does not work for all sessions, RPC is disable. Finally it returns

  Error: Invalid JSON RPC response: {"error": {"EOF":"EOF",
  "code":-32603}, "id":11, "version":"2.0"}

Geth process is killed.

What is it?


texts:
Please create for the contractate ABI encoded constructor argument to verify an Ehtereum contract on etherscan.io?
contract - https://etherscan.io/address/0x7af7470Aa8e4601f4174402DEd7917Fb046aE3D2


texts: How to get the progress of geth node syncing info via JSON RPC?

texts:
I install new geth nodes on remote servers pretty often and I'd like to have a script which can tell me info like this: Node1 is synced for 30%.

Is it possible to get any progress of geth node syncing info via JSON RPC?

Accuracy is not very important.


texts: Can a user communicate with a private ethereum network ( Quorum)?

texts:
I am up to build a electronic health record system using Quorum. My Project includes Appointments and prescriptions to handled too. I have to make a permissioned network to ensure data privacy. Can a patient with his public key send a transaction to my private node using my my website's front end?
 I also want all the nodes to be storing that information as they are trusted health care stakeholders.


texts: Web3 (python) - confirming transaction hash format

texts:
Due to the fact, that I am storing txId obtained from the user, before determining whether transaction has been ended or not, I want to make sure that the transaction hash, which will be stored in my database, has a correct format.

Is there any way to accomplish this task?


texts: Always getting "Gas Estimation failed" in Remix when testing 1inch swap function

texts:
I am trying to test 1inch swap function from the contract deployed via Remix on a Ganache fork of the Ethereum Mainnet. When calling this function I always get the "Gas estimation failed" error and "VM Exception while processing transaction: revert" error in Remix. My contract has enough sold off token (USDC) and Ether.
The interface of the swap function looks as follows:
function swap(
            IERC20 fromToken,
            IERC20 toToken,
            uint256 amount,
            uint256 minReturn,
            uint256[] memory distribution,
            uint256 featureFlags
        ) public payable;

The contract code:
contract TradeBot {
// OneSplit Config
    address ONE_SPLIT_ADDRESS = 0xC586BeF4a0992C495Cf22e1aeEE4E446CECDee0E;
    uint256 PARTS = uint256(10);
    uint256 FLAGS = uint256(0);

   function oneSplitSwap(address _from, address _to, uint256 _amount, uint256 _minReturn,
                        uint256[] memory _distribution) public payable {
        _oneSplitSwap(_from, _to, _amount, _minReturn, _distribution);
    }

   function _oneSplitSwap(address _from, address _to, uint256 _amount, uint256 _minReturn,
                          uint256[] memory _distribution) internal {
        // Setup contracts
        IERC20 _fromIERC20 = IERC20(_from);
        IERC20 _toIERC20 = IERC20(_to);
        IOneSplit _oneSplitContract = IOneSplit(ONE_SPLIT_ADDRESS);
        // Approve tokens
        _fromIERC20.approve(ONE_SPLIT_ADDRESS, _amount);
        // Swap tokens: give _from, get _to
        _oneSplitContract.swap(_fromIERC20, _toIERC20, _amount, _minReturn, _distribution,
                               FLAGS);
        // Reset approval
        _fromIERC20.approve(ONE_SPLIT_ADDRESS, 0);
}

I test the function with the following parameters:
fromToken: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 // USDC
toToken:   0x6B175474E89094C44Da98b954EedeAC495271d0F // DAI
amount:    100000000
minReturn: 10
distribution: [0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0]

Can't figure out why this does not work. All parameters seem to be correct and the contract has
enough USDC. Any ideas?
UPDATE
After checking some successful transactions I used the FLAGS parameter set to "4406099890176" instead of default 0 and it worked. However, it does not work with the default 0 flag value. Also, had to use addresses instead of IERC20 types for "from" and "to" parameters.


texts:
I am trying to deploy contract using web3js in nodejs on ganache cli test server, but it fails with error as follows :

D:\Thrive\PoC\NodeWebAPI\node_modules\web3\lib\web3\contract.js:149
                                throw new Error('The contract code couldn\'t be stored, please check your gas amount.');
Error: The contract code couldn't be stored, please check your gas amount.
at Object.callback (D:\Thrive\PoC\NodeWebAPI\node_modules\web3\lib\web3\contract.js:149:43)
at D:\Thrive\PoC\NodeWebAPI\node_modules\web3\lib\web3\method.js:142:25
at D:\Thrive\PoC\NodeWebAPI\node_modules\web3\lib\web3\requestmanager.js:89:9
at XMLHttpRequest.request.onreadystatechange (D:\Thrive\PoC\NodeWebAPI\node_modules\web3\lib\web3\httpprovider.js:118:13)

The code snippet is as follows :

    var web3 = connection.getWeb3Object(config.BlockChainServer());

    var contractAbi = contractDetails.getContractAbi(contractName);

    var contractByteCode = contractAbi.bin;

    var gasEstimate = web3.eth.estimateGas({data: contractByteCode});

    console.log(gasEstimate);

    var contractObject = web3.eth.contract(contractAbi);

    var contract = contractObject.new({from: account, gas:1000000,data: "0x" + contractByteCode});

    var receipt = web3.eth.getTransactionReceipt(contract.transactionHash);

    if (receipt && receipt.contractAddress) {
        console.log("Your contract has been deployed at " + config.BlockChainServer + " | Contract address -" + receipt.contractAddress);
    }

I have tried sending varying amounts of gas, but I am encountering the same issue. What could be the problem ?


texts: How to call solidity function in html 'inspect' console properly?

texts:
I can see my contract in my console. The solidity code and abi is in the the index.html. I can't figure out how to call this function and send 0.01 ether with it as well. I would think it is something like GuessingGame.playGame(function() {}) but where could I possible see where it wants it's parameters? I can get it to work in remix by doing compile > create > input .01 ether in value > hit playGame button

https://github.com/whvod/DoubleorNothing


texts: Simulating DAO recursive/reentrancy attack

texts:
Trying to simulate the attack.

In my attack contract:

  function attack() public {
    target.call(bytes4(keccak256("withdraw()")),amount);
  }

  function() payable public {
    if (msg.sender == target) {
        attack();
        }
  }

Target vulnerable contract:

function withdraw(uint256 _value) payable returns (bool success) {
        if (balances[msg.sender] < _value) return false;
        msg.sender.call.value(_value)();
        balances[msg.sender] -= _value;
        total -= _value;
        return true;
    }

When I call the first attack function, the transaction gets an error in it.

How do I debug this?

I see a Revert in the stacktrace.

I did verify there is a balance for the smart contract equal to the amount I'm attempting to withdraw ( 100000000000000 )

enter image description here

https://ropsten.etherscan.io/tx/0xdf3821e85520549684c121e0786bad1a6b26de00c7a2c659a042d634196a7bba

Although one or more errors occured [Reverted] contract execution completed


texts:
I'm familiar with proxy contracts in solidity using the 'delegatecall' to separate out the proxy contract from the logic contract.  Is there a simple way to choose the logic contract based on an argument that I pass into the call as opposed to "upgrading" a contract permanently?

I feel like I've seen people do this in various contracts, but I haven't really seen documentation on it so I'm not sure what it's called.  I think of it as dynamic proxying, but it may be called something else.

Basically, I would like my proxy contract to point to 1 of many logic contracts depending on an argument that I pass into the function call.  So say I'm making a call to a function "GetValue" and I want to pass it a number as a parameter.  I'm thinking one way to do this would be to pass an additional parameter that tells the proxy contract which logic contract to use.  It seems like I'd have to use some assembly code inside my proxy contract to pull that off.  So the proxy contract would read the first few bytes of the data and use that to determine what logic contract to call.  Then it would delegate the call off to the logic contract (possibly without that additional parameter...)

Openzeppelin may have something that does this.  I personally prefer using Python for my Ethereum development as opposed to javascript.  Since Openzeppelin's tools tend to rely on javascript, I haven't really been using them outside of following their solidity patterns.

Note: I understand that I could just leave the proxy contract as is, and sub proxy within my logic contract.  But that seems unnecessary when that's supposed to be the purpose of the proxy contract to begin with.

Additional thought: So in the code I linked above, it would be almost as if I called "upgradeTo" everytime I call the contract.  But instead of the overhead of upgrading the logic contract, just choose which logic contract to forward the delegated call to.


texts:
I have an auction contract, where bidders bid with Ether then me (owner) select which offer is most suitable and thus this bidder is contract winner.

Once the winner is selected, I send him data as a reward. My question here is, is there a way to ensure that I can use the ether until I send him the data?

In other words, what makes the bidder sure that I dont just take him Ether and dont send any data? Thus is there a way to lock the Ether for example till data is send.

Note, I sent him the data off-chain.


texts: Oraclize with private blockchain - generate custom address for OAR

texts:
I am new to Oraclize. I am integrating a private blockchain with Oraclize. It says in the ethereum bridge document

  Add OAR = OraclizeAddrResolverI(EnterYourOarCustomAddress); to your
  contract constructor, example:

  Where EnterYourOarCustomAddress is the address resolver generated when
  you have run the script.

I ran the script

node bridge -H localhost:8042 -a 1

It prints

  WARN Using 'account address' to query contracts on your blockchain,
  make sure it is unlocked and do not use the same address to deploy
  your contracts

Please note, I wrote the account address in quote for the address in -a 1.
Is this also the custom OAR address?


texts:
following to the approach explained here to use etherscan api from Python to get transactions info such as input

How to retrieve transactions' info such as gaslimit and gasprice from Etherscan?

How can I decode transaction input to know what method was called and what arguments were passed in (and arguments types)?

In addition, is there a way to retrieve all verified contracts from etherscan? especially to retrieve creation code for each contract and the all contract's transactions?


texts: How to update the balance of a wallet user when there are two competing chains?

texts:
I am building a wallet, and I have a question about uncle blocks. Let’s say our user sends a transaction, but there are two competing blockchains. If they both include her transaction, no problem. We can update her balance. If only one of them includes her transaction, we cannot go ahead and update the balance until it’s fixed, right?

Should we wait until one of them is fixed?
Or should we choose one of them somehow and then switch only in case we were wrong about the winning chain(this doesn’t sound good because it confuses our user)?

Or is there a better way than these?


texts:
It all ran well before 2,700,000 but when comes above 2,700,000 hellish...

INFO [12-21|00:08:43.253] Imported new chain segment               blocks=2 txs=
5  mgas=0.356 elapsed=30.309s   mgasps=0.012 number=2701160 hash=30bcc0be60e8 ag
e=3y1mo1w dirty=40.46MiB
WARN [12-21|00:09:36.784] Checkpoint challenge timed out, dropping id=2ad507adee
2cdf47 conn=dyndial addr=51.83.96.188:30305    type=Getc/v6.0.9/linux/go1.12.9
WARN [12-21|00:10:19.192] Checkpoint challenge timed out, dropping id=2ad507adee
2cdf47 conn=dyndial addr=51.83.96.188:30305    type=Getc/v6.0.9/linux/go1.12.9
INFO [12-21|00:12:41.838] Imported new chain segment               blocks=3 txs=
12 mgas=2.535 elapsed=3m58.585s mgasps=0.011 number=2701163 hash=6892b15d491b ag
e=3y1mo1w dirty=45.25MiB
WARN [12-21|00:14:44.929] Checkpoint challenge timed out, dropping id=2ad507adee
2cdf47 conn=dyndial addr=51.83.96.188:30305    type=Getc/v6.0.9/linux/go1.12.9
INFO [12-21|00:15:31.450] Imported new chain segment               blocks=1 txs=
2  mgas=1.162 elapsed=2m49.611s mgasps=0.007 number=2701164 hash=1a3c0c06fe7e ag
e=3y1mo1w dirty=47.79MiB
WARN [12-21|00:16:22.281] Checkpoint challenge timed out, dropping id=63cbc31e70
27052b conn=dyndial addr=47.111.121.250:30303  type=Geth/v1.9.10-unstable-d90d1d
b6-20191210/linux-amd64/go1.13.5
WARN [12-21|00:17:03.571] Checkpoint challenge timed out, dropping id=2ad507adee
2cdf47 conn=dyndial addr=51.83.96.188:30305    type=Getc/v6.0.9/linux/go1.12.9
INFO [12-21|00:19:41.046] Imported new chain segment               blocks=2 txs=
9  mgas=2.472 elapsed=4m9.596s  mgasps=0.010 number=2701166 hash=977c882c2768 ag
e=3y1mo1w dirty=52.55MiB

Just take a look... few minutes a single block I can't live to that day lol

How is that happening? It goes all well before

(using full sync)


texts: Does not killing an old contract bloat the blockchain?

texts:
I deployed and tested a contract (on testnet, but the same question goes for mainnet too), now I'm finished with it, moved on to new contracts. Should I remove the old one? Does it do any harm, assuming that it will never be invoked again? Removing a contract itself is another transaction so the best I can do seems like leaving it there. Is this correct?
Thanks,


texts: order on Poloniex pass, balances did not change

texts:
I made 1 request to create a  sell order on polonium platform, it returned success.
I see 2 orders in order history

 ETH/BTC    Sell    Exchange    0.04683003  0.00583652  0.00000041 BTC
 (0.15%)    0.00027291 BTC  2017-12-20 07:11:44
 ETH/BTC    Sell    Exchange    0.04683003  0.05633578  0.00000396 BTC
 (0.15%)    0.00263424 BTC  2017-12-20 07:11:42

not sure why but aggregation of amounts is equal to initial amount i sent in my request.
As far as i understand order succeed, but my balances do not show it.
My ETH balance remain the same as BTC balance. I don't have any open orders as well. How can i understand what happened  with the order ?


texts: How to implement a per item, fixed price for a smart contract?

texts:
Imagine that I am building a smart contract which simulates a lottery. I would like people to enter the lottery by buying a ticket (i.e. they would send in a certain amount of ether when they call a specific function on my contract).

Can I implement the purchase functionality so that a ticket always costs the equivalent of $2 USD? This doesn't seem straightforward given that the value of ether is constantly changing.

Wanting to have something cost a set price seems like it would occur frequently so I'm wondering if there is a standard way to implement it.

Note: I am just starting out with Ethereum/Solidity so I apologize if this is a very basic question.


texts: Strange ERC20 "withdrawals" from a secure wallet

texts:
I have some ETH and ERC20 tokens at an address whose private key is secured by a hardware wallet.  I'm confident the private key has not been disclosed to any third party.  Yesterday, however, I noticed a couple of strange token withdrawals on July 17 to "DwarfPool_1" as reported by etherscan.io:

https://etherscan.io/address/0x3f83c1d492AD28A6FD7C9d5e4d5839bd961B1943#tokentxns

The transactions are:
https://etherscan.io/tx/0xb3320d2be93ee4a0a4265ab3634db35ad7e2d195caedbc0aac3cea3e73c9fe23
https://etherscan.io/tx/0xd3bafdd9402f2ea939b21a280e7b7c6eaf45db4ba448115759caf5440e711299

The 5000 tokens withdawn are apparantly spam tokens, but ones that I had never received (to my knowledge).  The contract name for these tokens includes "tinyurl.com/nicetokens", which when browsed to is a page advertising the services of some ERC20 development group.  The page asserts "Your wallet is safe" without providing any details.

My question: how is it possible for a ERC20 token withdrawal to be made from my secure address without my knowledge or approval??  Or is this not a true withdrawal, but something else??

Any clarification would be much appreciated.  Thanks!


texts: How to deploy contracts within the same Truffle project at different times

texts:
If I have a Truffle project with two different contracts in it, can I deploy them at two separate times? Can I run an additional command alongside truffle migrate that will allow me to deploy just one, and then another command that will allow me to deploy the other? Is there a way to split up the migration files and just run one of them?

I am looking for best practices here.


texts:
please share thoughts or experience of using parity in production vs geth, are there any other alternatives?

Maybe something like tierion.com but for ethereum exist?

Thanks!


texts: Error in Forwarder creation in MultiSig Wallet

texts:
The following code,

function createForwarder() public returns (address) {
   return new Forwarder();
}

gives error,

TypeError: Return argument type contract Forwarder is not implicitly convertible to expected type (type of first return variable) address.
return new Forwarder();

Currently I am using pragma solidity version ^0.5.1, how can I solve this particular error?


texts: Address is undefined after deploying a smart contract

texts:
I tried deploying a greeter contract as shown here , I thought the deployment is suceess but i am unable to get the address of the contract, it always shows undefined.

When I tried to execute the greet method it also shows undefined

pls check the attached image.

geth version 1.5.3-stable-978737f5
solidity version - 0.4.6

I also did unlocking the account and waited for over 10 mins to let it mine.

below are the steps I did to compile and deploy the contract.

var greeterSource1 = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) selfdestruct(owner); } } contract greeter1 is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }'

var greeterCompiled1 = web3.eth.compile.solidity(greeterSource1)

var _greeting1 = "Hello World!"

var greeterContract1 = web3.eth.contract(greeterCompiled1.greeter1.info.abiDefinition)

var greeter1 = greeterContract1.new(_greeting1,{from:web3.eth.accounts[0], data: greeterCompiled1.greeter1.code, gas: 300000},
function(e, contract) {

    if(!e) {
        if(!contract.address) {
            console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");

        } else {
            console.log("Contract mined! Address: " + contract.address);
            console.log(contract);
        }
    }
})

Any help is greatly appreciated.


texts:
I am using Remix IDE on Chrome browser for developing smart contracts.
Today during working on a file when I changed program tab and returned to it again, I found that all of the file contents has been deleted automatically. No Ctrl+Z, close and reopen and other tricks was useful.
1- Can anyone help me recover the emptied file?
2- Does Remix have any limitation in file size?
Regards.


texts:
I was following a tutorial for a Crowdfunding Smart Contract that acts like Kickstarter from Programtheblockchain, however I'm always getting a MetaMask Error which says "Exception thrown in Contract Code" when trying to send Ether to the Contract. It compiles and deploys just fine, but I can't send Ether to it. Is the code maybe outdated or am I doing something wrong on my end?

pragma solidity ^0.4.19;

contract Crowdfunding {
    address owner;
    uint256 deadline;
    uint256 goal;
    mapping(address => uint256) public pledgeOf;

    function Crowdfunding(uint256 numberOfDays, uint256 _goal) public {
        owner = msg.sender;
        deadline = now + (numberOfDays * 1 days);
        goal = _goal;
    }

    function pledge(uint256 amount) public payable {
        require(now < deadline);                // in the fundraising period
        require(msg.value == amount);

        pledgeOf[msg.sender] += amount;
    }

    function claimFunds() public {
        require(address(this).balance >= goal); // funding goal met
        require(now >= deadline);               // in the withdrawal period
        require(msg.sender == owner);

        msg.sender.transfer(address(this).balance);
    }

    function getRefund() public {
        require(address(this).balance < goal);  // funding goal not met
        require(now >= deadline);               // in the withdrawal period

        uint256 amount = pledgeOf[msg.sender];
        pledgeOf[msg.sender] = 0;
        msg.sender.transfer(amount);
    }
}

And my deployment code

var Crowdfunding = artifacts.require("Crowdfunding");

module.exports = function(deployer){
    const numberOfDays = 1;
    const goal = web3.toWei(10, 'ether');
deployer.deploy(Crowdfunding, numberOfDays, goal);
};


texts: How to schedule a transaction to a Contract?

texts:
I have a simple getter-setter contract. I want to schedule transactions for a method of my contract on a particular date and time.

Do we have a function to schedule transactions to a contract in Quorum Blockchain? Please help me with it.


texts: Is there a list of Ethereum Classic block explorers?

texts: Most Ethereum block explorers are only for Ethereum, but not Classic. Is there a list of Ethereum Classic explorers?


texts: Truffle. Test .call() args . Error: invalid string value (...) at PromiEvent

texts:
I have a js truffle test:

it("should add an exam to the exams list", async () => {
    // This should test the complete functionality
    let hash_test = "fB03aA5E2E71De1470ae2";
    let instance = await Exam.deployed();
    let hash = instance.addExam.call({from: accounts[0], hash: hash_test});
    assert.equal(hash.valueOf(), hash_test, "Not returning the correct address")
})

And I have an addExam function in the contract:

function addExam(string memory hash) public returns (string memory examProfessorHash) {
    // save the exam hash and link it with the professors address
    professorsExam[msg.sender] = hash;

    return hash;
}

When I run the tests, I get this error:

  Error: invalid string value (arg="hash", coderType="string",
  value={"from":"0x67F4CfB03aA5E2E71De1470ae26adB7e33B7892E","hash":"fB03aA5E2E71De1470ae2"})
  at PromiEvent

I am not sure how to debug this. Is it the .call() method?


texts: How do decentralized exchanges make money?

texts:
I've been wondering how do DEXs make money. I know some of them like uniswap and airswap supposedly don't take any profits from trades. But are all DEXs like this?
I read on Kyberswap FAQ that the user pays a 0.1% fee on succesful limit order transactions. But it doesn't say if this is an aditional fee or if it's just the normal ETH gas fee.
Does anyone know if other DEXs take a comission on transactions as part of their business model? Or are they all non-profit?


texts: solidity mapping does not seem to be working

texts:
I have this solidity code
contract Starting { //pragma solidity ^0.6.12

    struct itemStatus {
        bool created;
    }
    mapping (bytes => itemStatus) public item;

    bool[] public boolArray;

    function start(bytes memory itemId) public {
        boolArray.push(item[itemId].created);
        if (item[itemId].created) {
            boolArray.push(item[itemId].created);
        } else {
            item[itemId] = itemStatus(true);
            boolArray.push(item[itemId].created);
        }
    }

    function getBoolArray() public view returns (bool[] memory) {
        return boolArray;
    }

}

frontend javascript code is
  toStart: function () {
    let Instance;
    App.contracts.Starting.deployed().then(function (instance) {
      Instance = instance;
      return Instance.start(itemId);
    }).then(function (result) {
      console.log(result);
    }).catch(function (err) {
      console.log(err.message);
    });
  },

  getArray: function () {
    let Instance;
    App.contracts.Starting.deployed().then(function (instance) {
      Instance = instance;
      return Instance.getBoolArray.call();
    }).then(function (array) {
      console.log(array);
    }).catch(function (err) {
      console.log(err.message);
    });
  },

The first time I call 'toStart' and then 'getArray', I would expect itemId 1 [false, true] and the second time with the same itemId 1 [false, true, true, true] and third time with a different itemId 2 [false, true, true, true, false, true]. However, the actual result is [false, true, true, true, true, true]. It seems item[itemId] = itemStatus(true) has set all 'created' to true regardless of itemId. But if I use itemId 100 and 200, I get the expected result. Why is it so? How to change the code to get the expected result? Many thanks in advance.


texts: Trying to figure out a method to automate transactions within a private testnet. There are several methods I'm aware of, but I'm not sure what would be the most practical. This is for testing purposes only. For example: automatically send X number of ETH between wallet a and wallet b every x number of seconds.


texts: truffle migrate fails: intrinsic gas too low

texts:
I'm trying to follow the tutorial on using Truffle framework for Ethereum development at https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f.

Unfortunately I'm not able to successfully deploy the compiled contract to Ropsten testnet with

  truffle migrate

in the Truffle console. The following error keeps showing up:

  Error: intrinsic gas too low

I know it has something to do with a too low amount of gas being used in the transaction which deploys the contract to the testnet.

I've already tried different settings of gas in truffle.js for development which were all below the result of:

  web3.eth.getBlock("pending").gasLimit

But I assume this has nothing to do with my problem.

I also found https://stackoverflow.com/questions/42589091/ethereum-truffle-metacoin-fails-with-intrinsic-gas-too-low but there the solution was to change the gas limit in genesis.json. As I want to deploy to testnet that's not an option in my case.

I'm pretty sure I'm missing a configuration setting in Truffle.


texts: How to Catch Connection Issues to Web3 Provider using Web3.js

texts:
My node.js script is able to successfully connect to the Web3 provider when both the private key (using truffle-privatekey-provider) and the provider host URL are correct.

let privateKey = ...,
    providerUrl = ...
const provider = new PrivateKeyProvider(privateKey, providerUrl)
const web3 = new Web3(provider)

try {
    await web3.eth.net.isListening();
} catch (e) {
    console.log('Error connecting to provider')
}
console.log('Connected!');

Problem: However when the provider host URL is incorrect, the above code does not throw any errors and simply gets stuck in the await statement.

Is there a way to know when there is an issue connecting to the provider host?


texts:
Error: Web3ProviderEngine does not support synchronous requests.
I have an error when deploying contract to rinkeby

 provider const HDWalletProvider = require('truffle-hdwallet-provider')

 module.exports = async(deployer) => {
    await deployer.deploy(WETH);
    await deployer.deploy(BNB, admin, 100000e18);
    await deployer.deploy(OMG, admin, 100000e18);
    await deployer.deploy(BAT, admin, 100000e18);
 };


texts: execute function on ropsten tesnet thru geth, adapt truffle console/testrpc commands

texts:
This is the smart contract I'm trying to interact with, verified on etherscan.io, and reproduced here:

pragma solidity ^0.4.13;

// This contract demonstrates a simple non-constant (transactional) function you can call from geth.
// increment() takes no parameters and merely increments the "iteration" value.

contract Incrementer {
    uint iteration;

    function Incrementer() {
        iteration = 0;
    }

    function increment(uint count) {
        iteration += count;
    }

    function getIteration() constant returns (uint) {
        return iteration;
    }

}

The commands I'd like to use to call it are:

Incrementer.deployed().then(function(instance) {
  meta = instance;
  return meta.increment(1);
})

to increase the iteration variable, and:

Incrementer.deployed().then(function(instance) {
    meta = instance;
    return meta.getIteration();
})

to verify the result.

Those are commands that work on the truffle console with testrpc, but now I'm trying to issue those commands through geth to the ropsten testnet.

I've tried to adapt them to this purpose according to the answer to this question, like so:

var contractAbi = eth.contract([{"constant":false,"inputs":[{"name":"count","type":"uint256"}],"name":"increment","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getIteration","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]);
var myContract = contractAbi.at(0x8705C513da621a16fd1dEFc9dE8aE7CDEAD01Fb8);
var getData = myContract.getIteration.getData(1);
web3.eth.sendTransaction({to:0x8705C513da621a16fd1dEFc9dE8aE7CDEAD01Fb8, from:0xd7a9a61a480d458a1181e0563b07f944df4489a6, data: getData});

but it didn't work, the result was this:

Error: invalid address
    at web3.js:3879:15
    at web3.js:3705:20
    at web3.js:4948:28
    at map (<native code>)
    at web3.js:4947:12
    at web3.js:4973:18
    at web3.js:4998:23
    at <anonymous>:1:1

The output of getData rendered in this way:

> getData

"0xfc2c3e08"

See the console output here:

What is the correct procedure to adapt those commands to execute a function on the ropsten tesnet using geth console?