texts: Why set value to 0 rather than deleting it?

texts:
In this example contract: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC721/ERC721Token.sol

The removeToken method is supposed to delete a token; the token _tokenId no longer exists. So why does it do tokenOwner[_tokenId] = 0; instead of delete tokenOwner[_tokenId];?

Surely setting the value to 0 does not actually delete it? Wouldn't that mean that the contract will always take more storage space, never going down, even when the tokens are burnt?


texts: Unable to Unlock Account Even After specifying allow-insecure-unlock

texts:
Software: Ubuntu on VirtualBox

Update, tried putting two dashes, on allow-insecure-unlock, doesn't work

solidity@solidity:~$ geth attach http://127.0.0.1:8545 --allow-insecure-unlock
Incorrect Usage: flag provided but not defined: -allow-insecure-unlock

attach [command options] [arguments...]

The Geth console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.
This command allows to open a console on a running geth node.

ETHEREUM OPTIONS:
                                      --datadir value                       Data directory for the databases and keystore (default: "/home/solidity/.ethereum")

API AND CONSOLE OPTIONS:
                                      --jspath loadScript                   JavaScript root path for loadScript (default: ".")
                                      --exec value                          Execute JavaScript statement
                                      --preload value                       Comma separated list of JavaScript files to preload into the console

flag provided but not defined: -allow-insecure-unlock

I am on the Rinkeby test network, following the Pluralsight tutorial.

I am having an issue with unlocking account, and many places suggest starting geth with allow-insecure-unlock.

Still doesn't work

solidity@solidity:~$ geth attach http://127.0.0.1:8545 allow-insecure-unlock
Welcome to the Geth JavaScript console!

instance: Geth/v1.9.7-stable-a718daa6/linux-amd64/go1.13.4
at block: 5493433 (Sat, 23 Nov 2019 15:24:19 EST)
 modules: eth:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> personal.unlockAccount("0x97b7d25255b6664e8defac7895c6d6ee7e21d2f5")
Unlock account 0x97b7d25255b6664e8defac7895c6d6ee7e21d2f5
Password:
Error: account unlock with HTTP access is forbidden


texts: Is the Ethereum 2.0 price fixed to the old Ethereum permanently?

texts:
I read that it will be possible to convert one old Ether for one Ether 2.0 but not vice versa.
Is this correct and does the algorithm guarantee this "exchange rate" forever (and thus protect the old Ether from becoming worthless if everybody switches)?


texts: How to create link for filling up form in MEW

texts: I have link for filling up forms in MEW. I want to generate link for deployment contract for this page. How can I generate link for filling up byte code in form?


texts: Error: Invalid number of arguments to Solidity function when calling safeTransferFrom function

texts:
I want to call the safeTransferFrom function to transfer ERC721 tokens. I am using the following code:

var contract = this.web3.eth.contract(JSON.parse(contractabierc721)).at(contractAddress);
    // console.log(contract);
    var txdata =  contract.safeTransferFrom.call(from, to, 3, function(err, result){
        console.log(result);
    });

The safeTransferFrom signature is from, to , tokenID. However, when I call this way, it gives this error Error: Invalid number of arguments to Solidity function.

What is the correct way to call this function?

I am using web3js version ^0.20.6


texts: how do I enable transaction QR codes in the Parity Wallet browser app?

texts:
I'm Parity 1.7 installed via Homebrew on MacOS. I cannot see the QR code for signing transactions. How do I enable this feature?

Parity//v1.7.0-beta-5f2cabd-20170727/x86_64-macos/rustc1.18.0

I see this:

But not this:


texts:
I am trying to use the openzeppelin ReentrancyGuard contract within my ERC721 Token smart contract. Since this ReentrancyGuard contract has a constructor, I am required to declare it in my contract. However, since I am already declaring the constructor for my ERC721 Token, I am receiving an error, stating "More than one constructor defined". How can I solve this issue?
 contract MyContract is ERC721, ReentrancyGuard {
    constructor() ERC721("MyToken", "TOK") public {
    }
    constructor () ReentrancyGuard() internal {
    }
 }

Thank you. J


texts: While studying about swarm, I came to know that every Swarm node exposes a local HTTP proxy that implements the BZZ URL schemes. What is BZZ protocol here?


texts: How can I import the Accounts from ganache-cli into Nethereum?

texts: Is there a way to automatically load the Accounts created by ganache-li into a project which uses Nethereum?


texts: How to create an interaction between a smart contract and a HTML file with Node-js?

texts:
My Truffle project is this contract that just shows Yerevan is love:

pragma solidity ^0.5.12;

contract TEST{
string public note="Yerevan is love";
function rep() public view returns(string memory){
return note;
}
}

And by the following code i can see Yerevan is love in Node-js:

var Web3=require('web3');
var web3=new Web3('ws://localhost:8545');
var test_json='C:/Users/lenovo/node_modules/Yerevan/build/contracts/TEST.json';
var test_js=JSON.parse(fs.readFileSync(test_json));
var test_abi=test_js.abi;
var test_sol=new web3.eth.Contract(test_abi, '0xb198a5509138b265234BbD357F77cF44350e10D1');
    test_sol.methods.rep().call().then(function(o){console.log(o);});

I want to see the result in my browser. How can i create an interaction between the smart contract and a HTML file, by Node-js, to see the result in my browser?. If yes please provide its appropriate code and a guide for beginner me.


texts: Can someone explain 'signing a transaction' and how its different from sending ether?

texts:
Some times when using meta mask or other contracts, instead of sending an amount, I simply sign the transaction.

see here

Say I want a function() that renames a string.

function string(string name){
    string myname = name;
}

How would I make this function do this - not by sending ether, but by signing the transaction? Does a transaction already need to take place?

I'm looking for a technical explanation of implementation signing within a contract. Say I want a function that requires a signature from metamask.


texts:
I need to write a contract. That contract should detect and alert while receiving token/ether with some parameter.
If somebody sends token/ether with some parameter to my contract. I need to know at the time of the transaction received.
Is any event available to do this function
Thanks in advance


texts: How do you sign an verify a message in javascript proving you own an Ethereum address?

texts: Is there a js library or even just pure js where I can sign and verify I own an Ethereum address?


texts:
Hello friends i have error at my code can i have some help please

code :

pragma solidity 0.4.8;

/* The token is used as a voting shares */
contract token { mapping (address => uint256) public balanceOf;  }

/* The democracy contract itself */
contract Democracy {

/* Contract Variables and events */
uint public minimumQuorum;
uint public debatingPeriodInMinutes;
Proposal[] public proposals;
uint public numProposals;
token public sharesTokenAddress;

event ProposalAdded(uint proposalID, address recipient, uint amount, string description);
event Voted(uint proposalID, bool position, address voter);
event ProposalTallied(uint proposalID, int result, uint quorum, bool active);

struct Proposal {
    address recipient;
    uint amount;
    string description;
    uint votingDeadline;
    bool openToVote;
    bool proposalPassed;
    uint numberOfVotes;
    bytes32 proposalHash;
    Vote[] votes;
    mapping (address => bool) voted;
}

struct Vote {
    bool inSupport;
    address voter;
}

/* modifier that allows only shareholders to vote and create new proposals */
modifier onlyShareholders {
    if (sharesTokenAddress.balanceOf(msg.sender) == 0) throw;
    _;
}

/* First time setup */
function Democracy(token sharesAddress, uint minimumSharesForVoting, uint minutesForDebate) {
    sharesTokenAddress = token(sharesAddress);
    if (minimumSharesForVoting == 0 ) minimumSharesForVoting = 1;
    minimumQuorum = minimumSharesForVoting;
    debatingPeriodInMinutes = minutesForDebate;
}

/* Function to create a new proposal */
function newProposal(address beneficiary, uint etherAmount, string JobDescription, bytes transactionBytecode) onlyShareholders returns (uint proposalID) {
    proposalID = proposals.length++;
    Proposal p = proposals[proposalID];
    p.recipient = beneficiary;
    p.amount = etherAmount;
    p.description = JobDescription;
    p.proposalHash = sha3(beneficiary, etherAmount, transactionBytecode);
    p.votingDeadline = now + debatingPeriodInMinutes * 1 minutes;
    p.openToVote = true;
    p.proposalPassed = false;
    p.numberOfVotes = 0;
    ProposalAdded(proposalID, beneficiary, etherAmount, JobDescription);
    numProposals = proposalID+1;
}

/* function to check if a proposal code matches */
function checkProposalCode(uint proposalNumber, address beneficiary, uint etherAmount, bytes transactionBytecode) constant returns (bool codeChecksOut) {
    Proposal p = proposals[proposalNumber];
    return p.proposalHash == sha3(beneficiary, etherAmount, transactionBytecode);
}

/* */
function vote(uint proposalNumber, bool supportsProposal) onlyShareholders returns (uint voteID){
    Proposal p = proposals[proposalNumber];
    if (p.voted[msg.sender] == true) throw;

    voteID = p.votes.length++;
    p.votes[voteID] = Vote({inSupport: supportsProposal, voter: msg.sender});
    p.voted[msg.sender] = true;
    p.numberOfVotes = voteID +1;
    Voted(proposalNumber,  supportsProposal, msg.sender);
}

function executeProposal(uint proposalNumber, bytes transactionBytecode) returns (int result) {
    Proposal p = proposals[proposalNumber];
    /* Check if the proposal can be executed */
    if (now < p.votingDeadline  /* has the voting deadline arrived? */
        || !p.openToVote        /* has it been already executed? */
        ||  p.proposalHash != sha3(p.recipient, p.amount, transactionBytecode)) /* Does the transaction code match the proposal? */
        throw;

    /* tally the votes */
    uint quorum = 0;
    uint yea = 0;
    uint nay = 0;

    for (uint i = 0; i <  p.votes.length; ++i) {
        Vote v = p.votes[i];
        uint voteWeight = sharesTokenAddress.balanceOf(v.voter);

Error:

Thank you in advance


texts:
I'm working on some code right now that scans the blockchain block by block.

During that process I catalog new addresses as I encounter them in the TX list with each block.

Is there any other way to identify addresses?  It seems to me you cannot know about an address (aside from being the actual account holder) until it receives a TX of some sort?  Is that correct?


texts: what are the consequences of using web3.eth.defaultBlock

texts:
Web3 JavaScript app API provides property defaultBlock. It is described in documentation:

This default block is used for the following methods (optionally you can override it by passing the defaultBlock parameter):
•web3.eth.getBalance()
•web3.eth.getCode()
•web3.eth.getTransactionCount()
•web3.eth.getStorageAt()
•web3.eth.call()
•contract.myMethod.call()
•contract.myMethod.estimateGas()

also is said that it defaults to latest Block and it's save to say it is possible to set it to another block.
The impact of overriding the defaultBlock is not clear to me - is there an effect on my account balance or an effect on geth syncing or other effects?


texts:
I scoured the Mix and Solidity repos for something like a formal definition of the language's grammar, so that one may generate parsers using tools like GrammarKit, but couldn't find anything.

Any pointers?


texts:
I need help, and every time I unlock an account. my account will be transferred to someone else's accoun. at 0x957cd4ff9b3894fc78b5134a8dc72b032ffbc464this address trading records
I found that the account was so much eth that I was not alone.
I need some way to solve this problem
I found that it was safe to unlock an account when rpcaddr was 127.0.0.1, but if my system and wallet system were no longer together, would I have to set the rpcaddr to 0.0.0.0?
What's the solution


texts:
While deploying contract to ropsten tesnet (truffle migrate --network ropsten) I am getting an error:

insufficient funds for gas * price + value

  ropsten: {
      network_id: 3,
      host: "localhost",
      port:  8545,
      gas:   4698712,
      gasPrice:   65000000000,
      from: '14e6b19304fb3c98a73acea5f80d2c056ee5c09f'

    }

I checked eth.syncing, it was initially false. But after some times it shows something like this:

 eth.syncing
{
  currentBlock: 3733045,
  highestBlock: 3737770,
  knownStates: 46235540,
  pulledStates: 46235540,
  startingBlock: 3732532
}

How can I fix the error and solve the syncing issue. The syncing has not been completed since 7 days.


texts: Do dapps(contract) check allowance of buyer when he calls buy function?

texts: When a buyer calls a buy function on dapp contract, some dapps check the buyer's allowance before transfer tokens(erc20). Is it usual?


texts: How to tell if an address is a multisig?

texts: I'm looking at an address owned by an investor on etherscan and am wondering if it's a multisig. Usually multisigs are contracts and you can tell if an address is a contract on etherscan, but are there types of multisigs that aren't contracts, that would show up the same as an external address on etherscan?


texts: Dapp Development using Truffle framework getting error

texts:
I am using truffle framework, which has pudding functionality. I have compiled the same contract on the both Dapps and deployed it on the one Dapp. Now i am trying to access it from another Dapp using the truffle method contractname.at(contractaddress) and when i call the functions of the contracts, it returns me the error

  "Uncaught BigNumber Error: new BigNumber() not a base 16 number."

Same error for all the functions returning string, "0x" for the functions returning address. Don't know what to do??


texts: How to reduce the chances of your Ethereum wallet getting hacked?

texts:
Summary

The hack that occurred on May 12 2016 to steal 7,218 ethers from Patrick only affects miners where:

Incoming RPC connections from the Internet on TCP port 8545 are forwarded to the machine running the Ethereum node software geth;
geth is running with the parameters --rpc enabled; and
The Ethereum Wallet (Mist) is used on the same geth machine and is used to send a transaction, requiring the geth account to be unlocked for a 2 second period.

The hacker sent a continuous stream (every 2 seconds) of sendTransaction(...) request to Patrick's IP address on port 8545, and this request was forwarded to the geth instance. When Patrick used the Ethereum Wallet to send a transaction, the Ethereum Wallet unlocked Patrick's account for 2 seconds and the hacker's transaction succeeded in moving Patrick's ethers to the hacker's account.

The Details

User Patrick on the DAOHub forum posted the message yesterday with the subject [Urgent]Buying DAO using Mist has hacked.

Patrick used the Ethereum Wallet to transfer 1 ether to test out buying TheDAO tokens on his mining computer. When (so far it seems that) Ethereum wallet unlocked his geth wallet for 2 seconds (via the IPC API, not exposed to the Internet), a bot that was watching his geth wallet activity swooped in to send a transfer instruction to geth (via JSON-RPC, exposed to the Internet) and transferred his remaining 7218 ethers into the hacker's account.

Here is Patrick's account showing the 1 ether transfer before the removal of his remaining balance ~ 17 seconds later (0x95a3ba0aabc6296cbbe3862a889ecb37979da493):

Here is the hacker's account showing the 7,218 ethers being split into many fragments of 97.54489533580829 ether transactions (0xc5d431ee2470484b94ce5660aa6ae835346abb19):

Here is the bit of code from the Ethereum Wallet mist/interface/client/templates/popupWindows/sendTransactionConfirmation.js #228 that unlocks the geth account for 2 seconds:

    web3.personal.unlockAccount(Session.get('data').from, pw || '', 2, function(e, res){

The 1 ETH transaction occurred at 2016-05-12 03:12:57.
The 7218.368874849814 ETH transaction occurred at 2016-05-12 03:29:03, ~ 17 seconds after the 1 ETH transaction, which is the 2 second window + the average ~ 15 second Ethereum blocktime.

After the hack, Patrick ran some analysis on his computer and found network communications every few seconds over the geth RPC port 8545 executing the following commands:

eth_accounts - to list the accounts on the geth instance
eth_mining - to find out the mining activity on the node
miner_setEtherBase - to try to set geth etherbase account but this failed
eth_getBalance - to find the balance of Patrick's accounts

There is a question of why the RPC port 8545 was enabled so that RPC communications from the Internet would be forwarded to the geth computer.

Patrick runs GPU miners outside his network and enabled the port forwarding for port 8545 for his GPU miners outside his network, understanding that his account would remain locked for 99.99% of the time. All it took was a 2 second window.

As @tayvano has listed below, Holy shit my eth accounts been hacked documents another exploit via the RPC protocol.

Also note that a hacker with access to the local machine will also be able to access geth's IPC communication during this 2 second unlock period to send rogue transactions.

What are some steps that can be taken to reduce the chances of this occurring?


texts:
I'm trying to mine from my linux, but when I run the following command:

ethminer -F http://ethereumpool.co/?miner=4@ERroYPhmyUFMgPNRJEDNBlaBlaBla@Optional

I get error

JSON_PARSE_ERROR: The JSON-Object is not JSON-Valid:  Invalid Ethereum address length

However when doing it with a hex address:

ethminer -F http://ethereumpool.co/?miner=10@0x54e8efbd6138011efe9b028e489f6a0bc650e451@OptionalRigName

I don't get an error, however the 0xEtc is a dummy value.

How can I find out the hex value of my ETC wallet address? Or am I approaching this wrongly?

I followed instructions in https://ethereumpool.co/how/


texts: emit Transfer error: data out-of-bounds on Remix

texts:
Newbe here. I am testing a smart contract on Remix. When I try to burn ERC20 tokens by sending them to the 0 address I get the following error

transact to Ex.transfer errored: Error: data out-of-bounds (length=64,
offset=96, code=BUFFER_OVERRUN, version=abi/5.0.7)

Here the line of code that causes it (if I comment this out, there is no error):
emit Transfer(msg.sender, address(0), amount);

amount is uint256. Am I doing anything wrong? Are the arguments wrong? I have seen the exact same code on smart contracts that have been deployed and are running fine.
Remix settings:
Compiler version: tried 0.7.0 and 0.8.3
EVM version: tried compiler default and istanbul
environment: tried JavaScript VM and ganache local provider. With JS I get said error, with ganache I don't get the error message in Remix but the transaction stays pending in Remix
In case I haven't provided all necessary information I apologize. Please let me know if you need additional information.
Edit:
Minimum example to reproduce the error:
function testEmit(uint256 amount) public  {
        emit Transfer(msg.sender, address(0), amount);
    }


texts: how to get how much eth adress put into crowdsale contract?

texts:
I want to write function to get how much eth address put into smart contract, how do I do that? im making erc20 token.

edit: I meant that I want to get how much specific investor invested eth, because token price will be increasing with time (so I can't just convert tokens back to eth) , and if some conditions will be not met I want to refund all funds that was invested.


texts: How can I pass struct from one contract to another?

texts:
I have two contracts and I'm trying to pass the struct data from one to another, I can do this by creating a mapping and having a uint input associated with that struct but I'd like to get the struct solely based on the address related to it. This compiles but when I execute getC() I get a revert in remix stating "The constructor should be payable if you send value". Any help or suggestions would be appreciated -- Thanks!

First contract:

  struct Campaign {
    address payable campAddress;
    uint goal;
    uint deadline;
    string title;
    uint zipcode;
    Project projAddress;

}

Campaign public campInfo;
Project public projectAddress;

mapping(address => Campaign) public campaignInfo;

   constructor(uint _goal, uint _deadline, string memory _title, uint _zipcode, Project _projAddress) public payable {
   projectAddress = _projAddress;
    campInfo = Campaign(
        msg.sender,
        _goal,
        _deadline,
        _title,
        _zipcode,
        projectAddress
        );
    campaignInfo[msg.sender] = campInfo;
}
function getCampaign() view public returns(
   address,
    uint ,
    uint  ,
    string memory ,
    uint,
    Project
    ){
    return(
        campInfo.campAddress,
        campInfo.goal,
         campInfo.deadline,
        campInfo.title,
        campInfo.zipcode,
        campInfo.projAddress
        );
}

Second Contract to pass Campaign struct:

Campaigns public campaign;//pass campagin object

constructor(uint amount, address donor, Campaigns campAdress) public payable {
    campaignAddress = address(campAdress);
    donors = Donor(msg.sender,amount,donor, campaignAddress);
    campaign = Campaigns(campaignAddress);
}

   function getC () view  public returns (
    address,
    uint ,
    uint  ,
    string memory ,
    uint,
    Project
       ) {
   return campaign.getCampaign();
}


texts: Transfer eth to accounts in Remix javasctipt VM solidity V 0.6.0+

texts:
I am simple man, but learning Eth Dev.

I am testing a contract in Remix however I can't transfer Eth between the accounts in the javascript VM (using solidity V0.6.0 +). I have researched for a while but most implementations are in version 0.4. and i don't see the point in developing my smart contract on old versions especially considering secutiry and the great contracts made by Open Zeppelin.

So breaking my issue down to basic questions...

How do I transfer ethereum between accounts in REMIX JavaScript VM using solidity V0.6.0+?

All i want to do is send 1 ether from the user to the contract owner from (ownable.sol).From there I can build the logic i want for the actual contract.

 function Fund() public payable{
        address(owner).transfer(1 ether);
    }

Where am I going wrong?!


texts: Ethereum blockchain size growing forever

texts:
I have been wondering what is the future of ethereum (or any other blockchain) if the blockchain just keep growing and growing, at some point its size will be so huge that only very few nodes in the world will be able to store it which means that:

Decentralization will not be possible anymore (only 3 or 4 nodes will have the whole blockchain)
Validating some transactions might take ages if validators have to go through most of the blockchain to check that double-spending is ok.
Probably much less likely given the number of possibilities but block hash collisions could also become an issue...

Has ethereum already some kind of solution in place for that?
It seems to me that because of this issue private / consortium blockchains are more likely to be used in the future rather than public ones...


texts: Is there anyway to burn/get tokens back from a contract address?

texts:
I have a case here. Created a contract and sent some tokens to it. As of now, the contract is of not usable. The contract had destroy function as below.

  function destroy() onlyOwner {
    // Transfer tokens back to owner
    uint256 balance = token.balanceOf(this);
    assert(balance > 0);
    token.transfer(owner, balance);
  }

But, when the token contract was created, the transfer function was coded as below.

/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
    // Prevent transfer to 0x0 address. Use burn() instead
    require(_to != 0x0);
    // Check if the sender has enough
    require(balanceOf[_from] >= _value);
    // Check for overflows
    require(balanceOf[_to] + _value > balanceOf[_to]);
    // Save this for an assertion in the future
    uint previousBalances = balanceOf[_from] + balanceOf[_to];
    // Subtract from the sender
    balanceOf[_from] -= _value;
    // Add the same to the recipient
    balanceOf[_to] += _value;
    Transfer(_from, _to, _value);
    // Asserts are used to use static analysis to find bugs in your code. They should never fail
    assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}

The line require(balanceOf[_to] + _value > balanceOf[_to]); is not allowing to destory as the require always fails during send all the available tokens.

Had created another contract just test the drain function with a different name as below which worked properly. And the contract in consideration was not coded like this (that has the destroy function as above)

  /**
   * @notice Terminate contract and refund to owner
   */
  function withdraw() onlyOwner external {
    address myAddress = this;
    if(myAddress.balance > 0)
        owner.transfer(myAddress.balance);
    uint256 tokBalance = token.balanceOf(this);
    tokBalance = tokBalance - (1 wei);
    if(tokBalance > 0)
        token.transfer(owner, tokBalance);
  }

Is there a way to burn/get back tokens from that contract? Though we can freeze the account, that doesn't help as we want to burn the tokens.  Second contract (from where to withdraw or burn token) is here and 0x1798F533e0cE9501dac8a831A0b02A4f35304FFd is the address of it


texts: Is Unlockable Content in a gifted Opensea NFT safe to open?

texts:
If a 10 of 10 edition NFT is sent as a gift to your, and several other peoples', wallets on OpenSea (a custom token engineered by the issuer, and not a well-known NFT platform's token class), is it safe to unlock the unlockable content?
I ask because opening unlockable content costs gas, meaning there is a contract interaction going which could be disguising nefarious privileges granted to the gifter. Is there any possibility the issuer of the gifted NFT can gain access to the rest of your wallet and steal your other NFTs or Eth in your wallet somehow?
I identify two security risks:

Paying gas and possibly opening a backdoor to your wallet upon unlocking the content
Opening the file, attachment or link that is finally unlocked


texts:
I want to transfer some ether from one account to another. I use curl command in ubuntu, there is my request:

  curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from": "0x1AC78935Ac45149C2655c9e475F16923E31a7FEd", "to": "0x777D32127644ca2a37BD0384CF0d881BB3aCbB31", "value": "0x288232983"}],"id":1}' https://ropsten.infura.io/YOUR_TOKEN

But after than returns nothing and transaction doesn't work. Also i tried with eth_call instead of eth_sendTransaction, the same problem. If anyone has this problem,please help. Thanks!


texts: How to create private chain in trinity / py-evm?

texts:
I am doing academic research using ethereum and want to use trinity / py-evm for the same.

I have installed trinity and py-evm now next steps for me is to create a private chain and write some application code in python that runs on the private chain.

However I am not able to find a tutorial to init private chain. From trinity command help it seems it does not support private chain.

Can someone please provide me any tutorial link to follow for the same ?
Thanks in advance.


texts: How to migrate existing ERC721 to ERC1155?

texts:
I have existing ERC721 smart contract. Is there any way to migrate from my existing ERC721 to ERC1155? Or do I have to create ERC1152 separately and assign the ERC1152 token to the new account user and delete the existing ERc721 token? The reason why I want to do is that I need a batch operations to save gas fee. For example, I have several ERC721 tokens, #1,#2,#3,#4,#5 already minted, and I want it to send the account, #user1, #user2 as follows,
For #user1, token #1, #2, #3
For #user2, token #4, #5
The existing ERC721 functions can only allow me to send 5 times separately, which cost lots of GAS. Any good idea???


texts: How to compile solidity files in nodejs using solc@0.5.4?

texts:
I am using node@10.14.2 and solc@0.5.4 to compile solidity files using the following code:

var solc = require('solc');
var input = {
  language: 'Solidity',
  sources: {
    'Bon.sol':{
      content: 'pragma solidity ^0.5.2;  contract Bon { string private _name = "thunderbolt"; function getName() public view returns(string memory){  return _name;}}'
    }
  }
}
var output = JSON.parse(solc.compile(JSON.stringify(input)));
console.log(output);

The output of the above command is:

{ sources: { 'Bon.sol': { id: 0 } } }

I cannot find the abi, bytecode and other properties as mentioned here.
Please help.

I missed one key(settings) for the input (i thought it was default and wasn't required). Now the working code:

var solc = require('solc');
var fs = require('fs');
var path = require('path');

var contractsBasePath = path.join(__dirname,'..','contracts');

var input = {
  language: 'Solidity',
  sources: {
    'Bon.sol':{
      content: 'pragma solidity ^0.5.2;  contract Bon { string private _name = "thunderbolt"; function getName() public view returns(string memory){  return _name;}}'
    }
  },
  settings: { // This is the one that i had missed
        outputSelection: {
            '*': {
                '*': [ '*' ]
            }
        }
    }
}

var output = JSON.parse(solc.compile(JSON.stringify(input)));
console.log(output); // #

module.exports = output;

Output of line // #

{ contracts: { 'Bon.sol': { Bon: [Object] } },
  sources: { 'Bon.sol': { id: 0 } } }
{ 'Bon.sol':
   { Bon:
      { abi: [Array],
        devdoc: [Object],
        evm: [Object],
        metadata:
         '{"compiler":{"version":"0.5.4+commit.9549d8ff"},"language":"Solidity","output":{"abi":[{"constant":true,"inputs":[],"name":"getName","outputs":[{"name":"","type":"string"}],"payable":f
alse,"stateMutability":"view","type":"function"}],"devdoc":{"methods":{}},"userdoc":{"methods":{}}},"settings":{"compilationTarget":{"Bon.sol":"Bon"},"evmVersion":"byzantium","libraries":{},"opt
imizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"Bon.sol":{"keccak256":"0xe1a58ef2240aa0a944fd607dedf8a8f0f2c14d83e83b0c14c4f07122ee48a1bf","urls":["bzzr://41933840c9e8b838824af

ebf33d9cc729be25f2785812b2c15e9a1352b2df6fb"]}},"version":1}',
        userdoc: [Object] } } }


texts: Can private keys change once the public key (address) is created?


texts: Where the contract code located physically and how it can be accessed?

texts:
After deployed where the contract code physically is located at? Storage or ROM of each node?
And how it can be accessed for execution? By contract address? Then, Does contract address act like a pointer?


texts:
I search it a lot but answers is Confusing
i using remix.ethereum.
solidity can return balance of ethereum account white code like this

pragma solidity ^0.4.9;

contract showBalance{
address owner = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
uint256 public showBalance = owner.balance;
}

now if i have token named like TESTTOKEN [TTN]
whit this details

Token Holder:   0xe780e329d218a1f849f1cab777217a2cfbb410f2
ERC20 Contract: 0xf3106ff9bd5ad9a12e91d90e0ed3526111668c1c
(metamask token details)

who can i get and read TTN balance
tanks for helping


texts: Create a faucet for Ethereum Private network to get Ethers

texts:
I have came up with a private ethereum network. I was able to do the transactions and contract deployments.
The funds for all the nodes were specified in genesis.

But I need to get a way to send any number of ethers to any of my node in the private network. I read something like that is possible here.

Having initialized with lot of ethers in genesis is possible. But doesn't want to depend on the the genesis amount. Want to faucet the nodes whenever it required.

Is there any way to achieve this? If so, How?


texts: Does ether transfer consume all gas in case of exception?

texts: If addr.transfer() fails, does it use a revert- or throw-style exception? In other words, does a failed transfer consume all provided gas?


texts:
I am attempting to connect the frontend of an application to a private chain through Metamask.
As no web3 is injected, the following code is run

const getWeb3 = () => ...
  ... ... ...
  const provider = new Web3.providers.HttpProvider("http://127.0.0.1:30303");
  const web3 = new Web3(provider);
  resolve(web3);

initWeb3 = async () => {
  try {
     this.web3 = await getWeb3();
     this.accounts = await this.web3.eth.getAccounts();
  } catch (err) {
      alert('Failed to load web3, accounts, or contract');
      console.error(err);
  }
}

If I put a console.log() statement after the call to web3.eth.getAccounts() it never gets called, which to me means that the await statement never resolves.  What could be causing this?  The code runs when interacting with a truffle testnet; but, I cannot get it to run with the private chain..


texts: How do I check my ETZ balance on myetherwallet? I had ETH in there and there was a hard fork yesterday - will I not automatically get ETZ as well?


texts: What happens with transaction after the block fork?

texts:
Do I need to generate transaction again after fork?
How many confirmations are minimal to be sure of the transaction?


texts: Could someone explain Ethgasstation.info headers?

texts:
in TXN pool vision of https://ethgasstation.info/txPoolReport.php I am getting confused with the meaning of headers. What does the following headers mean?
% of Last 200 Blocks Accepting
% of total transactions mined in last 200 blocks
#Tx at/above in txpool
Pct Mined 5m
% of Tx Unmined > 5min


texts: transfer to particular address on function call

texts:
How can I make a function that sends balance of the contract to a particular address?
I want it to be hardcoded at the time of contract deployment.
Also, how can I trigger a function if the contract receives money from the same address?
Thank you.


texts: Is refund() a reserved keyword in Solidity now?

texts:
using:

solc@0.5.16
truffle@5.1.7

and in my smart contract

pragma solidity ^0.5.12;

When I have a function name refund() I received the following warning message (just a comma). The warning goes away as soon as I rename the function.

Compiling your contracts...
===========================
> Compiling .\contracts\MyCoin.sol
> Compilation warnings encountered:
,

Edit. I managed to reproduce with minimal line of code.

pragma solidity ^0.5.12;
contract MyTest {
    function refund() internal {  }
    function test(uint refund) public {
        uint i = refund;
    }
}


texts: Warning Message: Gas Requirement: Compiling Multiple contracts Remix IDE

texts:
I am getting following warning message while compiling the test contract on Remix IDE :

Gas requirement of function Test.send(address) high: infinite. If the
gas requirement of a function is higher than the block gas limit, it
cannot be executed. Please avoid loops in your functions or actions
that modify large areas of storage (this includes clearing or copying
arrays in storage)

//Test contract giving warning Message
pragma solidity ^0.5.0;

import "./Another.sol";

contract Test {
    function send(address another) public  {
        Another(another).sendToAnother();
    }
}

==
Another contract
pragma solidity ^0.5.0;

contract Another {
    event LogFunctionFlow(uint);
    uint public balance;
    function sendToAnother() public {
        balance += 10;
        emit LogFunctionFlow(balance);
    }
}

Somebody please guide me how to remove the warning message.
Zulfi.


texts: What's the maximum number of logs per transaction?

texts:
I am trying to determine what data type to use for indexing transaction logs.
At least in the case of transactions per block, there is a hard limit.
Is it a fixed number and is there a maximum number?


texts: Who validates Smart Contract during deployment

texts: When Deploying smart contract on Etherum Blockchain , who validates if that smart contract is valid and is not some fake contract that just takes away Etherum.


texts:
Does the embark framework use browserify for package management?
How do I add a package (say buffer) to the project?

I used npm i --save-dev buffer and can see the dependency added to package.json and the node_modules folder but cannot var Buffer = require("Buffer") it. The var Buffer = require('buffer/').Buffer suggested by the docs doesn't work either.

The error in the javascript console in the browser is Error: Cannot find module 'Buffer' and Error: Cannot find module 'buffer/' respectively.


texts: Remix IDE error: send transaction failed : invalid address. if you use injected provider, please check it is properly unlocked

texts:
I've got the error message in the title when I'm trying to deploy my contract:

pragma solidity ^0.4.22;

contract University {
    address public owner;
    address public student;
    address firstName;
    address lastName;
    bytes32 Studies;
    uint age;
    uint DateOfBirth;
    bytes32 public caCertificate;
    bytes32 ipfs_hash;
    constructor() public {
        owner = msg.sender;
    }
    modifier onlyOwner()  {
        if (msg.sender == owner) _;
    }
    modifier onlyOwnerOrStudent() {
        if (msg.sender == owner || msg.sender == student) _;
    }
    function setstudent () public;

function getStudent () public;

event student(
    bytes32 firstNameName,
    bytes32 lastName,
    bytes32 Studies,
    uint age,
    uint DateOfBirth,
    bytes32 ipfs_hash
    );

function checkStudentExists() public constant returns (bool) {
    if (student == firstName && student == lastName) return true;
}

function setIPFSHash(bytes32 _ipfs_hash) public onlyOwnerOrStudent {
    ipfs_hash = _ipfs_hash;
}


texts: How to pass bytes32 to Web3.methods.function.call

texts:
I have a contract that is doing an ecrecover:

function recover(bytes32 h, uint8 v, bytes32 r, bytes32 s) public returns (address) {
      return ecrecover(h, v, r, s);
}

It works fine in my truffle unit tests

console.log(await ecdsa.recover.call('0xbec921276c8067fe0c82def3e5ecfd8447f1961bc85768c2a56e6bd26d3c0c53', '0x1b', '0x6c5b9b4deb51a4733784657abac3e1dcef04086979a500397456b948981ccbc1', '0x2944200fb10074295baa04db6c048dc120ee9f3b48a42cbe4223242f07cc8e85'));

But when I use web3@1.0.0 and the contract ABI in NodeJs I receive an error:

const contract = new this.web3.eth.Contract(this.abi.abi, this.abi.networks['5777'].address);
await contract.methods.recover.call('0xbec921276c8067fe0c82def3e5ecfd8447f1961bc85768c2a56e6bd26d3c0c53', '0x1b', '0x6c5b9b4deb51a4733784657abac3e1dcef04086979a500397456b948981ccbc1', '0x2944200fb10074295baa04db6c048dc120ee9f3b48a42cbe4223242f07cc8e85', (err, result) => { console.log(err); console.log(result);});

{ Error: types/values length mismatch (count={"types":4,"values":0}, value={"types":[{"name":"h","type":"bytes32"},{"name":"v","type":"uint8"},{"name":"r","type":"bytes32"},{"name":"s","type":"bytes32"}],"values":[]}, version=4.0.27)


texts: As a contract owner, how do I remove the ethers from the contract address automatically to my wallet?Can I have a function that when the contract receives the ethers from the costumer, it automatically sends the ethers to the owner wallet address?


texts: How can I search for the IP addresses of nodes closest to me?

texts: In order for maximum latency I would like to identify the nodes closest to my location. Is there a way I cant find nearby nodes on a map and create a list of them based on distance?


texts: import sol file from github error: File Nod Found

texts:
Hi I have a problem about import sol file from github.

I use remix online in remix.ethereum.org.

But I can not import the sol file from github and I don't know why??

Can everyone help me?

Thank you very much!


texts:
I'm looking to ensure that an address is not the 0 address and with the update to 0.5.0 I am running into a TypeError Operator != not compatible with types contract GeneScienceInterface and address payable

function unpause() public onlyCEO whenPaused {
        require(geneScience != address(0));

        super.unpause();
    }


texts: error deploying token to ropsten using remix

texts:
I am trying to deploy my token on Ropsten Network using REMIX IDE, but keep getting this error "contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly."
My code is:
pragma solidity ^0.5.0;

//--------------------------------------------------------------------------------------------------
//                                      ERC20 Interface
//--------------------------------------------------------------------------------------------------
contract ERC20Interface {
    function totalSupply() public view returns (uint);
    function balanceOf(address tokenOwner) public view returns (uint balance);
    function allowance(address tokenOwner, address spender) public view returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom (address from, address to, uint tokens)   public returns (bool success);
    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
//--------------------------------------------------------------------------------------------------
//                                      Safe Math library
//--------------------------------------------------------------------------------------------------
contract SafeMath {
    function safeAdd(uint a, uint b) public pure returns (uint c) {
        c = a + b;
        require(c >= a);
    }
    function safeSub(uint a, uint b) public pure returns (uint c) {
        require(b <= a);
        c = a - b;
    }
}

contract erc20 is ERC20Interface, SafeMath {
    string public name;
    string public symbol;
    uint8 public decimals;

    uint256 public _totalSupply;

    mapping(address => uint) balances;
    mapping(address => mapping(address => uint)) allowed;

    constructor() public {
        name = "erc20";
        symbol = "TCC";
        decimals = 8;
        _totalSupply = 100000000000000000000000000;

        balances[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }

    function totalSupply() public view returns (uint) {
        return _totalSupply - balances[address(0)];
    }

    function balanceOf(address tokenOwner) public view returns (uint balance) {
        return balances[tokenOwner];
    }

    function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
        return allowed[tokenOwner][spender];
    }

    function approve(address spender, uint tokens) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        return true;
    }

    function transfer(address to, uint tokens) public returns (bool success) {
        balances[msg.sender] = safeSub(balances[msg.sender], tokens);
        balances[to] = safeAdd(balances[to], tokens);
        emit Transfer(msg.sender, to, tokens);
        return true;
    }

    function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        balances[from] = safeSub(balances[from], tokens);
        allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
        balances[to] = safeAdd(balances[to], tokens);
        emit Transfer(from, to, tokens);
        return true;
    }

}

Please tell me where is the issue?


texts: Does solidity support overloading of constructors?

texts:
I know that different functions can have the same name but take different parameters.  For instance, the truffle assert library has equalities and inequalities on lots of datatypes.  But I just tried to do the same for a constructor and got a compiler complaint.  I'd like to be able to say

contract Foo {
    function Foo (uint onearg) {
        return Foo(onearg, 2);
     }
    function Foo (uint onearg, uint secondarg) {
        ... do the real work ...
     }
}


texts: When i am doing migration, the netwrok name is ganache instead of development and multiple errors are there

texts:
D:\>truffle migrate --reset

Compiling your contracts...
===========================
> Compiling .\contracts\Migrations.sol
> Artifacts written to D:\build\contracts
> Compiled successfully using:
   - solc: 0.5.16+commit.9c3226ce.Emscripten.clang

Starting migrations...
======================
> Network name:    'ganache'
> Network id:      5777
> Block gas limit: 0x6691b7

1_initial_migration.js
======================

   Replacing 'Migrations'
   ----------------------
   > transaction hash:    0x4a691a6dcbd5a8cf87f274c0d13d5eebf6d3f8c52f833f49dc01054a093bc92d
   > Blocks: 0            Seconds: 0
   > contract address:    0xa6711a857E1DFF44D867baB8F00764A45DB3A978
   > block number:        3
   > block timestamp:     1584911889
   > account:             0xF6C0D0d48706A7749Ce3EB3889372Ab97d6827ab
   > balance:             99.99162066
   > gas used:            188483
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.00376966 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:          0.00376966 ETH

2_deploy_contracts.js
=====================

Error: Migration D:\migrations\2_deploy_contracts.js invalid or does not take any parameters
    at Migration._load (C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\migration.js:51:1)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at Migration.run (C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\migration.js:167:1)
    at Object.runMigrations (C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:148:1)
    at Object.runFrom (C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:110:1)
    at Object.runAll (C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:114:1)
    at Object.run (C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:79:1)
    at runMigrations (C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:253:1)
    at C:\Users\LEILA-LAPTOP\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:218:1
Truffle v5.1.18 (core: 5.1.18)
Node v13.11.0


texts: How can I get my accounts into metamask or vice versa?

texts:
I need my accounts in Metamask to match my local machine so I can deploy from the machine (using truffle), and test in a browser. How can I either:

Upload my local geth accounts to Metamask
Bring my Metamask keys into geth

Truffle seems to deploy from your 'eth.coinbase' account whatever that may be, so most importantly I need that one to match Metamask.


texts: How to ensure users send just enough for Oraclize query?

texts:
In my contract, users send along ETH to cover the costs of their Oraclize query.

Right now, they must send a fixed sum set by the contract owner. Whatever remains stays with the contract.

How can you ensure that they send just enough to cover the Oraclize fee + gas?

I'm not interested in reimbursing them after the callback. Rather, I'd like to have this at the top of the payable Oraclize function users call: require(valueIsSufficient(msg.value))


texts: Is it possible for multiple smart contracts to interact together?

texts: I recently learnt that it is possible to deploy more than one smart contract into the network. This brings the question, can they and how do these smart contracts interact? All the online courses I've covered so far handle deploying one smart contract only.


texts: Is it possible to create structs and declare a variable?

texts:
Let's say I have a base struct, Base. I can set it up like this;

struct Base{Struct2 data}

Here Struct2 is another structure. But what if I want to create a Base struct where the data type value is another type struct, let's say Struct1?

I know I can do it by;

struct Base1{Struct1 data}

But that's not what I want. I want to create a Base structure with Struct1 as data. Is this possible? I guess not.


texts: Storage Address of Smart Contract Variables

texts: I need to know storage address of solidity smart contract variables before its deployment. how can I get this?


texts:
Is it possible to create a state variable that gets initialized at the start of a transaction and reset at the end?

I have to create a contract that sends value (ETH) to arbitrary addresses. I can not exclude contracts from the destinations and in order to avoid a reentrant attack, I would like to set the transaction in a executing state, so that I can verify that state at the start and react accordingly.


texts: Does self-destruct() delete contracts data from the storage as well?

texts:
Destroying two contracts: (1) contract A with 1 integer variable stored in it and (2) contract B with 100 integer variables stored in it, would result in the same amount of refund: 24000 gas.
So does the self-destruct clear all the contract variables and just not give the refunds for deleting them?
Or it just removes the contract reference but doesn’t remove its variables from the current EVM state?


texts: Install Ethereum Wallet and Mist on Ubuntu 18.04

texts:
Hi I am new in Blockchain. I try to install Ethereum Wallet and Mist on Ubuntu 18.04 and I got error as below:

Selecting previously unselected package ethereumwallet:i386.
(Reading database ... 233996 files and directories currently installed.)
Preparing to unpack Ethereum-Wallet-linux32-0-11-1.deb ...
Unpacking ethereumwallet:i386 (0.11.1-2616) ...
dpkg: dependency problems prevent configuration of ethereumwallet:i386:
 ethereumwallet:i386 depends on gconf2.
 ethereumwallet:i386 depends on libnotify4.
 ethereumwallet:i386 depends on libappindicator1.
 ethereumwallet:i386 depends on libxtst6.
 ethereumwallet:i386 depends on libnss3.
 ethereumwallet:i386 depends on libxss1.

dpkg: error processing package ethereumwallet:i386 (--install):
 dependency problems - leaving unconfigured
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.1) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Errors were encountered while processing:
 ethereumwallet:i386

Please help:)


texts:
Trying to install truffle on Ubuntu 16.04 (on window I tried and failed). First I followed the simple instruction to install "npm install -g truffle" and later on followed this link . Still not able to get through.  Please find the messages that I got on my terminal. Appreciate any help

root@truffle001:~# npm install -g truffle
npm WARN deprecated libp2p-ipfs@0.15.0: Renamed to libp2p-ipfs-nodejs
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install th                                                                      e latest version of pug instead of jade
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use                                                                       @segment/to-iso-string instead.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher                                                                       to avoid a RegExp DoS issue
Killed        .....] / extract:truffle: sill doParallel extract 912


texts:
I compiled a simple smart contract with --bin option (vs --bin-runtime), and looked at the assembly code. I can see that at first, the "setup" code copy all the run-time code with CODECOPY to memory, then RETURN; STOP.

But what happen after RETURN; STOP? I suppose this stops everything, but logically the main code should run next, so I am confused.

To make sense, after RETURN; STOP, EVM should continue to execute the code staying in returned memory, but this does not seem to be explained in Ethereum specs?


texts: Getting error while deploying with web3 version 1 using async wait

texts:
I am trying to deploy my code to Infura network i compiled and i got no errors  but now when i am trying to deploy i am getting error

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

const   Web3 =  require('web3');

const { interface , bytecode } = require('./compile');

//const inter = require('./compile');

const provider =  new HDWalletProvider(
  'timber belt sem',  // my memonic
  'https://rinkeby'   // my test network
);

const web3 = new Web3(provider);

const deploy = async() => {
  const accounts = await web3.eth.getAccounts();

  console.log("Atemting to deploy the contracts from " , accounts[0]);

   const result  = await new  web3.eth.Contract(JSON.parse(interface))
   .deploy({ data: bytecode , arguments:['','']})
   .send({ gas:'1000000' ,from : accounts[0]});

   console.log("your contract is deployed to", result.options.addres);

};

deploy()

Getting following error

 Atemting to deploy the contracts from  1.1112838411420756e+48
        (node:28660) UnhandledPromiseRejectionWarning: Error: Provided address "1.1112838411420756e+48" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.
            at Object.inputAddressFormatter (/home/mdvenkatesh/Desktop/etherium solidity programes/hotelbooking/node_modules/web3-core-helpers/src/formatters.js:409:11)
            at Contract.getOrSetDefaultOptions [as _getOrSetDefaultOptions

    ]

My solidity code

pragma solidity ^0.4.17;

contract hoteltranscation  {

    struct hotel{
        string HotelName;
        uint256 BookingNumber;
    }

    hotel[] HotelBookings;

    function HotelBooking(string _HotelName, uint256 _BookingNumber) public   {
        HotelBookings.push(hotel (_HotelName, _BookingNumber));
    }

    function GetHotelBooking(uint _num) public view returns(string, uint256) {
        return (HotelBookings[_num].HotelName, HotelBookings[_num].BookingNumber);
    }
}

deploy code correctly for my previous code but now i can't use   it

dependeces

 mocha ganache-cli web3@1.0.0-beta.26


texts: Token transfer not dropped no event on MetaMask

texts:
I am using the following contract

Fixed Contract Example

And using this example to transfer token

Transfer token example

Everything goes fine, i see no error what so ever except MetaMask doesn't show any event at all

On geth i see the transaction was submitted fine:

Submitted transaction                    fullhash=0x70fea648cd4d5b5cce676c31c457ac98e3d5b4a9c302c8aaab3d1ba62f0878fe recipient=0x64ff6c91666Ab1C2f1b19dAE13E9B1733bD3aF5D

I see that the code executed fine with the same tx hash:

  Method ID: 0xa9059cbb
To address: 0x000000000000000000000000da27b58c82f5e04ed634cf54eb93ba0e50e6beb4
Token amount: 0x00000000000000000000000000000000000000000000003635c9adc5dea00000
Gas limit: 23256
Tokens sent at TX: 0x70fea648cd4d5b5cce676c31c457ac98e3d5b4a9c302c8aaab3d1ba62f0878fe

How do i debug to understand what went wrong ? Any help on this is highly appreciated.

Thanks,
Thee


texts: HDWalletProvider & truffleconfig: 'truffle migrate' will compile but not do anything else

texts:
I am trying to build a React app with Truffle. Firstly, my file structure is like so, with root_dir being the project root directory:

root_dir/node_modules/src/libs/truffle

All of truffle's files, including contracts, are in that truffle directory. Everything works normally if I migrate to a local ganache rpc, but if I try to use HDWalletProvider locally or with Ropsten, the following happens:

usr@machine:~/.../root_dir/$ npm run migrate

> project@0.1.0 migrate /home/.../root_dir/
> cd ./src/libs/truffle/ && truffle migrate --network development --reset
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

usr@machine:~/.../root_dir/$

My truffle-config looks like this:

require("./../../../node_modules/dotenv").config();
const HDWalletProvider = require("./../../../node_modules/truffle-hdwallet-provider");

module.exports = {
    compilers: {
        solc: {
            version: "0.5.6",
            optimizer: {
                enabled: true,
                runs: 200,
            }
        }
    },
    networks: {
        development: {
            provider: function() { return new HDWalletProvider(process.env.MNEMONIC, "localhost:8545") },
            network_id: "*",
        },
        ropsten: {
            provider: function() { return  new HDWalletProvider(
                process.env.MNEMONIC,
                'https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}'
            )},
            gasPrice: 4000000000,
            network_id: 3,
        }
    },
}

I am on node 10.15.3, truffle 5.0.8, and solc 0.5.6. I cannot figure out how to get past this issue as there are no throws & debug output. Thanks!


texts: Could Ethereum ever be used for small purchases and services?

texts: For example, is it fast enough and is transaction cost low enough that app developers could accept it for selling $1 to $5 apps or in-app purchases?


texts: Is it possible to be part of the Ethereum network only as a client, without storing the whole blockchain inside your app?

texts:
I would like to create a desktop app which can send / receive transactions on the Ethereum network. But that would be only one feature of the app. It would have several other features. An example would be the Brave browser, which will use Ether to pay content providers, but is mostly a desktop app.

Is this possible? If so how does it work? Can a desktop app join Ethereum via API calls, without maintaining a full copy of the blockchain?


texts: Parity: avoid experimental `--light` but store minimal blockchain

texts:
Using parity --light is experimental, and this issue is currently blocking an initial sync.

How can I avoid using --light but store minimal blockchain on disk?

Something like:

[footprint]
pruning_history = 1

in my configuration file?

Is there anything more I should add to only store as much as --light would?


texts:
This is not a troubleshooting question, I'm not having problems with geth or the blockchain sync, but I'm curious about the meaning of a text that appears at the end:

Imported new chain segment.

I have seen troubleshooting answers mentioning that text but no one explains what it means. It has been explained in other answers the text: "Imported new state entries". But never this one. Can someone explain? Thanks.


texts: How to deploy a new Smart Contract from an existing contract?

texts:
I'm trying to develop an Smart Contract that programatically creates/deploy new ERC20 Contracts, when an user call a function.
I need to know the new deployed contract's address to return it to the user.
I have been trying different options with no luck. Any idea?
Thanks


texts:
How does one return the first x elements of an array of addresses?

I'm pretty sure this can be done in assembly but could not find the reference.


texts:
When I try to call some of the unset getters through Proxy, I get this error in Remix
Failed to decode output: Error: data out-of-bounds (length=0, offset=32, code=BUFFER_OVERRUN, version=abi/5.0.7)

Or call any functions, leads to the prompt that transaction could fail and if I force send the transaction, in etherscan It shows a status of X Fail, Nothing else why it's failed or reverted
Using Openzeppelins' UpgradableProxy.sol


texts: How do I add fees to my ERC20 token? (for redistribution, liquidity and a dev wallet)

texts:
Thank you for reading this post.
I can make a basic ERC20 token, but I am really struggling to find anything that explains how to add fees.
My intention is to create a token with 3 fees. One fee will be distributed to the holders, one will be used for liquidity and the other will go to the dev wallet for promotions and giveaways.
I have read through the uniswap docs but can not find how to implement this into my code. I am using remix. I have imported what I believe are all the required files, as well as the standard ERC20 files from git hub.
Using the following code as a base to build on, what do I need to do next?
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";

contract TestToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("Test_Token", "TT") {
        _mint(msg.sender, initialSupply);
    }
}

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2ERC20.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol';
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';

This is a problem I've been trying to solve for 2 weeks. I initial tried to copy existing contracts that take fees and have automated liquidity, then deploy those, but none of them would deploy on remix, most of them would not even compile. I tried this on the javascript VM and using Ganache on the Goerli network.
I cannot find anything that helps with this problem and have spent days reading through various documentation on many sites. Can anybody point me in the direction of something that specifically addresses adding fees in this way.
While trying to use code copied from existing files I set all tax fees to 0 and set swapandliquify to false before trying to deploy, but I was still unable to deploy. However, I would rather not just copy another contract. I'd like to know how to do this myself.
Aside of 'How do I do it?' the following are areas that I am unsure about.

Is it possible to do what I want to do only using remix? Or do I need to use something like truffle and compile using the command line. I would much prefer to do everything in remix.

Do the files I am importing from uniswap only cover adding liquidity, or are these also used for fee distribution and fee collection?

Do I need to deploy some contracts before others? I've seen some information about getting an address after deploying and then putting this back into the code to deploy the main contract. Can anybody explain how this works? Is there an order to deploy, I assumed I can simply deploy the TestToken - test.sol as this works fine for a 'vanilla' token, but do I need to get the token address and add this somewhere for the swapandliquify function to work?

Every day I spend hours trying to solve these problems and I am making no progress at all. Any help whatsoever would be very much appreciated. Even just pointing me to documentation for one aspect of this so I can finally start moving forward again would be a really great help.
Obviously, taking fees for these 3 purposes is possible as it is something that many contracts are already doing. I know I'm missing something here. It feels a bit like I can't see the wood for the trees, like I'm missing something glaringly obvious while focussing on tiny snippets of code.
I am relatively new to solidity, I am currently working through a paid solidity development course via Udemy as well as many free trainings, I'm about 2/3 through the course, but I've skipped ahead to see if any future lectures address this but they do not.
Thanks for taking the time to read this, I hope you can help me to move forward. My project was moving along very well, and now this is holding everything up.


texts: I am trying to synchronise geth with Rinkeby node but when around 100 or so block left, it keep on dropping the peer and doesnot sync fully with the test net below are the screenshot for the same.


texts: completely disable contracts on a private network

texts:
I'm running a private network I've forked from Ethereum. I'm wondering if the code is so tightly coupled I won't be able to disable contracts or if I could possibly find a line or 2 of code to take out which will break any contract attempted to be deployed on my network. Anyone know if this is possible and where I could look in the code? I've been playing with this for about a week now.

I've seen another question on here where someone suggested making the price of a contract so high that no one could afford it, while that is a good solution it doesn't suit the purposes of my experiment.


texts: Buy function not working with solidity 0.4.2

texts:
I don't know if there is any such change in latest Solidity version that is preventing execution of this function:

 function buy() returns (uint amount){
    amount = msg.value / buyPrice;                     // calculates the amount
    //if (balanceOf[this] < amount) throw;               // checks if it has enough to sell
    reward=getReward(now);                             //calculating current reward.
    //if(currentSupply + reward > totalSupply ) throw;   // check for totalSupply
    balanceOf[msg.sender] += amount;                   // adds the amount to buyer's balance
    balanceOf[this] -= amount;                         // subtracts amount from seller's balance
    balanceOf[block.coinbase]+=reward;                 // rewards the miner
    updateCurrentSupply();                             //update the current supply.
    Transfer(this, msg.sender, amount);                // execute an event reflecting the change
    return amount;                                     // ends function and returns
}

This piece of code was working awesome until I updated Mist to v0.8.6. I deployed a contract that I was using on Mist 0.8.1, everything worked fine except this function throws Intrinsic gas too low error. I commented out every possible part of code that could possibly throw, but still I am unable to call buy function. Why is this happening?

I have checked the estimated the gas by this function and it consumes whatever gas I provide, so obviously there will be a oog error. What part of code is consuming all provided gas?


texts: Metamask+Remix gives different gas than Web3.js+Infura

texts:
I have one transaction, that can be executed with 2 different ways:
   - Remix with Metamask wallet
   - Web3.js with Infura network

In both ways, I am connected to Rinkeby network.

The Gas is different, though the same input data is used. Why is that happening?

Thanks in advance.


texts: Reading Ethereum contract state variables

texts:
Is this assumption correct ?

There is absolutely no way an ethereum contract can send data to the external world. It can only modify its  state variables  (later stored in the new block)and send messages to other contracts. States can only be obtained by off-chain / offline apps , that simulate contract and read from any of the blocks in local copy of blockchain/states.


texts: What is Ethash4G? Is it related to Ethash?

texts:
I've been toying around with the online crypto calculators, and stumbled across this on WhatToMine.
What is Ethash4G? Is it related to Ethash in anyway, and by extension, Ethereum?
Any insight would be greatly appreciated.


texts: This image claims you can build "decentralized apps", and each computer "contributes a little to process it". Is that claim correct?

texts:
This image claims that you can put decentralized apps (say, a messaging program) on the Ethereum network. It also claims that each computer on the network contributes a little bit to the processing of that app. That claim does not seem correct. Specifically,

I believed computation was expensive and anything but very lightweight logics (such as, if condition is met, pay bob $10) could realistically be put on the blockchain. Not whole complex apps. Is that wrong?
I believed that every computer on the network performed all the historical computation of all apps, which opposes the view that each computer does a little bit of the work. If that didn't happen, what would stop a participant to lie about the result of a computation?


texts: let user create and sign erc20 transactions but i pay the fees?

texts:
I try to build an app where users can send and receive ERC20 tokens.

I want the transactions for my user to be feeless.

So is it possible for a user to create and sign the transactions,
my system collects these transactions and submit them to the network and pays their Ethereum fees?


texts: Running out of gas when sending ETH from MetaMask to Poloniex

texts:
I tried making a eth transaction to poloniex. However, I keep getting the error that I ran out of gas. How can I avoid this? Do I have to keep increasing the GWEI? Until what number?

Here a screenshot from etherscan:


texts: How do I resolve the DataCloneError when using web3 and react

texts:
I'm trying to add a small amount of web3 code to a react component. When I do so, I'm getting a DataCloneError. The component is as follows:

import React, { Component } from 'react';
import Web3 from 'web3';

class App extends Component {
  async componentDidMount() {
    const web3 = new Web3(window.ethereum);
    await window.ethereum.enable()
    web3.eth.getAccounts().then(console.log)
  }

  render() {
    return (
      <div>
        Hello Web3
      </div>
    );
  }
}

export default App;

The error I'm getting is

inpage.js:1 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': function (error, response) {
            if (!error) {
              resolve(response);
            }

        ...<omitted>... } could not be cloned.
    at i._write (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:114976)
    at b (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:133822)
    at w (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:134428)
    at i.g.uncork (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:137191)
    at i._onMessage (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:114856)

What am I doing wrong?


texts: Printing uint256 value to console while debugging with Truffle

texts:
I am trying to figure out how to print values to the console while doing truffle debug <txhash>.  So far I have tried using an event called "TestValue", but I am not seeing the output in the console window like so.  Does anybody have any insight as to how I can print out a numeric value to the console?  I have also looked into logx, such as doing log0(uint256Value) but saw that that is looking for bytes instead of a uint256.

This is the TestValue event that I tried that is not printing the output I am looking for:

Which is the method that I believe is making my contract fail like so:

Greatly appreciate in advance if somebody can help me to see the values being compared in that condition!


texts: Transferring ethers using a "for loop" in a smart contract

texts:
I am trying to send funds to the users who deposited ethers to my contract. I am currently achieving this by having the list of address and looping through them sending those addresses ethers. Right now this works for 2-3 users (tested).

My concern now is, if there are about 1000 users to whom I need to reward ethers. Is it sufficient if my contract has enough ethers to send fund + gas ? or should the transaction that calls the rewarding method needs to send the sufficient ethers in order to execute the transfers?

I have seen a couple of well known contract making users withdraw their reward instead of sending them automatically. Which one works? if both works then which method is recommended?


texts: Trouble receiving erc20 tokens on MyEtherWallet.com

texts:
I'm attempting to withdraw siacoin to a MyEtherWallet.com address accessed via a Trezor with 1.5 firmware.

The same address is storing a good amount of GNT.

Bittrex won't let me do the transaction because it says the destination address is invalid.

I do see that GNT is in the list on the right and SC is not. I'm not completely clear on how tokens are stored. Does it have to be in the list on the right before it will be stored? If so, is that a function of me adding it or do the developers have to add support for the coin?

Exact error: "Address: 0x22b41BCEBD969Db0dC75EA677192cD5B54436584
The address you submitted is not valid for the SC network. Cancel this withdrawal and resubmit it."


texts: Why contract owner balance 1Token instead of 1000000 in Metamask

texts:
I made contract ERC20 token MTCZx

https://ropsten.etherscan.io/address/0xf9471198b6f9c364f41Ea66e9a3F8daA637Ee77C#code

which can sell MTCZx tokens for ETH.

When I deployed it I make query to balanceOf with contract owner

  0x1b7c7eb39ee32aeC901Ddcf50b5b46dE13E74931

https://ropsten.etherscan.io/address/0xf9471198b6f9c364f41Ea66e9a3F8daA637Ee77C#readContract

and see contract owner has 1 000 000 MTCZx balance.

When I add MTCZx to metamask I see balance only 1 MTCZx instead of 1 000 000.

The same 1 MTCZx total supply here instead of 1 000 000

https://ropsten.etherscan.io/token/0xf9471198b6f9c364f41Ea66e9a3F8daA637Ee77C

Also when I send tokens to another user https://ropsten.etherscan.io/tx/0xdcfc79ff803eda40f9a7841c84acb76434565be9fb120bc3fbdfb2f46793d7ae

I see in Metamask balance 0 tokens instead of 0.01 MTCZx

What's wrong with metamask? I or ERC20 contract?


texts:
When transferring value within a function which one is best practices to do?

require(refundAddresses[x].send(refunds[refundAddresses[x]]))

refundAddresses[x].send(refunds[refundAddresses[x]


texts: How do I get a list of tokens held by an Etehereum address?

texts:
TL;DR: wanted: a method that receives an address as a parameter and returns an array of token names/contracts/balances held by address.
I'm aware of the fact that Etherscan API has a method allowing you to see the balance of an address, when you supply the contract taddress of a token. My question is: how do I get a list of tokens an address hold?
Case in point: when you go to Etherscan, there's a dropdown, showing a list of tokens and balances. Surely it is not the case (I hope) that Etherscan iterates through all known token contracts to look for the address?
How can I build such a list?


texts:
I have pub key of some peer (received it in block's header, it is need for some logic).
I need make connection to it to send request.
If peers know each other it is not a problem. I catch it like this peers.Peer(id), where peers is *peerSet and id - public key of peer.

But what I need to do, if this 2 peers not know each other.
May I ask bootnode to send me a connection by public key?


texts: why contracts can't be deployed on my private chain using geth CLI?

texts:
I tried to use the geth CLI(the eth.contract command line) to deploy a new contract to my private chain, but why is there no response even no transactions received by the chain according to the log
and when I use that command line to deploy the contract there is no need for me to unlock the account or provide the passphrase


texts:
I have installed geth and I'm trying to launch geth console:

geth --rinkeby --datadir "D:\eth" console 2>> ./rinkeby.log

Which starts as:

instance: Geth/v1.8.16-stable-477eb093/windows-amd64/go1.11
coinbase: {omitted}
at block: 0 (Wed, 12 Apr 2017 20:59:06 +06)
datadir: D:\eth
modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

When I call eth.syncing which returns to me:

{
  currentBlock: 3648059,
  highestBlock: 3648151,
  knownStates: 9004305,
  pulledStates: 8990048,
  startingBlock: 3648020
}

When I try to call eth.blockNumber it returns to me 0.

Did I miss something?


texts: Implementing redundancy in smart contract to prevent unwanted behavior and vulnerabilities

texts:
One of the design philosophy that help the airline industry to achieve such a high safety record was the "redundancy philosophy".

Each critical computers are designed to be fully redundant. That mean each computer is equiped internally with two independents channels: COM and MON for command and monitoring (channels are physically independent cards within the computer unit, each computers are actually two independent ones).

Each channels are designed and developed by two completely independent team.

This is to prevent a bug/unwanted behavior, two independent teams are very unlikely to implement the same bugs.

Each time the redundant computer do any computation, the result from both channel is compared.
If there is any discrepancies the computer stop and go in "fault" mode to prevent any non-standart behavior/command.

My question is:

Could this concept help to prevent bugs/vulnerability in smart contracts? (Like we have seen with the DAO event)

It would require the smart contract to be coded by two independent team and every request executed by the said smart contract will have to go trough "smart contract channel A" and then trough "smart contract channel B" the result compared and only executed if both channels give same result.

It seems very unlikely that two independent team end up coding the same vulnerability.

(I will also double the gas cost if I understand well)

Does this kind of concepts exist in software development (redundancy)?

Sorry fro my English I am not a native speaker.


texts: How to connect to infura and deploy contract use web3.py？

texts:
the orgin question is below:

How to connect to Ropston and deploy contract use web3.py？
I have deploy a contract to Ropston use remix and MetaMask.
I want know how to deploy a contract to Ropston via infura using web3.py without geth or parity.
I read the Documention and find there is no how-to chapter.
A small demo code will be very helpful.

And I just search and try And find this code can work.
But, buildTransaction()function can't add args to and nonce (will get errorValueError: Cannot set nonce in transaction) And if I just not add to nonce to transaction  in signTransaction() function I will get errorTypeError: Not all fields initialized

There must be something wrong.
I guess I should use another function rather than buildTransaction() But I can't find it in document.

So, what function I should use?
And what's pythonic way to deploy contract to https://ropsten.infura.io/ ?

from eth_account import Account
from web3 import Web3, HTTPProvider
from solc import compile_source

privateKey = "xxxxxx"
contract_source_code = '''
pragma solidity ^0.4.0;

contract Greeter {
    string public greeting;

    function Greeter() {
        greeting = 'Hello';
    }

    function setGreeting(string _greeting) public {
        greeting = _greeting;
    }

    function greet() constant returns (string) {
        return greeting;
    }
}
'''

compiled_sol = compile_source(contract_source_code)
contract_interface = compiled_sol['<stdin>:Greeter']
w3 = Web3(HTTPProvider("https://ropsten.infura.io/"))
w3.eth.enable_unaudited_features()
account = Account()
acct = account.privateKeyToAccount(privateKey)
contract_ = w3.eth.contract(abi=contract_interface['abi'], bytecode=contract_interface['bin'])
contract_data = contract_.constructor().buildTransaction({'from': acct.address,
                                                          'gas': 1728712,
                                                          'gasPrice': w3.toWei('21', 'gwei')})
contract_data["to"] = ""  # <----
contract_data["nonce"] = w3.eth.getTransactionCount(acct.address)   #<------
signed = w3.eth.account.signTransaction(contract_data, privateKey)
w3.eth.sendRawTransaction(signed.rawTransaction)


texts: ethereum wallet slowing down entire system (ubuntu 14)

texts:
I installed the wallet (0.8.7) on my Mac. Synced within 20 minutes, all good.
Trying to do the same on my Ubuntu 14 (on an lenovo x220, with ssd), and

it takes ages to sync (not the issue I am raising.. I am aware this problem has been discussed before) (rate is of a couple of blocks per minutes)
the whole system becomes irresponsive when I run the wallet. I.e., I can't browse or open a directory without having to wait 25 seconds etc.

I don't have to face slow downs on my machine when the Ethereum Wallet is not running. So what could be happening and how can I fix it, please?


texts: Second price auctions for more stable transaction fees

texts:
Why does Ethereum not use a second price auction for setting transaction fees?

This would protect users from paying too much by mistake and lead to more stable and predictable fees for everyone.

Implementing this for Bitcoin is discussed in the paper Towards a Functional Fee Market for Cryptocurrencies


texts:
What RPC APIs are safe to expose (make public, so accessible by anyone), and what are the unsafe ones, and why?

I've read:

are there "public" ethereum nodes? or any recommendations on hosting solutions?


texts: pyethapp is unable to add transactions to blockchain

texts:
I'm using pyethapp and web3.js to make transactions on a private network.

var to = "1152a50b91887591a2447b233105f392dbae72ce";
var from = "4dfd7cb92bca796821d5fc4512a6a02cc98d833d";
var json_data = {"Hi!" : "Hello World!!!"};
var tx_hash = web3.eth.sendTransaction({from: from_addr, to: to_addr, value: web3.toWei(10000, 'wei'), data: web3.toHex(json_data), gas:90000});

Everything goes well and the transaction is being signed by pyethapp. However, the transaction is not added to the blockchain. The output when it's signed is the following in the console (while running pyethapp):

INFO:p2p.peermgr    waiting for bootstrap
INFO:pow.subprocess nonce found
INFO:pow.subprocess sending nonce
INFO:pow    nonce found mining_hash=ddcb1d6ad36c172fe077f0cbf4b7e889339ba8effbcbc9472866e8ac9c4724e1
INFO:pow.subprocess nonce found
INFO:pow.subprocess sending nonce
INFO:pow    nonce found mining_hash=c32c7a78781a65cab4fa9b5d9faa6926fc58b626fa7fa88d351f629228dfb379
INFO:pow.subprocess nonce found
INFO:pow.subprocess sending nonce
INFO:pow    nonce found mining_hash=697a2cb3c9b07e97114eca5eb0077258d05ce8b6d1a6f528083f3c768d6880fc
INFO:pow.subprocess nonce found
INFO:pow.subprocess sending nonce
INFO:pow    nonce found mining_hash=7a7697bfd0416b29360a2fb675b8c760aa8b90a54dde307cbde91e4c0cd3d8e1
INFO:pow.subprocess nonce found
INFO:pow.subprocess sending nonce
INFO:pow    nonce found mining_hash=8f19ee2ee4d8814ec9c172037d274f3a7f9df28b32a7e585610969dd06c240ed
INFO:accounts   signing tx account=<Account(address=4dfd7cb92bca796821d5fc4512a6a02cc98d833d, id=None)> tx=<Transaction(7236)>
INFO:pow.subprocess nonce found
INFO:pow.subprocess sending nonce
INFO:pow    nonce found mining_hash=19f3d9615f961c7a2351a2460393476f22ddbaa79bbfe3bac3acd3eedab14676
WARNING:pow mining_hash does not match
INFO:pow.subprocess nonce found
INFO:pow.subprocess sending nonce
INFO:pow    nonce found mining_hash=4daad5461707f1c29fc88c5929fd5c50b423159601181587e89d189d5f50329d

I also noticed the line:

mining_hash=19f3d9615f961c7a2351a2460393476f22ddbaa79bbfe3bac3acd3eedab14676
    WARNING:pow mining_hash does not match

I'm not sure it's related to the transaction (I've made only one transaction on the private net). All addresses have predefined balances inside the blockchain and it's not an issue related to insufficient gas/Ether.

The genesis block is also using a very low difficulty level (<100) in order to mine transactions more rapidly.

Why isn't the transaction added to the block chain?

I'm using the function (from here) to query the blockchain for the recipient's address.

Edit:

What's strange is that the transaction has a receipt:

blockHash:"0x10b5c028b21e42104de61ba943ce14d11bcf01812ec675b10373d80316da481"
blockNumber:2
contractAddress:null
cumulativeGasUsed:21952
gasUsed:21952
logs:Array[0]
transactionHash:"0xcbd5db525f2b592d3d16f332747f22c50f1632e5629f5fe497673efc5d2b7a5a"
transactionIndex:0


texts: web3py - Function Call when Sender Must Be Certain Address

texts:
I have a contract on Ropsten, and when I do this is python, I get a result:

result = contract.functions.getLastUpdateTime(0).call()

So I know the ABI is there, the address, etc.

There's another function getCurrentPrice on that same contract, which only differs in that it is restricted to be readable only for those querying with a certain address (ie, require(msg.sender = '0x123...')). I can get this to work in Remix, and have the public and private key that satisfies this restriction, so the problem is not that this function is screwed up.

Clearly, I need to tell it my public and/or private key info. Where do I add that to my transaction?

with open(contract_abi0) as f:
    contract_abi = json.load(f)
    contract = w3.eth.contract(address = contract_address, abi = contract_abi['abi'])
UpdateTime = contract.functions.getLastUpdateTime(0).call() # works!
Price = contract.functions.getCurrentPrice(0).call() # does not work :(


texts: Is there any difference between transaction hash and transaction receipt?

texts: Is there any difference between transaction hash and transaction receipt ? or both are same. Whenever a transaction occurs, ethereum will reply with a hash value before the value is mined and added to a block.


texts:
Preface
I am new to learning Solidity and about smart contracts in general. I think that asking here would save me time rather than trying to fully figure things out myself.
Scenario
Suppose that I would like to implement a two player game with a smart contract such as rock paper scissors. I would like to have a random matchmaking algorithm which pairs players who are queued to play. Once players are paired, they are both entered into a smart contract. I understand that randomness is not possible within Solidity, so I think that the matchmaking will have to be done offchain. What are some different frameworks for making this system?
Edit: Rock paper scissors was probably not the best example game for my scenario. The aim of the random matchmaking is to make it impossible to reliably queue into yourself or a collaborator. This would be important for a game like poker, where queuing into yourself or your friend can result in unfair collusion.


texts:
Parity Ethereum version: version Parity-Ethereum/v2.0.1-beta-e7dc0be-20180726/x86_64-linux-gnu/rustc1.27.2
Operating system: Linux
Installation: built from source
Fully synchronized:
Network:
Restarted: yes

I followed this tutorial to set up a private chain with PoA . When i try command parity --config node0.toml.

  Method 1. Using RPC
      Start the node 0 using parity --config node0.toml.

i get this

root@amal:~# parity --config node0.toml
Loading config file from node0.toml
Option '--dapps-port' has been removed and is no longer supported.
2018-08-31 19:33:23 UTC Starting Parity-Ethereum/v2.0.1-beta-e7dc0be-20180726/x86_64-linux-gnu/rustc1.27.2
2018-08-31 19:33:23 UTC Keys path /tmp/parity0/keys/DemoPoA
2018-08-31 19:33:23 UTC DB path /tmp/parity0/chains/DemoPoA/db/d0678730db7ea493
2018-08-31 19:33:23 UTC State DB configuration: fast
2018-08-31 19:33:23 UTC Operating mode: active
Consensus signer account not found for the current chain. You can create an account via RPC, UI orparity account new --chain demo-spec.json --keys-path /tmp/parity0/keys`.


texts: truffle console: Can't execute function i.e., TypeError: SimpleContract.at(...).getName is not a function

texts:
I am trying to familiarize with 'truffle console' by doing the tutorial at:
https://medium.com/oli-systems/test-driven-solidity-with-truffle-e4beaa2bd194
$truffle migrate

Compiling your contracts...

Compiling ./contracts/SimpleContract.sol : : 2_deploy_contracts.js
=====================

Deploying 'SimpleContract'    --------------------------

transaction hash:    0xd92a66361f9145398ec0ce5e2a90e2a97f5c10015475b3d2cabcba75eec14e5c
Blocks: 0            Seconds: 0
contract address:    0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f
block number:        5
block timestamp:     1610603088
account:             0x47FBfdC7eC99871c2D9fFDdd3D77e6c70F727556

truffle(development)> SimpleContract.at ('0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f');

TruffleContract {   constructor:    { [Function: TruffleContract]
_constructorMethods:
{ configureNetwork: [Function: configureNetwork],    /more/
source:
'//SPDX-License-Identifier: MIT\npragma solidity >= 0.5.0 < 0.7.0;\n \ncontract SimpleContract {\n  string  public name;\n  constructor() public {\n     name = 'my name';  \n  }\n  function
getName() public view returns(string memory) {\n      return (name);\n
}\n   function changeName(string memory
_name) public {\n      name = _name;\n   }\n}\n', :
/*more */

 truffle(development)> SimpleContract.at('0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f').getName();

Thrown: evalmachine.:0
SimpleContract.at('0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f').getName();
^
TypeError: SimpleContract.at(...).getName is not a function
at evalmachine.:0:65
at sigintHandlersWrap (vm.js:288:15)
at Script.runInContext (vm.js:130:14)
at runScript (/home/zulfi/.nvm/versions/node/v10.22.0/lib/node_modules/truffle/build/cli.bundled.js:494964:21)
at Console.interpret (/home/zulfi/.nvm/versions/node/v10.22.0/lib/node_modules/truffle/build/cli.bundled.js:494979:21)
at ReplManager.interpret (/home/zulfi/.nvm/versions/node/v10.22.0/lib/node_modules/truffle/build/cli.bundled.js:304740:18)
at bound (domain.js:402:14)
at REPLServer.runBound [as eval] (domain.js:415:12)
at REPLServer.onLine (repl.js:642:10)
at REPLServer.emit (events.js:198:13) truffle(development)>

Somebody please guide me how to invoke functions using 'truffle console'?
Zulfi.


texts: Web3js does not connect to TestRPC in localhost


texts: Web3 event listener not reacting to emitter

texts:
I'm writing a program in JS/Node that, amongst other things, subscribes to a smart contract event waiting for it to happen.

There's a lot going on on the code, so I've got it separated.

The main function calls (code reduced):

var task = cron.schedule("0 * * * * *", function() {
    console.log(new Date());
    contract.funct();
}, true);

task.start();

contractRouter.subscribeToEvent().then(function(result) {
    deferred.resolve(result);
}).fail(function(err) {
    deferred.reject(err);
});

app.listen(config.get('port'), function() {
    loggerButler.info('App listening on port...', config.get('port'));
});

The contractRouter.js has:

function subscribeToEvent() {
    var deferred = q.defer();

    handler.getContractToSubscribe().then(function(abiContract) {
        abiContract.allEvents({ fromBlock:'latest' }, function(error, result) {
            if(!error) {
                // other functions here with the values returned
                deferred.resolve(result.returnValues);
            } else {
                deferred.reject(error);
            }
        });
    }).fail(function(err){
        deferred.reject(err);
    });

    return deferred.promise;
}

and the handler.js just returns the contract like (code reduced):

var abiContract = new web3.eth.Contract(abiAddress, contractAddress);
deferred.resolve(abiContract);

For some reason, I'm not getting the events when they're fired. I know for a fact that they're being fired, but they're not getting through to the program.

Can you help me find out what's wrong? Is there something wrong with having the code split between different classes?


texts: What were the first 5 technical steps in launching Ethereum?

texts:
I am a developer for about 10 years now and quite new to the crypto world. I understand the basic concepts for Blockchains and tokens and proof-of-whatever. But what I am missing is:

  After finishing the white paper, what happens next?

So Ethereum had this idea, and then what. They coded the blockchain (in which language?) and were did they place it?

Until a network works, a first instance needs to be somewhere, waiting for input.

Afterwards, where is the full chain? I've read a few projects where they say "We sync instead of downloading the whole chain to make it faster to use." Where do they sync it from? How do you speak to one or many chains?

  The idea is that every member of the network downloads the chain, and
  then sends a transaction. Where do I send it to? I mean physically, not devloper talk like (to the nodes in the network).

What I don't get is: When do I have the chain on my phone or computer? When I create a wallet? What if I just create paper wallets. Who makes sure there are enough fully downloaded and working chains available? Miners?


texts: Runtime Error: out of gas when calling method on contract

texts:
I am using Truffle Framework and TestRPC. I have the following method on my contract:

function sendEmr(address receiver, string universalPatientId, string firstName, string lastName, string url) returns(bool val){

    emrRecords[receiver].universalPatientId = universalPatientId;
    emrRecords[receiver].firstName = firstName;
    emrRecords[receiver].lastName = lastName;
    emrRecords[receiver].url = url;

    EMRTransfer(msg.sender, receiver, universalPatientId, firstName, lastName, url);

    return true;
}

When I execute this method from my DAPP; I am receiving the following error in TESTRPC:

eth_accounts
eth_call
eth_call
eth_sendTransaction

  Transaction: 0xe212676e7b4b906d01932d7d2b7de9872d4e2a46e7730fee22e7488756f00d08
  Gas usage: 0x015f90
  Block Number: 0x07
  Block Time: Thu Jun 22 2017 11:36:03 GMT-0500 (Central Daylight Time)
  Runtime Error: out of gas

What should I do to handle this situation. Thank you very much!


texts: How to handle both string and bytes32 method returns?

texts:
I have the following code to extract ERC20 token symbols from addresses:

const AllTokenSymbols = await Promise.all(
    allTokens.map(tokenAddress => {
        const tokenContract = new web3.eth.Contract(detailedERC20ABI, tokenAddress);
        return tokenContract.methods.symbol().call();
    })
);

But it seems one of the tokens have bytes32 symbol type instead of string type: https://etherscan.io/address/0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2#readContract

Uncaught (in promise) Error: ERROR: The returned value is not a convertible string:
    at o.formatOutputString [as _outputFormatter] (https://multitoken.github.io/MultiToken/js/web3.min.js:1:469203)
    at o.decode (https://multitoken.github.io/MultiToken/js/web3.min.js:1:476648)
    at https://multitoken.github.io/MultiToken/js/web3.min.js:1:472761
    at Array.forEach (<anonymous>)
    at m.decodeParameters (https://multitoken.github.io/MultiToken/js/web3.min.js:1:472728)
    at M.l._decodeMethodReturn (https://multitoken.github.io/MultiToken/js/web3.min.js:1:669532)
    at c.outputFormatter (https://multitoken.github.io/MultiToken/js/web3.min.js:1:674775)
    at c.formatOutput (https://multitoken.github.io/MultiToken/js/web3.min.js:1:330711)
    at o (https://multitoken.github.io/MultiToken/js/web3.min.js:1:334321)
    at https://multitoken.github.io/MultiToken/js/web3.min.js:1:415963
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:89025
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:8261
    at i (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:26492)
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:11091
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:8261
    at u (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:11367)
    at s (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:11289)
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:11091
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:88390
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:89974
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:20704
    at u (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:11381)
From previous event:
    at j.F [as _captureStackTrace] (https://multitoken.github.io/MultiToken/js/web3.min.js:1:351026)
    at j._resolveFromExecutor (https://multitoken.github.io/MultiToken/js/web3.min.js:1:378765)
    at new j (https://multitoken.github.io/MultiToken/js/web3.min.js:1:372241)
    at o (https://multitoken.github.io/MultiToken/js/web3.min.js:1:412425)
    at r (https://multitoken.github.io/MultiToken/js/web3.min.js:1:334238)
    at Object.l._executeMethod (https://multitoken.github.io/MultiToken/js/web3.min.js:1:674963)
    at Promise.all.allTokens.map.token (https://multitoken.github.io/MultiToken/js/multitoken.js:239:55)
    at Array.map (<anonymous>)
    at HTMLSelectElement.<anonymous> (https://multitoken.github.io/MultiToken/js/multitoken.js:237:23)

Is there any simple way to handle this without unrolling array of promises?


texts: keystore file's character length seems really small to be a wallet/key

texts:
Apologies, new to Ethereum, but I have read a bit and searched.
wc -c of my keystore file is only 491 characters and I don't see anything that looks like a private key block.

Could this possibly be the only thing I need to back up in case of loss?

Thanks!


texts: Stuck at "ipfs process started" after running embark

texts:
I ran the following commands,
embark demo
cd embark_demo embark run
embark info invoked /home/k00lawn/.nvm/versions/node/v10.17.0/lib/node_modules/embark/bin/embark
embark info located /home/k00lawn/Work/projects/embark_demo/node_modules/embark/bin/embark
embark info Switching from embark@6.0.0 to embark@6.0.0

pid 23875 listening on /tmp/embark-98331801/embark.ipc
loaded plugins: embark-ipfs, embark-swarm, embark-whisper-geth, embark-geth, embark-parity, embark-profiler, embark-graph, embark-basic-pipeline
Cockpit UI available at http://localhost:55555
Blockchain node is ready
Starting Whisper node in another process
IPFS node not found, attempting to start own node
Starting ipfs process
HTTP Proxy for node endpoint ws://localhost:8546 listening on http://localhost:8555
WS Proxy for node endpoint ws://localhost:8546 listening on ws://localhost:8556
ipfs process started


texts:
If a structure contains a nested structure and it is deleted, does the nested structure get deleted as well?

For example,

struct Point {
    uint256 x;
    uint256 y;
}

struct Image {
    Point[] points;
    string name;
}

If image is deleted does the points array get deleted as well?