texts: The transaction will throw an exception with the current values

texts:
Trying to do the Status ICO, and when entering in the ether address, I get this warning.  A friend has tried this with another wallet and said he's getting an error/exception and his transaction did not go through.  Any ideas what's going on? Even if I set the "Send after BLockNumber" condition the exception message does not go away.  note that the BlockNumber has already passed.

Edit:  I tried sending, and got this

  Warning! Error encountered during contract execution [Bad instruction]


texts: Loop optimization checking coordinates in a grid

texts:
I built a contract where users can set an image in a specific coordinate,
that position can only have one image. The grid size is 400 height, and dynamic width (Will grow overtime) and there are 3 different image sizes: 10x10, 20x20, 40x40 (pixels).

I need to optimize the loop in order to reduce gas cost which is very high right now.

Here's my current implementation, where coords and sizes are divided by 10 to reduce gas cost.

pragma solidity 0.4.19;

contract Test {

    mapping (uint => bool[40]) public grid;

    function check(uint x, uint y, uint size) public {

        for(uint i = 0; i < size; i++) {
            for(uint j = 0; j < size; j++) {

                if(grid[x + i][y + j]) {
                    // image exists in this slot
                    revert();
                }

                grid[x + i][y + j] = true;

            }
        }
    }

}

Possible sizes:

 - small: 1 (1 slot)
 - medium: 2 (4 slots)
 - big: 4 (16 slots)

Current gas cost:

- Small: 43223
- Medium: 76251
- Big: 163181


texts: How can I withdraw ether balance from contract to a personal account?

texts: How can I withdraw ether balance from a contract to a personal account? İ tried but I couldn't do it on Ropsten. Could anybody tell me step by step how to test this? Thanks.


texts:
I am using web3py to make a transaction. But I am getting validation error:

{'message': 'VM Exception while processing transaction: revert Need
operator approval for 3rd party transfers.', 'code': -32000, 'data':
{'stack': 'RuntimeError: VM Exception while processing transaction:
revert Need operator approval for 3rd party transfers.\n    at
Function.RuntimeError.fromResults
(/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)\n
at module.exports
(/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)',
'name': 'RuntimeError'}}

Can someone please help me understand this error? Why is it happening?
I am using function safeTransferFrom (from ERC1155)
Thank you.


texts: Regarding interaction between smart contracts

texts:
If we have a case where we have Two smart contracts. Contract A passes value to Contract B. the address of contract A is also passed to contract B in the smart contract.
while compiling the contract B how can we access the address of contract A , if we are compiling in javascript.


texts: Where can one find the rich list of the BAT token?

texts: Is there a rich list made for the BAT token?


texts: Is it possible that a smart contract receives ether and if condition is true then send those ether to specific account?

texts: I am planning to create an app that connects to the Binance account of the user (API) and trades automatically with his credentials. If transactions (only one buy and sell pair) successfully earn BTC, then I would like to receive a fee (a percentage of the utility). If the transactions don't earn money, then there is no fee. As the Binance API can only be used for trade I can not collect the fee automatically from that API. So, I would like a smart contract collect the fee from user, prior to the transactions (based on the investment quantity and the expected percentage of profit entered by the user) and if transactions earn money (buy and sell pair) then the fee is sent to my address and if not, the fee is returned to the user address. Is it possible to do something like this?. Is ethereum network the best option, or I need to use chainlink or another provider like that one?


texts: Execute function from another contract web3

texts:
Token Contract Owner = Crowdsale Owner (Another contract)

Token Contract have a function that only owner can execute. How can i execute using web3?

What i tried is below

var address = web3.eth.accounts[0]
  var data = Web3Utils.sha3('approveKyc([' + address + '])').slice(0, 10) + randomstring.generate({ length: 24, charset: '0'}) + address.substring(2)

  return meta.token.call(
    {
      to: '0xb84869e5eb3bfb5cb6df6f0c8af5b18fa2e3393f',
      data: data
    }
  )

Where meta is the Crowdsale contract instance.


texts: How can i get contract data from certain block

texts:
I need to get some data from an smart contract, but i want to generate something like history
How can i get that data until some block or maybe be able to replay the blocks somehow?
Im using python and if there is a way with Web3 ot Geth that will be fantastic


texts: Can I pass my mnemonic to ganache/ ganache-cli when it is starting up?

texts: I am wondering if I can pass the mnemonic that I created using metamask to boot up my local ganache network so that I do not have to log out and login metamask with different mnemonic everytime for a new project.


texts: Are there other oracle services beside Oraclize that provides a user-friendly API and allows for competition?

texts:
Are there other oracle services beside Oraclize that that provides a user-friendly API and allows for competition?

I want to implement the scheme where my contract request the same ressource, e.g., weather data, from several oracles and then chooses either the most frequent result or the average of the results (where possible).

I know of the authenticity proofs supplied by Oraclize, but in this case I want to test the scheme outlined above.

The only oracle service I know of is Oraclize. Are their other equivalent oracle services in terms of user-friendly API etc.? If not, how do I roll out my own oracle service?


texts:
I want to build an app on a private blockchain and I'm hesitating between 2 clients : Quorum and Pantheon (now Hyperledger Besu)
Does anyone know what are the main differences between the 2 and the use case for each one?


texts:
I have written following Smart contract.

pragma solidity >=0.4.17;

contract factoryCampaign {

    Campaign[] public deployedCampaign;

    function createCampaign (uint256 minimumContribution) public {
        Campaign newCampaign = new Campaign(minimumContribution, msg.sender);
        deployedCampaign.push(newCampaign);
    }

    function getDeplyedCampaigns() public view returns(Campaign[] memory) {
        return deployedCampaign;
    }
}

contract Campaign {

    struct Request {
        string description;
        uint256 value;
        address recipient;
        bool complete;
        uint256 approvalCount;
        mapping (address => bool) approvers;

    }
    address public manager;
    uint256 public minimumContribution;
    mapping(address=> bool) public approvers;
    Request[] public requests;
    uint256 public approversCount;

    modifier restricted() {
        require (msg.sender == manager);
        _;
    }

     constructor (uint256 minimum, address creator) public {
         manager = creator;
         minimumContribution = minimum;
     }

     function contribute() public payable {
         require (msg.value > minimumContribution);
         approvers[msg.sender] = true;
         approversCount++;
     }

     function createRequest(string memory description, uint256 value, address recipient) public restricted {
         Request memory newRequest = Request({
             description: description,
             value: value,
             recipient: recipient,
             complete: false,
             approvalCount: 0
         });

         requests.push(newRequest);

     }

     function approveRequest(uint256 index) public {
         Request storage request = requests[index];
         require(approvers[msg.sender]);
         require(!request.approvers[msg.sender]);
         request.approvers[msg.sender] = true;
         request.approvalCount++;
     }

     function finalizeRequest(uint256 index) public payable {
         Request storage request = requests[index];
         require(!request.complete);
         require(request.approvalCount > (approversCount / 2));
         address payable recipient = address(uint160(request.recipient));
         recipient.transfer(request.value);
         request.complete = true;
     }

}

I am getting following error:

ParserError: Expected ';' but gor 'payable'

Error line seems to be:

address payable recipient = address(uint160(request.recipient));

Solidity version: 0.4.25


texts: How to call my smart contract method using new metamask

texts:
I am able to connect or call the send txn method of ethereum using new metamask script. But i m not able to call the method of any of custom contract.
Can someone tell me how can i do in javascript?
Thanks


texts: Transaction values exchanged even if transaction rejected, and double values exchanged if transaction confirmed

texts:
I'm trying to perform a function that exchanges one token for another, but I'm getting a very strange bug. If I call the function in web3, I get the standard metamask popup asking whether to confirm or reject the transaction. Now what's happening is if I hit reject, the value exchange still happens, even though there is no transaction on metamask nor on my ganache cli, just the values are updated on metamask. Then if I confirm the transaction, the transaction goes through as normal, except that double the expected value is exchanged.

Occasionally I get RPC Error: MetaMask Tx Signature: User denied transaction signature. as expected, yet the value is still exchanged. I've tried restarting my ganache cli, resetting my accounts on metamask, and even reinstalling metamask, but still the same.

Solidity

function deposit(uint amount) public {
    require(daitoken.transferFrom(msg.sender, address(this), amount), 'transferFrom failed');
    emit Transfer(msg.sender, address(this), amount);
    require(ldai.mint(msg.sender, amount), 'mint failed');
    emit Mint(msg.sender, amount);
    emit Deposit(msg.sender, amount);
  }

Web3

const num = this.state.amount * (10**18);
    this.props.contract.methods.deposit(num.toString()).send({from: this.props.account});


texts:
DeclarationError: Undeclared Identifier, on Transfer(owner, addresses[i], _value; <<  for the word "Transfer" >>

pragma solidity ^0.4.18;

contract distribution {

mapping(address => uint) balances;

address private owner;

function distributeBlox(address[] addresses, uint256 _value) owner {
    for (uint i = 0; i < addresses.length; i++) {
        balances[owner] -= _value;
        balances[addresses[i]] += _value;
        Transfer(owner, addresses[i], _value);
    }
  }
}


texts: Can a PoA Network be corrupted by one node only?

texts:
https://github.com/ethereum/EIPs/issues/225

The text from that link states that a single node can corrupt the blocks and is limited to just a signing limit.

What is the solution to prevent a node corrupting even some data in a PoA network? I know VeChain is using PoA. They have a big venture so I assume this issue is resolved.

The issue to me is not limiting damage but eliminating damage.

Has anyone found a reference to a solution for this?


texts: Calling functions in MultiSigWallet with onlyWallet modifier

texts:
I've deployed a MultiSigWallet from ConsenSys. How can I call functions with onlyWallet modifier?

modifier onlyWallet() {
    if (msg.sender != address(this))
        revert();
    _;
}

Does the address variable need to be an account address or can it be a contract address?

var data = multisig.replaceOwner.call(web3.eth.accounts[1], web3.eth.accounts[2], {from: address}, function(err, res) { console.log(res.toString())});


texts: How do smart contracts launching new tokens get executed permanently?

texts:
As far as I know, in order to create a contract, a contract account is created which contains the code. When this account is triggered by a transaction or message call, the EVM executes this code.

What about smart contracts launching new cryptocurrencies? What triggers their execution? It looks like they are always executed.


texts:
i'm studying mastering ethereum with this site.
https://github.com/ethereumbook/ethereumbook/blob/develop/09smart-contracts-security.asciidoc

and all of example codes are using uint 256.

for example,

    pragma solidity ^0.4.19

    contract EtherStore {

        //unsigned integer type of 256 bits
        uint256 public withdrawalLimit = 1 ether;

        mapping(address => uint256) public lastWithdrawTime;
        mapping(address => uint256) public balances;

        function depositFunds() public payable {
            balances[msg.sender] += msg.value;
            }

        function withdrawFunds (uint256 _weiToWithdraw) public {

            ...
            ...
        }
    }

  uint256 public withdrawalLimit = 1 ether;

it use 256 bits just allocate 'integer 1' i think this is waste of memory and gas.

if this value treat to wei, these value only needs 60 bits.

i don't know why this book use 256bits to save '1'

thanks for your help :)


texts: Can't connect MetaMask to local geth node

texts:
I've set up a local geth node, and started it like so:
/usr/bin/geth --http --http.port 8545 --http.addr 0.0.0.0 --http.corsdomain '*' $ARGS

From the machine I'm trying to connect with, I can reach the local node like so:
curl --data '{"method":"eth_syncing","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST http://192.168.178.42:8545

Yet when I enter a new MetaMask network with rpc URL: http://192.168.178.42:8545/ and chainId 1, MetaMask responds with "Could not fetch chain ID. Is your RPC URL correct?".
What could be going wrong?
Just checked the Chrome console and found something interesting:
initSentry.js:8 Failed to fetch the chainId from the endpoint. Error: chain not synced beyond EIP-155 replay-protection fork block
  at r.jsonRpcRequest (ui.js:152)
  at async v.validateChainIdOnSubmit (ui.js:152)
  at async chrome-extension:/nkbihfbeogaeaoehlefnkodbefgpgknn/ui.js:152

Geth version: 1.10.2-stable-97d11b01
Went to check the sync state:
{
  currentBlock: 12315274,
  highestBlock: 12315377,
  knownStates: 662281856,
  pulledStates: 662253791,
  startingBlock: 12313270
}

That's current block 12,315,274. Fork block for EIP-155 is 2,675,000. Why would get say it isn't synched when calling eth_chainId?


texts:
I would like to listen to events on a contract, but I'm having trouble figuring out which of the interfaces is the correct one and finding an example on how to use it.

The way I see it:

Contract.eventFilter is v4 only
Contract.pastEvents is v3 only
LogFilter is v3 only and marked as deprecated, pointing to:
LogFilter.get_all_entries - v4 only
LogFilter.get is only in v3
and there are many many more...

The most promising is combination of Eth.filter with either:

Eth.getFilterChanges for listening to new events or
Eth.getFilterLogs for fetching them from history.

Which method should I use so that it will keep working once v4 comes out?


texts: What defines the currency of an Ethereum wallet?

texts:
I'm new here. I'm building a wallet app using vanityeth to generate addresses. I want to generate a wallet for Ethereum and wallets for some other ERC20 tokens. After doing some research, and please correct me if I'm wrong, but I found that an ethereum wallet generated with vanityeth can hold ERC20 tokens, but not more than one type of token at the same wallet.

So what defines what type of token a wallet stores?

Do I need to specify this before generating the wallet?


texts: Checking the blockchain within Solidity contract

texts: I want my contract to check a given range of blocks and see whether there are any transactions between a given pair of addresses. Is this possible to do in Solidity? Otherwise how would I do it?


texts:
I have a lot of errors using the API and I am wondering if there is anyway to debug it.

When I use

 curl "http://127.0.0.1:5001/api/v0/object/get?arg=QmU5KhkgvweYgE3Gsr8A19uFQrq7mszx7dubcoo89cTmAV&encoding=json"
{"Links":[],"Data":"\u0008\u0002\u0012\u000etrevor oakley\n\u0018\u000e"}

When I try

 curl "http://jenbil.com:5001/api/v0/cat?arg=QmU5KhkgvweYgE3Gsr8A19uFQrq7mszx7dubcoo89cTmAV&stream-channels=true"
curl: (7) Failed to connect to jenbil.com port 5001: Connection refused

netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address            State       PID/Program name
tcp        0      0 127.0.0.1:8180          0.0.0.0:*                   LISTEN      13749/ipfs
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN       1287/sshd
tcp        0      0 0.0.0.0:4001            0.0.0.0:*               LISTEN      13749/ipfs
tcp        0      0 104.236.58.158:8545     0.0.0.0:*               LISTEN      11669/geth
tcp        0      0 127.0.0.1:5001          0.0.0.0:*               LISTEN      13749/ipfs
tcp6       0      0 :::22                   :::*                    LISTEN      1287/sshd
tcp6       0      0 :::3000                 :::*                    LISTEN      11513/node
tcp6       0      0 :::30303                :::*                    LISTEN      11669/geth
tcp6       0      0 :::4001                 :::*                    LISTEN      13749/ipfs

Has anyone any ideas about this?


texts: Transaction Gas Payment - Out-of-Gas Exception

texts: When a function in a contract is called, if the gas limit is not enough, the out-of-gas exception occurs and the sender loses his gas. How to know in advance how much gas enough for any arguments values passed to the function?


texts:
When I read contract A Is B can this be read as contract A extends from contract B ?

Is is a mechanism for inheriting behavior, this is equivalent to objects inheriting behavior in object oriented languages ?

Searching for is on http://solidity.readthedocs.io/en/latest/search.html?q=is+&check_keywords=yes&area=default does not yield results.

Where to find list of solidity keywords or is reading doc https://media.readthedocs.org/pdf/solidity/develop/solidity.pdf required ?


texts: Deploying a smart contract with just bytecode


texts: Questions on memory/storage in smart contract

texts:
I've recently finished a course in smart contract and am trying to expand on the current project. One thing I'm trying to do is give more info into each campaign - things like, description, category, etc. I've modified my smart contract, but am running into an error, if you can help me take a look and point me towards the right direction, that'd be really appreciated! Also, if you can just take a look overall how I've modified the contracts to see if I have any redundancy anywhere, that'd be awesome. Cheers.

the error i'm getting on line 50 is - TypeError: Member "manager" not found or not visible after argument-dependent lookup in struct Campaign.NewCampaignType storage ref[] storage ref
require(msg.sender == campaigns.manager);

pragma solidity ^0.4.17;

contract CampaignFactory {

struct NewCampaignType {
string description;
uint minimumContribution;
string campaignCategory;
string endDate;
address manager;
}

address[] public deployedCampaigns;

function createCampaign(string description, uint minimumContribution, string campaignCategory, string endDate) public {
address newlyCreatedCampaign = new Campaign(description, minimumContribution, campaignCategory, endDate, msg.sender);
deployedCampaigns.push(newlyCreatedCampaign);
}

function getDeployedCampaigns() public view returns (address[]) {
return deployedCampaigns;
}
}

contract Campaign {

struct NewCampaignType {
string description;
uint minimumContribution;
string campaignCategory;
string endDate;
address manager;
}

struct Request {
string description;
uint value;
address recipient;
bool complete;
uint approvalCount;
mapping(address => bool) approvals;
}

NewCampaignType[] public campaigns;
Request[] public requests;
mapping(address => bool) public approvers;
uint public approversCount;

modifier restricted() {
require(msg.sender == campaigns.manager);
_;
}

function Campaign(string description, uint minimumContribution, string campaignCategory, string endDate, address manager) public {
NewCampaignType memory createCampaign = NewCampaignType({
description: description,
minimumContribution: minimumContribution,
campaignCategory: campaignCategory,
endDate: endDate,
manager: manager
});
campaigns.push(createCampaign);
}

function contribute() public payable {
require(msg.value > campaigns.minimumContribution);

approvers[msg.sender] = true;
approversCount++;
}

function createRequest(string description, uint value, address recipient) public restricted {
Request memory newRequest = Request({
description: description,
value: value,
recipient: recipient,
complete: false,
approvalCount: 0
});

requests.push(newRequest);
}

function approveRequest(uint index) public {
Request storage request = requests[index];

require(approvers[msg.sender]);
require(!request.approvals[msg.sender]);

request.approvals[msg.sender] = true;
request.approvalCount++;
}

function finalizeRequest(uint index) public restricted {
Request storage request = requests[index];

require(request.approvalCount > (approversCount / 2));
require(!request.complete);

request.recipient.transfer(request.value);
request.complete = true;
}

function getSummary() public view returns (
uint, uint, uint, uint, address
) {
return (
campaigns.minimumContribution,
this.balance,
requests.length,
approversCount,
campaigns.manager
);
}

function getRequestsCount() public view returns (uint) {
return requests.length;
}
}


texts: Firing a call to smart contract based on block count number

texts:
I need to send transaction at a specified time (block number).
How to write smart contract which fires at specified block number without input from outside?


texts: assembly in solidity: wrong result for and operator

texts:
Could somebody explain why the value of c variable is not 0x0c in code below:

function test() {
    byte b = 0x2c;
    byte c;
    assembly {
        c := and(b, 0xf)
    }
    Check(c);
}

The Check event shows 0x00 instead.

But code below works correctly:

function test() {
    byte b = 0x2c;
    byte mask = 0x0f;
    byte c;
    assembly {
        c := and(b, mask)
    }
    Check(c);
}

The value of c is 0x0c.


texts: How to setup parity light client?(warp sync is slow)

texts: I have a full node synced using --warp but since I have a hdd, the final bit of the sync never catches up(due to the high transaction IO). How do I switch to a light clent on parity if I already have most of the chain data?


texts:
As you know chainlink oracles work like callback functions. I have only one function is that payable one and I need to know the correct eth value in token parity.
I cannot request data when the payable function called it is too late.
Triggering with a cron job is non-optimum.
Only need to have e.g ADA/ETH parity when people want to buy NFT with eth. Because the standard token will be ADA.
Do I miss a thing in solidity or chainlink? How do you guys get price feeds and use right away ?


texts:
I get error when I try to call this function AvailableEnergyAdvert with energy_produced greater value > 1.
pragma solidity ^0.6.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/access/AccessControl.sol";

contract PowerGrid is Ownable,AccessControl {
........................
uint256 public energy_surplus = 0;
address payable public _owner ;
uint256 public Price1;
uint256 public Price2;
uint256[] pricerange;
uint256 net_total;
address payable public ProducerAddress;
..........
constructor () public payable
  {
    _owner= msg.sender;
  }
function AvailableEnergyAdvert(uint256  energy_produced, uint256  proposedprice ) public payable returns (bool check){
require(hasRole(Producers,msg.sender),"Not a Producer");
emit energyGenerated(msg.sender);
uint invokeTime = now;
timealive.push(invokeTime);
uint Time1 = invokeTime + 1 hours;
timealive.push(Time1);
uint Time2 = invokeTime + 2 hours;
timealive.push(Time2);
uint Time3 = invokeTime + 3 hours;
timealive.push(Time3);
emit TimeCalc(timealive);
if(energy_surplus == 990)
revert();
energy_surplus += energy_produced;
emit energyMoved(energy_produced);
pricerange.push(proposedprice);
Price1 = proposedprice + (proposedprice * 1 / 10);
pricerange.push(Price1);
Price2 = proposedprice + (proposedprice * 2 / 10);
pricerange.push(Price2);
emit PriceCalc(pricerange);
uint taxpaid = (proposedprice * energy_produced) / 2;
_owner.transfer(taxpaid);
emit confirmation(taxpaid);
return true;
}


texts:
I've deployed contract in ropsten test net with this source code:

pragma solidity ^0.4.15;

    contract C{

        function throws(){
            throw;
        }
        function reverts(){
            revert();
        }
        function requires(){
            require(false);
        }
        function asserts(){
            assert(false);
        }
    }

As I expected calling reverts() function should return me all gas. But this doesn't work and all I've paid a lot of ether for this failed transaction (https://ropsten.etherscan.io/tx/0x2084cc38b1695d52448a7cf5c887ca1ea3f82163491cc48c18e8987e6e9defed)

Can someone explain me how it's possible please?


texts: keccak3 in SOLIDITY and in WEB3 different hashes for an address type field

texts:
How can I get the same resulting hash from Keccak-256 ()in solidity and web3.sha3() in web3?

IN solidity using keccak256( address ) and using web3.sha3 ( address ) gives different results.

In web3 the address field is a string while in solidity it is an address.

How can I convert web3 string to an address type field?

I tried converting the address type field to a string in solidity and I still received different results in hashes.

For address to sting in solidity I used

function toString(address x) returns (string) {
    bytes memory b = new bytes(20);
    for (uint i = 0; i < 20; i++)
        b[i] = byte(uint8(uint(x) / (2**(8*(19 - i)))));
    return string(b);
}


texts: Did anyone succeed in using Truffle with Node v6?

texts: Truffle looks to be buggy when using with Node v6 (installed from homebrew). There's a ticket on Truffle github, but none seems to take it into account. Are people not using Node v6 or is there a workaround I didn't notice ? Thanks.


texts:
I've been using web3 v 0.20 and I recently noticed that getting accounts from

  web3.eth.getAccounts(function(error, accounts) {

returns undefined.

Is Metamask 7.2.1 forcing it to be undefined for getting accounts now? It used to be okay last week though :(


texts: web3 send signed transaction to smart contract

texts:
I have some basic questions about web3. Is it common to send transactions to the smart contract address when calling methods in the smart contract or should I send them to another wallet?

When executing this line of code, the contract address is automatically set as the recipient by the contract instance, right? Is the transaction automatically signed when this line is executed?

Thank you!

return await registerContractInstance.methods.addUserAddress("test").send({from: senderAddress});


texts: How do I get the raw private key from my Mist keystore file?

texts:
I use the Mist wallet.

I would like to know:

How I can get the private key of my account.
How I can use this private key to sign messages.


texts: Cannot see address on geth instance console in the dev network

texts:
I am trying to develop a ethereum private network & i am using a single dev node.

I startup my local dev instance of geth using this command below.

geth --mine --dev --rpc --rpccorsdomain="chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn"

Now the RPC is exposed this is the only instance. I have installed metamask in my browser & then i connected to the private network at the default port which is localhost:8545, i pressed create account.. & as expected it created an account with a new address.

When i go to my geth console, i tried to list my all the accounts in the running private network & expected the newly created account address in metamask to appear.. but nope.

When i do a eth.accounts or personal.listAccounts i don't see the account i created in metamask, what am i missing here ?

Please keep in mind that i have only run on geth instance. What is more weird is that when i do an eth.sendTrasanction to the newly created address in metamask, metamask shows me the correct amount i transferred.

Also i cannot send transaction from metamask address to an address in my geth instance, i get an failed transaction with an error message saying invalid recipient.


texts:
Say I have control of addresses A and B, and I am writing contract C. When I deploy C on the blockchain, it will have it's own address, that can send and receive ether. But I want to have a method on C which, when called, sends ether from address A to address B, not to or from C.

Of course I could do this by storing the private key for A in C, but then anyone could look at C, copy the key out, and use it themselves. I want to allow only C to send ether from A, not anyone else.

Is there any way to allow a contract to control another address, without making the key for that address publicly accessible?


texts: Setting up private network w Geth, can't unlock account and deploy contracts

texts:
I have set up a private network with Geth with the following command:

  geth --datadir="PathToDatadir" --mine -minerthreads 2 -verbosity 3 -maxpeers 5 --ipcapi "admin,debug,eth,miner,net,personal,shh,txpool,web3" --ipcpath "geth.ipc" --port 30301 --rpc --rpcport 8101 --rpcapi eth,web3,personal --etherbase "e04fe31f4133f25ef3e5bfb39146edcf28724acd" --networkid 9990

So far so good.

I have developed a system of contracts using truffle and testrpc and am now trying to deploy this to multiple nodes. When running truffle migrate, i run into trouble:

  Running migration: 1_initial_migration.js
    Replacing Migrations...
  Error encountered, bailing. Network state unknown. Review successful transactions manually.
  Error: account is locked

I have configured truffle to send from an address I want (same one that is defined as etherbase) but the account is locked. There are multiple ways to unlock an account using Geth. The only way it seems to work for me is if I unlock the account like this:

  geth --unlock "e04fe31f4133f25ef3e5bfb39146edcf28724acd" --password "fullPathtoTxtPasswordfile"

Does the account remain unlocked for future Geth invocations ? Unlocking through personal.unlockAccount("address","fullPathtoTxtPasswordfile") in the console is not working either. web3.accounts is also undefined.

So I seem to have succeeded in unlocking the accounts but truffle migrate is still giving me the account locked error. I have found similar problems with account unlocks but have not found a solution for my own specific problem.


texts: Read data from VIEW function on deployed contract

texts:
I'm trying to read some data from VIEW function on already deployed contract using my own smart contract. The function is standart "balanceOf(address)" of ERC20 token. I can read this data using etherscan web interface and no transaction required for this action, but I can't find the way to do the same using smart contract. I have this code (let's assume I have no source code of deployed smart contract, so I'm using abi.encode):

pragma solidity ^0.5.15;

contract Test  {

   address dc = 0xaD6D458402F60fD3Bd25163575031ACDce07538D; //ropsten network ERC20 token address
   uint number;
   event Log(uint256 number, bytes b);

    function balanceOf(address _val) public {
      bool status;
      bytes memory b;
      (status, b) = dc.staticcall(abi.encodePacked(bytes4(keccak256("balanceOf(address)")), _val));
        emit Log(number, b);
    }}

but each time in Event Logs I see the same four numbers:
0
64
32
0

I tried to use staticcall, delegatedcall and call with no success. Can anyone suggest how can I read data from VIEW function?

Thanks!


texts: Destory ERC20 tokens held in a specific address by contract owner?

texts:
Is it possible to destroy ERC20 tokens held in a specific address? We can write a method in contract using Ownable so only contract owner can execute it but my doubt is whether owner will actually be able to execute the method since tokens are held by a different account and smart contract owner can't sign the transaction for setting the balance of that address to 0?

How can this be done? This is needed in eventuality of stolen tokens. Are there any alternatives to described approach?


texts: How to send some amount to a Contract in truffle

texts:
My contracts were tested in both Browser Solidity and Mist Wallet and it works fine. I am trying to use testrpc and trying to depoy

Below is the javascript I am using it on truffle console

contribute - is a function which will accept address and it is of payable type. "0xe014b7528ae8b245b829dca3f9abceabc777b387" is the contract address

Please let me know what could be wrong here.

truffle(development)> hub.then(function(instance){
return instance.contribute("0xe014b7528ae8b245b829dca3f9abceabc777b387",{
from:web3.eth.accounts[0],value:10
});
}).then(function(result) {console.log(result)});


texts: Which consensus algorithm (POW or POA) is better for private blockchain?

texts:
POW requires lots of computational power so as the chain grow long we will need more computational power which is not required for private blockchain....
On the other hand, POA is looking better solution for private blockchain but it is so prone to deadlock link. I am wondering which one to use for my private blockchain?


texts: Incoming transaction confirmed but not showing in Mist wallet

texts:
I trasnferred E10 from Kraken on 05-04-16 13:20:09 +0100 to address 0x023d29a271b2a2406ceedf208f7e36e9e24ff23d with the transaction ID 0x22af76e14762e756e842bb30658a66a6fa45c763d8f5de2e8f9512921ce812dc.

The transaction has been validated over 100 times but my wallet shows no balance.

Wallet is new and blockchain is still syncing.

Any ideas on why this happens or I should go about it?


texts:
I am trying to compile the following contract on Remix IDE (online):
pragma solidity ^0.4.24;

contract ProofofExistence{
   event ProofCreated(
      uint256  indexed id,
      bytes32 documentHash);//an event can be listened by any client

   address public owner;//getters are already generated for public variables
   mapping  (uint => bytes32) hashesById;

   modifier onlyOwner() {
      require(msg.sender == owner);
      _;
   }

   modifier noHashExistsYet(uint256 id) {
      require(hashesById[id] == "");
      _;
   }//The modifeir can be prepended to any function

   constructor() public {//constructor is executed when the contract s created
      owner = msg.sender;
   }

   function notarizeHash(uint256 id, bytes32 documentHash) onlyOwner noHashExistsYet(id) public{
      hashesById[id] = documentHash;
      emit ProofCreated(id, documentHash);//Proof created event is emited to the block chain
   }//The core function of this contract allows its owner
   //to confirm a document id with a certain content

   function doesProofExist(uint256 id, bytes32 documentHash) public view returns (bool) {
      return hashesById[id] == documentHash;
   }//view/constant functions are read-only and do not cost gas
}

I am getting the following compilation error message:

  browser/ProofofExistence.sol:1:1: SyntaxError: Source file requires
  different compiler version (current compiler is
  0.5.1+commit.c8a2cb62.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma
  solidity ^0.4.24; ^----------------------^

Can somebody please guide me how to fix this problem?

Zulfi.


texts:
I want to make some extension to the ERC721.

Per example, set some tokens as "requestable" (anyone can request it), if the requester know the "key" of each token

So, I added a mapping with string for each token.

  // Mapping is token transferable knowing the tokenkey
  mapping (uint256 => bytes32) public encryptedTokenKey;

The standard function is

 function transferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
    require(_from != address(0));
    require(_to != address(0));

    clearApproval(_from, _tokenId);
    removeTokenFrom(_from, _tokenId);
    addTokenTo(_to, _tokenId);

    emit Transfer(_from, _to, _tokenId);
  }

I thought to change "canTransfer" but in that case I need to add a "secretkey" param, so it changes everything, everywhere ...

  modifier canTransfer(uint256 _tokenId) {
    require(isApprovedOrOwner(msg.sender, _tokenId));
    _;

  }

I though of something like this :

  /**
   * @dev Checks msg.sender can transfer a token, by being owner, approved, operator or having the tokenkey
   * @param _tokenId uint256 ID of the token to validate
   */
  modifier canTransfer(uint256 _tokenId) {
    require(isApprovedOrOwner(msg.sender, _tokenId)||keccak256(msg.tokenKey) == encryptedTokenKey[_tokenId]);
    _;
  }

With msg.tokenKey set in the call, prior to call "transferFrom", but of course it does not work :)

What is the way to implement it without changing everything ?

Is it to write a transferFromWithSecret function ?
And so rewrite all corresponding function ?

I search for the best way to implement it without breaking the ERC721 standard

Thanks in advance !


texts: Truffle "test" is passing only 1 it("") test instead of showing "all 3 tests passed"

texts:
MyToken.sol
//// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("StarDucks Capu-Token", "SCT") public {
        _mint(msg.sender, initialSupply);
        _setupDecimals(0);
    }
}

MyToken.test.js
const Token = artifacts.require("MyToken");

var chai = require("chai");

const BN = web3.utils.BN;
const chaiBN = require('chai-BN')(BN);
chai.use(chaiBN);

var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);

const expect = chai.expect;

contract("Token Test", async accounts => {
const [ initialHolder, recipient, anotherAccount ] = accounts;

it("All tokens should be in my account", async() => {
    let instance = await Token.deployed();
    let totalSupply = await instance.totalSupply();
    expect(instance.balanceOf(initialHolder)).to.eventually.be.a.bignumber.equal(totalSupply);
})

if("I can send tokens from Account 1 to Account 2", async () => {
    const sendTokens = 1;
    let instance = await Token.deployed();
    let totalSupply = await instance.totalSupply();
    expect(instance.transfer(reciepient, sendTokens)).to.eventually.be.fulfilled;
    expect(instance.balanceOf(initialHolder)).to.eventually.be.a.bignumber.equal(totalSupply.sub(new BN(sendTokens)));
    expect(instance.balanceOf(recipient)).to.eventually.be.a.bignumber.equal(new BN(sendTokens));
})

if("It's not possible to send more tokens than account 1 has", async () => {
    let instance = await Token.deployed();
    let balanceOfAccount = await instance.balanceOf(initialHolder);

    expect(instance.transfer(recipient, new BN(balanceOfAccount+1))).to.eventually.be.rejected;
    expect(instance.balanceOf(initialHolder)).to.eventually.be.a.bignumber.equal(balanceOfAccount);
});

});

test output:


texts: Potential Concurrent Engines for Ethereum?

texts:
I have been reading some papers on the topic of concurrency on blockchains, smart contract systems to be more specific. Most of the research in the last 3 years uses Ethereum as a reference of the smart contract chain. Some of these research claims up to 16 fold speedup under workloads with contention, given 32 threads, which is somewhat impressive to begin looking into this.

Yet, I have not yet seen any paper that addresses if and when any of their ideas can/will be ever implemented. Most assume EVM to be replaced with some other virtual machine which supports STM and other concurrency control primitives.

I was wondering if there has been any realistic discussion/conclusion around this in the past, and has it been revisited in the recent years? Technologies change, so will the potential smart contracts that might run on Ethereum and concurrency could have become more relevant ever since. This post and the referenced EIP is the best discussion that I have found so far. And while I have not read the EIP discussion in full yet, it does seem like some of the papers are suggesting more sophisticated approaches that might deserve to be tested.

Some papers:

Pang, Shuaifeng, Xiaodong Qi, Zhao Zhang, Cheqing Jin, and Aoying Zhou. ‘Concurrency Protocol Aiming at High Performance of Execution and Replay for Smart Contracts’. ArXiv:1905.07169 [Cs], 17 May 2019. http://arxiv.org/abs/1905.07169.Anjana, Parwat Singh, Sweta Kumari, Sathya Peri, Sachin Rathor, and Archit Somani. ‘An Efficient Framework for Optimistic Concurrent Execution of Smart Contracts’. ArXiv:1809.01326 [Cs], 14 January 2019. http://arxiv.org/abs/1809.01326.

Dickerson, Thomas, Paul Gazzillo, Maurice Herlihy, and Eric Koskinen. ‘Adding Concurrency to Smart Contracts’. ArXiv:1702.04467 [Cs], 15 February 2017. http://arxiv.org/abs/1702.04467.Saraph, Vikram, and Maurice Herlihy. ‘An Empirical Study of Speculative Concurrency in Ethereum Smart Contracts’. ArXiv:1901.01376 [Cs], 21 January 2019. http://arxiv.org/abs/1901.01376.


texts:
i'm facing a problem with coding the migration.sol
how i can fix these error space!

-

pragma solidity ^0.4.24;

contract Migrations {
    address public owner;
    uint public last_completed_migration;

    modifier restricted() {
        if (msg.sender == owner) _;
    }

    constructor() public {
    owner = msg.sender;
}

function setCompleted(uint completed) public restricted {
last_completed_migration = completed;}

function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
  }
}


texts: I just installed Ethereum wallet, but I do not see the Start Mining option in the menu. What am I missing?


texts: How to unpack/decode parameters encoded with web3.eth.abi.encodeParameters in Solidity?

texts:
My client app (nodejs) packs some arguments to pass to a smart contracts as bytes _data (similar to ERC223 calls with fallback). I pack the arguments in my JS client like this:

const packedArgs = web3.eth.abi.encodeParameters(['uint256', 'string'], ['123', 'Hello world']);`

When the solidity function gets that bytes argument, how does it unpack it back to uint256 and string?


texts: Parity 2.2.7 doesn't recognize "registrar" or "eip150Transition" in the genesis file

texts:
I am trying to run a Parity client and sync it with a Geth private blockchain. I was able to do it at first, but after adding "constantinopleBlock", "byzantiumBlock" and "petersburgBlock" to the genesis file of the Geth client, I couldn't get a valid genesis file for the Parity node.

I am using https://github.com/keorn/parity-spec to translate the genesis file, but Parity fails to start as it doesn't recognize the values "registrar",  "eip150Transition" or "eip155Transition" for example. If I remove them, it fails to validate the first block of the Geth node.

This is the genesis file of the Geth node:

{
  "config": {
    "chainId": 1337,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip150Block": 0,
    "eip160Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0
  },
  "alloc"      : {},
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x100",
  "extraData"  : "",
  "gasLimit"   : "0x700000000",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

This is the translated genesis file for the Parity node:

{
  "name": "GethTranslation",
  "engine": {
    "Ethash": {
      "params": {
        "minimumDifficulty": "0x20000",
        "difficultyBoundDivisor": "0x800",
        "durationLimit": "0xd",
        "blockReward": "0x4563918244F40000",
        "registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
        "homesteadTransition": 0,
        "eip150Transition": 0,
        "eip155Transition": 0,
        "eip160Transition": 0,
        "eip161abcTransition": 0,
        "eip161dTransition": 0
      }
    }
  },
  "params": {
    "accountStartNonce": "0x0",
    "maximumExtraDataSize": "0x20",
    "minGasLimit": "0x1388",
    "networkID": 1337,
    "eip98Transition": 9223372036854775807,
    "gasLimitBoundDivisor": "0x400"
  },
  "genesis": {
    "seal": {
      "ethereum": {
        "nonce": "0x0000000000000042",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x100",
    "author": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "",
    "gasLimit": "0x700000000"
  },
  "accounts": {}
}

I am using: Parity-Ethereum/v2.2.7-stable-b00a21f39-20190115/x86_64-macos/rustc1.31.1

What would be the correct genesis file for Parity?

Thanks!


texts: Deploying a Smart Contract displays warning: [Bad instruction]

texts:
I deploy a smart contract and it shows this error after I see it is created on testnet:

Warning! Error encountered during contract execution [Bad instruction]

When I go to contract code tab, it is empty and just has a 0x there.

Almost like contract created but not completely.

Here is the transaction that created the contract:

https://testnet.etherscan.io/tx/0xaf1adfc8a995068e0f8eb02ad5fa4582244997e4d8b8284165bd18937d6371b9

Here is the constructor piece of the contract:

pragma solidity ^0.4.8;

contract RouteCoin {

    string public parentContracts;

    address private buyer;

    address private seller;

    uint private contractStartTime;

    address private finalDestination;

    uint private contractGracePeriod;

    function RouteCoin(address _finalDestination, uint _contractGracePeriod, string _parentContracts) {
        buyer = msg.sender;
        contractStartTime = now;
        finalDestination = _finalDestination;
        contractGracePeriod = _contractGracePeriod;
        parentContracts = _parentContracts;
    }

Also when I use the Ethereum wallet i get this error:

No data is deployed on the contract address!

And when i go to Etherscan i see this:

Warning! Error encountered during contract execution [Bad jump destination]

https://testnet.etherscan.io/tx/0xadd8d2807cc9405ef317f664d86195464afcd62471dc890c9de69ac3a122f31d

Any ideas?


texts: got Error upgrading parity data: CannotUpdateVersionFile running parity 1.6

texts:
I launch my parity node as usual and get

Error upgrading parity data: CannotUpdateVersionFile

on startup


texts: Sent ETC from hardware wallet to ETH address on poloniex

texts:
I mistakenly sent ETC from my hardware wallet to an ETH address on poloniex. I sent an email to Poloniex helpdesk and they sent me over here to resolve the issue. I've read online that people have made similar mistakes as me and have been able to recover there coins.

Here is my response from Poloniex.


texts: How to get a public IP address with IPFS-JS

texts:
With IPFS JS when I run this:
const ipfsNode = await IPFS.create();
const addresses = await ipfsNode.swarm.localAddrs();
console.log(addresses);

I get this:
Swarm listening on /ip4/127.0.0.1/tcp/4002/p2p/PeeridFooBar
Swarm listening on /ip4/192.168.0.113/tcp/4002/p2p/PeeridFooBar
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/p2p/PeeridFooBar

But all of these are local/LAN addresses. How do I get a public ID so that from another node I can connect to this node over the internet like so: jsipfs swarm connect PUBLIC ADDRESS HERE?


texts: Help needed - Contract is deployed but execution of method always returns Zero

texts:
I have created a private blockchain and trying to create a sample contract given in https://github.com/ethereum/go-ethereum/wiki/Contracts-and-Transactions

I could create, compile and even deploy the contract but when I execute following statement:

myMultiply7.multiply.call(6)

It always returns "0".
Am I missing anything?

Steps I did:

Created a block chain.
Did some mining so that I can have some ether in my account. As it was a private network, I could get handsome amount of ether in my primary account.
Create and compiled contract in Geth Console as followed:

primaryAccount = eth.accounts[0]

source = "contract testA { function multiply(uint a) returns(uint d) { return a * 5; } }"
// compile with solc
contract = eth.compile.solidity(source).testA
// create contract object
var MyContract = eth.contract(contract.info.abiDefinition)
// extracts info from contract, save the json serialisation in the given file,
//contenthash = admin.saveInfo(contract.info, "~/info.json")
// send off the contract to the blockchain
var mycon = MyContract.new({from: primaryAccount, data: contract.code}, function(error, contract){
    if(!error && contract.address) {
        console.log("Contract mined! address: " + contract.address + " transactionHash: " + contract.transactionHash);
    }
});

Got the address as output but no transaction hash (Could this be a problem??).

Ran following :

var address = "<Address received in above code >";

var Multiply = web3.eth.contract([{constant:false,inputs:[{name:'a',type:'uint256'}],name:'multiply',outputs:[{name:'d',type:'uint256'}],type:'function'}]);
var myMultiply = Multiply.at(address);
myMultiply.multiply.call(9);

But last line always returns "0".

Unable to understand why this is happening. Am I missing certain steps? Do I need to do something else to get the contract executed?

Thanks in Advance..
Madhukar


texts: Who own ethereum 0x0000000000000000000000000000000000000000 address? I have received some 0Chain token from this address. I know this is a genesis address but who can access it?


texts:
According to the "Fork choice rule" in Ethereum 2.0 (sharding), how to choose a branch in a fork? (A) or (B) ?

  (A) branch, which has the most blocks in it. (similar to "longest
  chain" rule in PoW)

  (B) branch with more attesters across all the blocks.

For example, assuming two following branches in a fork:

(1) branch one: including 10 blocks, signed by 8 unique attesters.

(2) branch two: including 8 blocks, signed by 10 unique attesters.

According to the "Fork choice rule" in Ethereum 2.0 (sharding), which above branch in this fork will be chosen? (1) or (2) ?


texts: My current understanding is that when I send a transaction I am sending it to the ethereum network. What I don't understand about this is how exactly this happens. Let's say I'm using myetherwallet, do I send it to their node and they broadcast it to all the other nodes or does my computer broadcast it to all the nodes itself? I'm just confused as to how the actual data that my computer is sending gets to all the other nodes on the ethereum network.


texts: Open Auction again after succesful transaction - Why?

texts: I'm using MetaMask for bidding via the ENS registrar DApp. It happens from time to time that the transaction for a bid is confirmed on etherscan, and also the .json file lists it NOT as pending. But the registrar page shows "You have bid but ..." -> "Open Auction", and the ENS lookup doesn't show any actions on the name. Does anyone know why this happens (quite often BTW)?


texts: How to return the result of a Solidity view method from a javascript function?

texts:
I want to determine a view function of a smart contract result in web3js 1.x

Suppose we have a view function getName(uint code) and want to get the name of a person having his code. So we write:

contract.methods.getName(code).call(option)
  .then(...)
  .catch(...);

We want to define a function to return the result name and do something with it.

How can we relate the defined function and method call?

For example:

async function name(code) {
  contract.methods.getName(code).call(option)
    .then(...)
    .catch(...);
  return ???
}

for (let i = 0; i <= 10; i++) {
  let x = name(i);
  // Do something with x, for example:
  alert(x);
}


texts: Pattern to deploy a smart contract from another one without spending twice the gas

texts:
It seems that if we want to deploy a smart contract (let's call it Target) from another one (let's call it Deployer) in Solidity via new, we spend a gas amount linear in the size of the deployed contract twice. Example:

contract Target {}

contract Deployer {
  function deploy() external returns (Target) {
    return new Target();
  }
}

Here is why we pay for the code of Target twice:

to deploy the Deployer smart contract, which contains the bytecode of Target
to perform the actual transaction which does the deployment via new

Is there a pattern how we can we avoid this double cost? Let's assume the contract is deployed only once, so no costs can be amortized.


texts: How to get Ethereum Metadata? admin_getContractInfo does not exist

texts:
Is there a way to get the metadata(bytecode, ABI) of a deployed contract if you only know the address of the contract?

In geth there is a function in the admin interface called getContractinfo(), but I get an error when I call it: The method admin_getContractInfo does not exist/is not available

In the documentation(https://github.com/ethereum/go-ethereum/wiki/Contracts-and-Transactions) I saw an example but I don't think it works:

// get the contract info for contract address to do manual verification
var info = admin.getContractInfo(address) // lookup, fetch, decode
var source = info.source;
var abiDef = info.abiDefinition


texts: Why we can not add erc721 tokens in wallet?

texts: I have created an erc721 token and when i try to transfer it from one address to another address that transaction is not visible on etherscan, moreover tokens are also not visible in mew or metamask? And on etherscan contract appear as erc20 contract not as erc721 contract.


texts:
I have a fundamental question about eth/blockchain infrastructure. I see several posts talking about the need for backend node infrastructure when launching a dapp/ smart contract. This infrastructure could be infura, trongrid, ethscan, etc. or running your own node.

What I don't understand is:

(1) Why do you need this infrastructure? I thought when I launch a smart contract I just use some web3 api to place it on the eth blockchain and we're good to go. Is there some performance reason?

(2) People cite issues when running your own full node such as higher latency, usability, and manageability versus hosted services like infura. What makes these hosted services faster/easier to use than running your own node or just using eth's API to interact with the blockchain.

Thank You


texts: Difference between Micropayment channel and ReceiverPays in Solidity docs

texts:
I came across the Micropayments channel example in the solidity docs (here: https://solidity.readthedocs.io/en/v0.6.6/solidity-by-example.html#micropayment-channel). There are two cases presented with two contracts: SimplePaymentsChannel and ReceiverPays. I am trying to reconcile how one is different from the other, given that they both seem to accomplish the same thing. The steps outlined for each contract are below, verbatim:

ReceiverPays

Alice deploys the ReceiverPays contract, attaching enough Ether to
cover the payments that will be made.
Alice authorises a payment by signing a message with their private
key.
Alice sends the cryptographically signed message to Bob. The message
    does not need to be kept secret (explained later), and the mechanism for sending it does not matter.
Bob claims their payment by presenting the signed message to the smart contract, it verifies the authenticity of the message and then releases the funds.

Micropayments Channel

Alice funds a smart contract with Ether. This “opens” the payment channel.
Alice signs messages that specify how much of that Ether is owed to the recipient. This step is repeated for each payment.
Bob “closes” the payment channel, withdrawing their portion of the Ether and sending the remainder back to the sender.

Other than some minor differences like contract expiration and usage of nonce, what is the need to have two contracts that achieve essentially the same thing? Thank you.


texts: How can I make my Ethereum miner choose transactions with low gas?

texts: I read a lot that transactions that pay the higher gas price can get their transactions through quicker.  I would like to know how I could amend my miner code to select transactions with small fees.


texts: Metamask stopped innjecting Web3. How to inject Web3.js properly?

texts:
I've been running a Django application which allows users to sign up/log in using Metamask. Everything worked great until recent breaking changes:
In early 2021, MetaMask will no longer inject the web3.js API. You can still bring your own web3.js or similar library and use it with MetaMask. We will simply stop injecting a particular version of web3.js for you.
This is what I did before.
I DETECT METAMASK AS FOLLOWED  --> This still works
if (typeof web3 !== 'undefined') {
    data['web3_status'] = true;
    if (web3.currentProvider.isMetaMask === true) {
      console.log('success');
    } else {
      console.log('detection failed)';
    }
  } else {
    console.log('detection failed');
};

I ASKED THE USER TO ENABLE --> This still works
var accounts = await ethereum.request({ method: 'eth_requestAccounts' });

I ASK THE USER TO SIGN A MESSAGE FOR VERIFICATION --> This doesn't work
web3.personal.sign(nonce, account, function(error, signature)

Metamask no longer injects web3.js. So I try'd injecting my own as followed.
In my html header
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.2.9/web3.min.js"></script>`

In metamask.js script
const provider = new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/<MY-API_KEY>');
const web3 = new Web3(provider);

I receive the following error when trying to sign;
metamask.js:51 Uncaught TypeError: Cannot read property 'personal' of undefined

Thank you for your time.


texts: Unable to deploy contract that uses Oraclize using Remix

texts:
I was trying to use Oraclize just for testing. I was facing problems deploying a sample contract from quick-start section of oraclize doc.
I tried to use both testrpc and private network for deployment of smart contract.

On connecting remix to testrpc and deploying contract, I was hit by an error stating:

creation of browser/ExampleContract.sol:ExampleContract errored: Error: sender doesn't have enough funds to send tx. The upfront cost is: 1000000000000000000000000000001934427 and the senders account only has: 99999999999990327865
at runCall (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:69347:10)
at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:11327:24
at replenish (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:8420:17)
at iterateeCallback (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:8405:17)
at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:8380:16
at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:11332:13
at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:64434:16
at replenish (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:64381:25)
at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:64390:9
at eachLimit (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:64314:36)
at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:65494:16
at VM.AsyncEventEmitter.emit (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:64085:3)

So ideally saying the upfront cost of deploying this contract is 1000000000000000000 ethers.

Now when I tried connecting this to my private network and tried the same, I was git by an error stating:

creation of browser/ExampleContract.sol:ExampleContract errored: Gas required exceeds limit: 2002192.  An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation).

In both cases, the gas estimate too high preventing me from deploying contract.
I also tried to deploy the same contract using Ethereum-Wallet connected to my private network. But this time instead of importing oraclizeAPI.sol, I pasted it's code above my code (AFAIK, there is no way to import contracts files in ethereum-wallet yet).But here also I was hit by Intrinsic gas too low error.

PS: I have successfully deployed the same contract on Ropsten using MEW. Also I was able to deploy same contract using truffle and testrpc. So what's the problem with remix.


texts: How come my geth require to sync blocks from beginning after update to geth 1.4.12

texts:
I was running geth under a user call 'ethereum' with this command:
geth --datadir=/home/ethereum/.ethereum

It was up to date until today there have a quickfix on geth so I compiled the source code and try to run my geth with this command:
/home/ethereum/bin/geth --datadir=/home/ethereum/.ethereum

Somehow it said Synchronisation failed: block downloading canceled (requested)

Then, geth started to synchronize again from beginning. I don't have any idea how it can happen even I pointed to same directory.


texts: testing the hello world application on a different computer when the compute crashes/node not working

texts:
I am new to the blockchain technology. I want to test the blockchain functionality of a decentralized ledger.

I have created a hello world smart contract(on solidity, geth, mist browser) on computer A. Now I want to bring down the geth console on computer A and then start the geth console on computer B and test if I can see the hello world smart contract on computer B. what is the process to test this functionality? kindly help


texts:
contract deploy , web3 version is 1.0.0-beta.52.

let {bytecode, interface} = require('./1-compile')

let Web3 = require('web3')

let web3 = new Web3('http://localhost:7545')

console.log('version :', web3.version)

const account = '0xdf9c60D4F6E92c977f220dc507eDAfaEDF026c1c'

let contract = new web3.eth.Contract(JSON.parse(interface))

contract.deploy({
    data: '0x'+bytecode,
    arguments: ['hello world']
}).send({
    from: account,
    gas : '500000',
    gasPrice: '1',
}).then((instance) => {
    console.log('address: ', instance.options.address)
}).catch(err =>{
    console.log('err : ', err)
})

when i execute node xx.js, console outputs text like this. How can I fix it.

version : 1.0.0-beta.52
err :  { error:
   Error: Timeout exceeded during the transaction confirmation process. Be aware the transaction could still get confirmed!
       at _callee2$ (/Users/xx/Desktop/blockchain/workspace/my-dapp/node_modules/web3-core-method/dist/web3-core-method.cjs.js:418:36)
       at tryCatch (/Users/xx/Desktop/blockchain/workspace/my-dapp/node_modules/regenerator-runtime/runtime.js:45:40)
       at Generator.invoke [as _invoke] (/Users/xx/Desktop/blockchain/workspace/my-dapp/node_modules/regenerator-runtime/runtime.js:271:22)
       at Generator.prototype.(anonymous function) [as next] (/Users/xx/Desktop/blockchain/workspace/my-dapp/node_modules/regenerator-runtime/runtime.js:97:21)
       at asyncGeneratorStep (/Users/xx/Desktop/blockchain/workspace/my-dapp/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
       at _next (/Users/xx/Desktop/blockchain/workspace/my-dapp/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
       at process._tickCallback (internal/process/next_tick.js:68:7),
  receipt:
   { transactionHash:
      '0xcb9122b4897ec6714938b475c47e6a5fc9d71bdc3efb850251285bcbc27dcf95',
     transactionIndex: 0,
     blockHash:
      '0xeaa09735ef6226fc103b64d82d13d48dac60f3d927f9b9941ac151ebe8e12afa',
     blockNumber: 1,
     from: '0xdf9c60d4f6e92c977f220dc507edafaedf026c1c',
     to: null,
     gasUsed: 267772,
     cumulativeGasUsed: 267772,
     contractAddress: '0x1c6B7774F8c77daad698B764b853cBfEDBa54fcd',
     logs: [],
     status: true,
     logsBloom:
      '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
     v: '0x1c',
     r:
      '0x696a6859397be535077e9848e5d8aef6116d907f56d4d21e36160e4b639ac9ff',
     s:
      '0x333862057233193fe9ba3da9ce63b2f77203f07ecc832b50e3222092622caca5' },
  confirmations: 1,
  confirmationChecks: 750 }


texts: Truffle unbox drizzle not working properly

texts:
truffle version = 4.1.4

truffle unbox drizzle
truffle compile
truffle migrate
npm run build
npm run start

this gets me this error:

Truffle Drizzle-box fails with TypeError: (0 , _drizzle.generateContractsInitialState) is not a function

I can solve this with an answer from this question

this brings me to this new error.

uncaught at l Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `Home`.

and

Uncaught TypeError: Cannot read property '__reactInternalInstance$iugbinqqxet' of null

CONTENTS OF HOME.JS:

import React, { Component } from 'react'
import { AccountData, ContractData, ContractForm } from 'drizzle-react-components'
import logo from '../../logo.png'

class Home extends Component {
  render() {
    return (

Drizzle Examples

Examples of how to get started with Drizzle in various situations.

Active Account

            <AccountData accountIndex="0" units="ether" precision="3" />

SimpleStorage

This shows a simple ContractData component with no arguments, along with a form to set its value.

Stored Value: <ContractData contract="SimpleStorage" method="storedData" />

            <ContractForm contract="SimpleStorage" method="set" />

TutorialToken

Here we have a form with custom, friendly labels. Also note the token symbol will not display a loading indicator. We've suppressed it with the hideIndicator prop because we know this variable is constant.

Total Supply: <ContractData contract="TutorialToken" method="totalSupply" methodArgs={[{from: this.props.accounts[0]}]} /> <ContractData contract="TutorialToken" method="symbol" hideIndicator />

My Balance: <ContractData contract="TutorialToken" method="balanceOf" methodArgs={[this.props.accounts[0]]} />

Send Tokens

            <ContractForm contract="TutorialToken" method="transfer" labels={['To Address', 'Amount to Send']} />

ComplexStorage

Finally this contract shows data types with additional considerations. Note in the code the strings below are converted from bytes to UTF-8 strings and the device data struct is iterated as a list.

String 1: <ContractData contract="ComplexStorage" method="string1" toUtf8 />

String 2: <ContractData contract="ComplexStorage" method="string2" toUtf8 />

            Single Device Data: <ContractData contract="ComplexStorage" method="singleDD" />

    )
  }
}

export default Home


texts: Identifier not found or Not Unique testing contract truffle

texts:
Created a simple HelloEthereum.sol contract:

pragma solidity ^0.4.17;

contract HelloEth {

    string message;

    function HelloEth() public{
         message = "Hello Ethereum!";
    }

    function getmessage() public returns (string) {
        return message;
    }
}

Wanted to test it so I made a test.sol file in the same directory as the HelloEth.sol. The test file is:

pragma solidity ^0.4.17;

import "truffle/Assert.sol";

import "truffle/DeployedAddresses.sol";

contract TestHelloEth {

    function testGetMessage() public{
        HelloEth obj = new HelloEth();
        string expected = "Hello Ethereum!";
        Assert.equal(obj.getmessage(),expected,"str is right");
    }
}

ON COMPILING by typing truffle test test_hello_eth.sol
I get the error: Identifier Undeclared or Not Unique (reported on the line HelloEth obj = new HelloEth();)

Any help will be appreciated. THANKS!


texts: Weird error during buy tokens with eth on ropsten and other testnets

texts:
I get this error when executing swap token for ether on arb detection.
Error Message: execution reverted
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
at
getReserves()
at
Opcode: [STATICCALL]
in
0xbc03cf2c6443d9bb25c8fd9b701d9eb22f85f584
Opcode: [CALL]
in
0xbc03cf2c6443d9bb25c8fd9b701d9eb22f85f584

In nodejs, the error response is:
err...Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0x1c668xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "blockNumber": 8143875,
  "contractAddress": null,
  "cumulativeGasUsed": 922169,
  "from": "0xab3388xxxxxxxxxxxxx",
  "gasUsed": 922169,
  "logsBloom": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000

Since my buy token function in solidity works normally when I call it from truffle console, I was wondering what could be a likely cause.
Here is the buy token function:
function buyCryptoOnUniswap(uint256 etherCost , address cryptoToken) public payable returns (uint256) {
//address cryptoToken = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa;

if(etherCost > address(this).balance){
    return 0;
}

    uint deadline = now + 300; // using 'now' for convenience, for mainnet pass deadline from frontend!

    uint[] memory amounts = usi.swapExactETHForTokens.value(etherCost)(0, getPathForETHToToken(cryptoToken), address(this), deadline);
    uint256 outputTokenCount = uint256(amounts[amounts.length - 1]);

    return outputTokenCount;
}

Here is a typical transaction that depicts this.
I hope someone can clue me in on particular or likely causes of such.
Thanks.
UPDATE
With guidance from @goodvibration, I found that the error seems to be from this portion of code instead:
   function buyCryptoOnKyber(uint256 etherCost , address cryptoToken) public payable returns(uint256){
    //address cryptoToken = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa;
    if(etherCost > address(this).balance){
        return 0;
    }
    KyberNetworkProxyInterface proxy = getKyberExchange();
    ERC20 token = ERC20(cryptoToken);

        uint minRate;
        (, minRate) = proxy.getExpectedRate(ETH_TOKEN_ADDRESS, token, etherCost);

        //will send back tokens to this contract's address
        uint destAmount = proxy.swapEtherToToken.value(etherCost)(token, minRate);

        //send received tokens to destination address
       require(token.transfer(address(this), destAmount));

        // refund leftover ETH to user
        //msg.sender.call.value(address(this).balance)("");

    }

    function kyberToUniSwapArb(address fromAddress,address toAddress, uint ethAmount) public payable returns (uint256){

        uint256 cryptoAmountPurchased = buyCryptoOnKyber( ethAmount , fromAddress);

         sellCryptoOnUniswap(cryptoAmountPurchased , toAddress);

        }

function sellCryptoOnUniswap(uint256 cryptoQty , address cryptoToken) public payable returns(uint256){
///selling code
}

EDIT


texts: Is there a way to get vim plugin for Remix IDE?

texts:
I use vim regularly for coding.
I love the way remix gives all packages to develop on the browser, but it is convenient to go arrow keys and not being able to use vim shortcuts to delete.

Is there a way to add vim to Remix IDE?


texts: When I run truffle compile I get a ParserError: syntax error

texts:
Error i'm getting back when I run truffle compile

ParserError: Expected ';' but got 'contract'

How my contract looks:
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

import "@openzeppelin/contracts/utils/Counters.sol"

contract SomeContract is ERC721{

   using Counters for Counters.Counter;
       Counters.Counter private _tokenIds;
       mapping(string => uint8) hashes;

   constructor() public ERC721("SomeContract", "SMC") {}

   function awardItem(address recipient, string memory hash, string memory metadata)
   public
   returns (uint256)
   {
       require(hashes[hash] != 1);
       hashes[hash] = 1;
       _tokenIds.increment();
       uint256 newItemId = _tokenIds.current();
       _mint(recipient, newItemId);
       _setTokenURI(newItemId, metadata);
       return newItemId;
   }
}

My environment

Truffle v5.3.1
solidity 0.6.0
nodejs V15
web3 v1.3.5

It must have something to do with the versions of Truffle I am using with Solidity but I tried uninstalling and installing the packages but doesn't seem to work. Any help would be great. Thanks.


texts: I know basically zero about Ethereum, block chain etc. I have Augur reps. I have been asked to create an Ethereum address for the sale augur site. I don't have the slightest idea how to generate an address and or where to create an account for Ethereum. How to create an Ethereum address?


texts: How to manage transactions by an Admin in an ethereum based private network?

texts:
I am implementing a private blockchain with the Ethereum based solution Hyperledger Besu.
One thing I would like to do is:

Allow someone to create a transaction.
This transaction is only sent if the Admin validates the transaction else it's cancelled.

What is the better way to do that?
Is it possible to manage it via smart contracts on-chain?
Thank you very much for your answers!


texts:
Is there an existing Smart Contract implementation, which can public signed transactions of ERC20 Token transfers?

I like to give the users of a ERC20 token the ability to pay the transaction fees in tokens and not in ether. I'm not able to edit the existing Token-Contract. Is there maybe a solution, with an contract wallet or similar?

Reference:

https://github.com/bitclave/Feeless
https://hackernoon.com/you-dont-need-ether-to-transfer-tokens-f3ae373606e1


texts: "Thawing" mechanism to increate Block Gas Limit?

texts:
A smarter man than I (@edmund-edgar) recently told me:

Th[e Block Gas Limit of 5000 as noted by the gaslimit=0x1388 parameter] represents the current Ethereum main chain, and the initial gas limit for that chain was indeed 5000, which was too low to send any transactions. This was part of a deliberate process called "thawing", where the gas limit started out very low, and was gradually increased over time as people became more confident that the network was functioning correctly.

My question: by what mechanism did this "thawing" take place?


texts: How does truffle know which address to send a contract being migrated, and which account to charge gas to?

texts:
When using truffle to migrate smart contracts to Ganache it selects the first address to send the contract and also decrements the gas cost from this address.

How does truffle 'know' to select this address/account? It doesn't seem to be specified anywhere.

Also can it be changed?


texts: Truffle error "Don't set config.from directly"

texts:
I have parity running on my mac and I can start it with

parity --rpcaddr 0.0.0.0 --rpcport 8547 --port 30305 --rpccorsdomain '*' --rpcapi "eth,net,web3"

Once It's all sync'd up I then make a new directory and cd into it and then truffle init I then change truffle.js

module.exports = {
  networks: {
    development: {
      host: "0.0.0.0",
      port: 8547,
      network_id: "1"
    }
  }
};

I run truffle test and get

Error: Don't set config.from directly. Instead, set config.networks and
then config.networks[<network name>].from
    at Config.set [as from]
(/usr/local/lib/node_modules/truffle/build/cli.bundled.js:1868:15)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:209751:21
at process._tickCallback (internal/process/next_tick.js:109:7)

and if i try to deploy a test contract

truffle migrate --reset
Using network 'development'.

/usr/local/lib/node_modules/truffle/build/cli.bundled.js:23538
    throw new Error("Expected parameter '" + key + "' not passed to
function.");
    ^

Error: Expected parameter 'from' not passed to function.
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:23538:15
at Array.forEach (native)
at Object.options
(/usr/local/lib/node_modules/truffle/build/cli.bundled.js:23536:19)
at Object.run (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:72807:12)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:95270:23
at Object.needsMigrating (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:72955:14)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:95266:19
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:58698:9
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:37442:13
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:220423:9


texts: Can a transaction hash be used to identify the sender of a payment?

texts:
A user suggested using a transaction hash as a way to track user deposits (especially for ECR20 tokens):

The major issue arises when you start accepting erc-20 tokens as
payment, in that case when you wish to transfer tokens from each
user's address to your main account, each user account must have
ethers (to pay for transaction fee), but users have only transferred
tokens. This is the thing you should be worried about. One possible
way is you ask users for tokens as well as few ethers (for transaction
fee).
The other possible solution could be having a pool of fixed addresses
and providing users with repeated addresses. In that case, you have to
either ask the user for transaction hash or account from which they
are willing to pay to identify user's payment.

What I don't understand is this: Isn't the transaction hash publicly visible on the blockchain? If so, how can this be used as proof the the person who has the hash is the true sender of the payment if anyone can look up the recent transaction hashes to a specific address? And if it is not publicly visible how would I use the transaction hash as proof that this person sent the payment he is claiming to have sent if I myself cannot verify it?


texts: Does a light client require a chain of trust towards full nodes?

texts:
A full client does not need to trust any individual node on the Ethereum network, as the full client can see the activity from all nodes and discard any inconsistencies caused by ill intentioned nodes

Does the same apply for a light client, or does the light client require a chain of trust towards some node (or set of nodes) on the Ethereum network?


texts: Parse error in the program while compiling remix

texts:
pragma solidity v^0.4.0;

contract Goldbar
{
  address public creator;
  mapping (address=>uint)  public balance ;

  function Goldbar()
  {
      creator = msg.sender;
  }
//  if(creator.balance  <10)creator.transfer(1);
  event delivered(addressfrom, address to, uint amount) /// by using this function we can track the transfered funds.
//  function transfer(address reciver ,uint amount)

function transfer(address receiver,uint amount)
{
    if(balance[msg.sender] <amount)throw ;
    balance[msg.sender]  -=amount;
    balance[msg.reciver] +=amount;
    delivered(msg.sender,receiver,amount);
}

}

While compiling I got a error:

browser/Goldbars.sol:16:1: ParserError: Expected ';' but got 'function'
function transfer(address receiver,uint amount)
^------^


texts:
I'm getting the error

Error: invalid solidity type!: decimal10

when making a call to my contract using web3.js

I believe it enters this in web3/lib/solidity/coder.js

SolidityCoder.prototype._requireType = function (type) {
var solidityType = this._types.filter(function (t) {
    return t.isType(type);
})[0];

if (!solidityType) {
    throw Error('invalid solidity type!: ' + type);
}

  return solidityType;
};

Where the type isn't found, is there a way to overcome this issue?


texts: Quorum private transaction is being reverted by EVM

texts:
I had setup an quorum network using quorum maker (3 nodes). I tried to perform a public transaction and it worked. But when I tried to perform a private transaction it gets reverted by the EVM

node:25206) UnhandledPromiseRejectionWarning: Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0xc89a7fc5a1cbd11ce501f8bcc349ab82d1b9f3f9404fe093502603409fb96ac4",
  "blockNumber": 20,
  "contractAddress": null,
  "cumulativeGasUsed": 0,
  "from": "0x59a83f92034da597b815debb45d4e8bd215763ee",
  "gasUsed": 0,
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "status": false,
  "to": "0xf315438f4b07fa2948e404610f8de6a69733b6cd",
  "transactionHash": "0x66a9dbc463fd2a4486dd78c6c97d29bb048fbb27d7a739be91f63551f548e225",
  "transactionIndex": 0,
  "events": {}
}
    at /root/Desktop/quorumtest/testproject/node_modules/web3-core-method/src/index.js:364:46
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:25206) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:25206) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Is it because constellation is not working /running properly. Am I missing something here ?


texts: Multiple GasLimits on my Private Ethereum network?

texts: I am wondering if it is available to make multiple gas limit block in one of my private networks. The multiple gas limits blocks in a private network means that size 10, 100, 1000 and so on, those are mixed in a same private ethereum network. I have checked that it seems unavailable, but I wanted to create multiple gaslimit block sizes if any possible. Please let me know any comments.


texts: How can I detect with Web3.js a NET change in Metamask navigator plugin?

texts: How can I detect with Web3.js a NET change in Metamask navigator plugin ?


texts:
I am rying to get the address of public variable tokenContract of datatype contract but its returning the address as ''0x0000000000000000000000000000000000000000''   below is the code for the same

Smart Contract code

pragma solidity ^0.4.2;

/**
 * The AjTokenSale contract does this and that...
 */
 import './AjToken.sol';

contract AjTokenSale {
    address admin;
    AjToken public tokenContract;
    function AjTokenSale() public {
        //Assign an Admin
        admin = msg.sender;
        //Token contract
        //Set the Token Price

    }
}

Test Code

var AjTokenSale = artifacts.require('./AjTokenSale.sol');
var AjToken  = artifacts.require('./AjToken.sol');
contract('AjTokenSale', function(accounts) {
    var tokenSaleInstance;

    it('Initializes the contract with the correct values', function() {
        return AjTokenSale.deployed().then(function(instance) {
            tokenSaleInstance = instance;
            return tokenSaleInstance
        }).then(function(address) {
            assert.notEqual(address,0x0, 'has contract address');
            return tokenSaleInstance.tokenContract();
        }).then(function(address) {
            //assert.equal(address, 0x0, 'Token contract has the address');
            assert.notEqual(address, 0x0, 'Token contract has the address');
        });
    });
});

When i am running above code test is failing on "Token contract has the address" it returns the assertion error as below,

"AssertionError: Token contract has the address: expected '0x0000000000000000000000000000000000000000' to not equal 0"

Really not sure , what is happening..

Need help..


texts: If I want to send a transaction on my frontend of my smart contract I have the possibility to set the optional field gasPrice. Should I set this value on my own, fetching it from an oracle like ETH Gas Stadion? Or does a third party provider like Metamask do this for me?


texts: eth sent to non address due to 2 missing digits off the end of address, can it be retrieved?

texts: Etherereum sent to non address due to 2 missing digits off the end of address, can it be retrieved?


texts: At any given time, how many nodes is my node connected to? As the number of nodes in the network increases, will communication between them be faster?

texts:
I have been reading through the DEVp2p documentation and cannot seem to wrap my head around some aspects of the network. Specifically, how many nodes is my node connected to? Does this number change as I perform a transaction? As more nodes become available, does my node connect to the most convenient ones in terms of speed? What other resources can I use to learn more about the underlying infrastructure?

I have been reading over the following pages but cannot seem to wrap my head around it:
1
2


texts: Compute iterations until gas limit would be reached, then revert to before gas limit reached

texts:
I have a contract doing a lot of multiplication & addition.
Something like:

for (uint index = 0; index < 10; index++) {
      let numAdders = adders[index];
      if (numAdders > 0) {
        added = numAdders * index;
        tokens[senders] = tokens[sender] + added;
     }
}

A) I see the opcode cost is 3 for add, 5 for multiply... so it looks like I'm never in danger of running out of gas for this, right?

B) If the 10 in the above code was dynamic, could I have the contract iterate through index up until gas limit was reached (or some gas limit threshhold set by the caller of the function passed as a param) and then commit all state changes up to that point + store a state variable to know where to continue next function call?


texts: Solidity Puzzle! How to get position in a list without looping over unbounded mapping?

texts:
Consider I mint 10 CryptoDoggy NFTs, each with an incrementing ID, starting at 0. I also have a uint => uint mapping, which records the position of the NFT using its ID as a key. Initially, its position will be equal to its ID. So the 5th CryptoDoggy I mint will have ID 4 and position 4.

Now, say that I wish to burn the CryptoDoggy with ID 5. The CryptoDoggy with ID 6 is now in position 5, and likewise with all IDs above 5.

But, updating the positions by looping over the whole mapping is not an option if CryptoDoggy creation is unbounded.

So how, for example, would I get the position of the CryptoDoggy with ID 8, without looping over anything unbounded?


texts: Can manage node in my ethereum private network

texts:
I have created ethereum private network. there are two node got connected with in this network. both are mining. I have created small contract for transaction. All transaction is happening through my application with my contract.

if i add other node:

Can i remove that node from the private network?(in case they do unwanted transaction)
Can i make other node has to use contract whenever they do normal transaction in ethereum console?
Can i restrict them to create contract?
Can i restrict them to do transactions except verifying?


texts: JSON RPC + web3: Subscribe to Solidity events

texts:
When using web3 and the JSON RPC, is there a way to subscribe to Solidity events?  For instance, I want to subscribe to every

event Transfer(address indexed from, address indexed to, uint256 value);

sent from the contract at address 0x123whatever.

Ideally, I could do this using a hosted JSON RPC provider, and not by running my own node.  But if it's impossible on a hosted provider, I might begrudgingly accept instructions for how to do it running my own node.


texts:
I’m fairly new to Crypto and have just made a recent transaction but I accidentally set my gas price and transaction fee too low therefore the amount needed to be mined is incredibly high, here is the transaction link https://bscscan.com/tx/0xa0e128a866bb474e3ab2e7659ef4bcb9b1a688c73ae9110aff34b8e159dbb1e3
Is there anyway I can speed this up? Or even cancel it?


texts: I am trying to send my ethereum on ledger wallet ethereum to bittrex. I've sent 8 times and it gets cancelled due to running out of gas. Unless I'm crazy there is no way to increase the amount of GAS, 21000. No idea what to do, should of just stuck with btc


texts: How can I pass an unsigned transaction to a smart contract?

texts: I have an unsigned transaction that I got from the 0x API in my web3 app. I would like to pass it as an argument to a function within a smart contract, is this doable? how? I already read about a solution they provide but I cant get it to work in my enviroment (web3.py + remix) plus I feel like theres got to be a much simpler solution


texts: Forward all function calls and arguments to another contract

texts:
I want to build a truly upgradable contract. I want the child contract to only implement state and then forward all functional requests to a main implementation contract. So the scheme should look like this:

pragma solidity 0.6.2;

contract Master {
    mapping(address => uint) public balances;
    address public implementation;

    function setBalance(address _address, uint _balance) public {
        balances[_address] = _balance;
    }

    function getBalance(address _address) public view returns (uint) {
        return balances[_address];
    }

}

contract Child {
    mapping(address => uint) public balances;
    address public implementation;

    function setImplementation(address _address) public {
        implementation = _address;
    }

    fallback() external payable {
        // call implementation with function
    }
}

As can be seen in this very simple example the state representation is the same which is the requirement for the delegatecall method. The main functions are all implemented in the Master and the child simply contains the state and a function to update the implementation. (Disregard the security issues here).

In this example I want to be able to call Child.setBalance. Is it even possible to forward all function requests to the master implementation?

I can't find any information on this in the documentation.

My reasoning for this:

I am currently building a collection of contracts that are rather expensive to deploy. So I want to design a system where the user only deploys the minimal Child implementation and then chooses which version of the current implementation he wants to use. This allows truly upgradable contracts that can introduce new functionality on the same state after some time. So this is different from using libraries.

Solution:

For anyone interested. The solution was to use the OpenZeppelin Proxy contract. I updated it to fit 0.6.x solidity compiler versions:

pragma solidity 0.6.2;

contract Master {
    mapping(address => uint) public balances;
    address public implementation;

    function setBalance(address _address, uint _balance) public {
        balances[_address] = _balance;
    }

    function getBalance(address _balance) public view returns (uint) {
        return balances[_balance];
    }

}

contract Child {
    mapping(address => uint) public balances;
    address public implementation;

    function setImplementation(address _address) public {
        implementation = _address;
    }

    fallback () payable external {
        _fallback();
    }

    function _fallback() internal {
        _delegate(implementation);
    }

   function _delegate(address _implementation) internal {
    assembly {
      // Copy msg.data. We take full control of memory in this inline assembly
      // block because it will not return to Solidity code. We overwrite the
      // Solidity scratch pad at memory position 0.
      calldatacopy(0, 0, calldatasize())

      // Call the implementation.
      // out and outsize are 0 because we don't know the size yet.
      let result := delegatecall(gas(), _implementation, 0, calldatasize(), 0, 0)

      // Copy the returned data.
      returndatacopy(0, 0, returndatasize())

      switch result
      // delegatecall returns 0 on error.
      case 0 { revert(0, returndatasize()) }
      default { return(0, returndatasize()) }
    }
  }

}


texts: Simplest way to set up an Ethereum DApp development environment On Ubuntu 14.04 including a Client, and IDE and test environment

texts:
What is the simplest way to set up an Ethereum DApp development environment on Ubuntu 14.04 including a Client, and IDE and test environment?

I'm basing this Client-IDE-Test configuration on the suggestions here:

  Firstly, download the latest stable binary of Alethzero, our C++
  client, and install on your chosen operating system. If you experience
  problems with the stable build then you may wish to switch to the
  latest cutting edge version, which may ameliorate some of your issues.
  If you choose instead to build your own then build instructions are
  here.

  Secondly, Install MIX our integrated development environment available
  for Windows and Mac here. If you are using Linux follow the
  instructions here to install mix also.

  Finally, make sure you install Mist to test your Dapps and fine-tune
  your front-ends as you develop them.

It seems as if significant development has taken place since this was written - with everything being combined in the webthree umbrella repository?

I'm hoping the answer will be as simple as

sudo apt-get Ethereum-dapp-development-stuff

though that may be wishful thinking...


texts: Is a transaction valid if it was signed weeks in the past?

texts:
I'd like to add scheduled transactions functionality to my chrome extension, but I don't want to ask the user for password input every time a scheduled tx is sent. My idea is to create and sign transactions then save them, and then send them when it's time.

I'm aware that a transaction must include a nonce, and if no transactions are sent in the mean time, the nonce shouldn't be a problem. But what if I wanted to send transactions after SIGNING the scheduled TX but before SENDING that scheduled TX? For example could a TX with nonce 2 be sent after a TX with nonce 3?


texts: Using "sendTransaction" when we call a contract function

texts:
I've seen some contracts like here (e.g. in line 332), use "sendTransaction" when they call contract's function. Cannot we call a function without using "sendTransaction"? As I've been calling functions without using it (on testrpc and private chain) and it works fine.

Question 1: Do we have to use "sendTransaction" when we call a contract function?

Question 2:  When should we use "sendTransaction"?


texts: How do we communicate with contract functionality which is deployed in public test network using web3j

texts:
I would like to write a wepapp for security token contract which is deployed in public Ropsten Test Network using web3j. Need some idea.

Thanks in Advance


texts:
I am testing a private network and I want to test using truffle to migrate/deploy some contracts.

Is there a library of test contracts somewhere that I can use for this?


texts: Is anyone working on a blockchain ethereum system for US national healthcare system insurance marketplace?

texts: Specifically I am asking for info on any one person or company coding to solve this huge medical insurance marketplace quagmire we are currently in. Now with Trump's latest deed our insurance premiums are going to increase dramatically. As if they were not high enough already. What I suggest is a blockchain or smart contract system whereby all insurance companies would subscribe to and adhere to pricing that is computed to give not only profitability but affordability to all. Can you imagine such a system? Many questions come to mind of course but they can all be solved through coding like everything else. Care to comment? Please add tags to help propagate this question and comments.