texts: What happens to an already existing token after I re-deploy a fork?

texts:
Since most ICO's published there Token-Code and SmartContract-Code on GitHub, what would happen if someone "steals" this code and re-deploys it on the Ethereum Main-net under the same Name and Token-symbol?

And how can one prevent such an action?


texts:
If I use web3.js I can convert a string to hex with:
web3.utils.toHex('4c7b7ffb66b344fbaa64995af81e355a')

How do I use the same utility for ethers.js?


texts:
When a base class uses a library, do derived classes also use the same library?

For example:

contract A {
    using SafeMath for uint256;
    ...
}
contract B is A {
    //is code here using SafeMath for uint256?
}


texts: Can I set the block size in genesis block by puppeth?

texts: Found the block size is set to 30K in genesis block. How can I modify this value to 100K or 1M by puppeth?


texts: Why is it that the Mist client can not display the transactions?

texts: "Latest Transactions" not updating in Mist Wallet after sending Eth from Polo to my wallet. Balance is updating fine but can't see any transactions since 3/31.


texts:
My environment:

geth 1.8.11
Ethereum Wallet
Mist Browser
Windows 10

I tried to deploy a new contract in the Ethereum Wallet.
I executed  (miner.start();)  in the Geth JavaScript console to get some ether. Then, to deploy the contract, I started mining again using (miner.start();)

(I'm following this tutorial https://codeburst.io/build-your-first-ethereum-smart-contract-with-solidity-tutorial-94171d6b1c4b).

But when I started mining, the number of ether continued to increase and the number of confirmation did not increase and hence the contract cannot be deployed


texts:
I am trying to install IPFS on my macbook bro with and following instructions from here:

https://ipfs.io/docs/install/#installing-from-a-prebuilt-package

When I try to run the install bash script:

./go-ipfs/install.sh

I get this error:

  We cannot install ipfs in one of the directories /usr/local/bin
  /usr/bin It seems that we do not have the necessary write permissions.
  Perhaps try running this script as a privileged user:

sudo go-ipfs/install.sh

I have also tried using sudo go-ipfs/install.sh but still run into the same error.

The guys on from here (https://discuss.ipfs.io/t/we-cannot-install-ipfs-in-one-of-the-directories-usr-local-bin-usr-bin/997) say to move ipfs to usr/bin, but when i try it the terminal returns Operation not permitted.

I will appreciate assistance with this


texts: Keccak256 of msg.sender and timestamp: what's the likelihood of an output coincidence?

texts:
Let's think about this code:

function publishEtherBox (bytes32 _label, string _ownerUrl, uint _lifespan) external onlyWhenRunning() payable {
      require(ownerToEtherBoxes[msg.sender].length < 10);
      assert(bytes(_ownerUrl).length <= 200);
      address etherBoxAddress = address(keccak256(msg.sender, now));
      ownerToEtherBoxes[msg.sender].push(etherBoxAddress);
      etherBoxes[etherBoxAddress] = EtherBox({
        label: _label,
        owner: msg.sender,
        ownerUrl: _ownerUrl,
        expiration: now + _lifespan
      });
      emit EtherBoxPublished(msg.sender, nicknames[msg.sender], etherBoxAddress, _label, now);
      if(msg.value > 0){ owner.transfer(msg.value); }
  }

referring to the 4th line, it is obvious the it might lead to an output coincidence if multiple transactions from the same msg.sender are packed in the same block on the same timestamp. How to avoid that and what's the chance of getting the same behaviour using a proggressive nonce instead of now?


texts: Will not a PoS implementation converge in a much less wealth equally distributed system?

texts: With the current trends of prices in crypto and the long term vision supported by the community (HODL!), the implementation of Proof of Stake could eventually derive in big ETH stakeholders getting the majority of the mining fees. Will not this derive in a more fat-tailed distribution of the currency holders, continually increasing the wealth inequality of the system?


texts: Smart Contract function keep return Null value?

texts:
Hey I am new with Solidity. And I just tried to link my front end view  with the smart contract. With the simplest possible approach.

My contract:-

My JS code:-

Console keep printing 'null' I don't know why? I am sure about contract initialization because I used web-pack box.Thanks in advance.


texts:
I first started GUI version of Ganache. Then I run the following commands to try pet-shop. http://localhost:3002/ is then opened in my browser, When I click "Adopt" for a dog, I see no transactions in Ganache. Does anybody know whether there is something wrong?

bash> truffle unbox pet-shop
Downloading...
Unpacking...
Setting up...
Unbox successful. Sweet!

Commands:

  Compile:        truffle compile
  Migrate:        truffle migrate
  Test contracts: truffle test
  Run dev server: npm run dev
bash> truffle compile
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/tmp.RJe3ehbB6u/contracts/Migrations.sol:11:3: Warning: No visibility specified. Defaulting to "public".
  function Migrations() {
  ^ (Relevant source part starts here and spans across multiple lines).
,/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/tmp.RJe3ehbB6u/contracts/Migrations.sol:15:3: Warning: No visibility specified. Defaulting to "public".
  function setCompleted(uint completed) restricted {
  ^ (Relevant source part starts here and spans across multiple lines).
,/private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/tmp.RJe3ehbB6u/contracts/Migrations.sol:19:3: Warning: No visibility specified. Defaulting to "public".
  function upgrade(address new_address) restricted {
  ^ (Relevant source part starts here and spans across multiple lines).

Writing artifacts to ./build/contracts

bash> truffle migrate
Using network 'development'.

Network up to date.
bash> truffle test
Using network 'development'.

  0 passing (1ms)

bash> npm run dev

> pet-shop@1.0.0 dev /private/var/folders/r7/bvmh1vvx41d63snvgbdz7bl40000gr/T/tmp.RJe3ehbB6u
> lite-server

** browser-sync config **
{ injectChanges: false,
  files: [ './**/*.{html,htm,css,js}' ],
  watchOptions: { ignored: 'node_modules' },
  server:
   { baseDir: [ './src', './build/contracts' ],
     middleware: [ [Function], [Function] ] } }
[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3002
    External: http://10.10.200.116:3002
 --------------------------------------
          UI: http://localhost:3003
 UI External: http://10.10.200.116:3003
 --------------------------------------
[Browsersync] Serving files from: ./src
[Browsersync] Serving files from: ./build/contracts
[Browsersync] Watching files...
18.04.10 08:15:00 200 GET /index.html
18.04.10 08:15:00 200 GET /css/bootstrap.min.css
18.04.10 08:15:00 200 GET /js/bootstrap.min.js
18.04.10 08:15:00 200 GET /js/web3.min.js
18.04.10 08:15:00 200 GET /js/truffle-contract.js
18.04.10 08:15:00 200 GET /js/app.js
18.04.10 08:15:01 200 GET /pets.json
18.04.10 08:15:01 200 GET /images/scottish-terrier.jpeg
18.04.10 08:15:01 200 GET /images/french-bulldog.jpeg
18.04.10 08:15:01 200 GET /images/boxer.jpeg
18.04.10 08:15:01 200 GET /images/golden-retriever.jpeg
18.04.10 08:15:01 404 GET /favicon.ico


texts: Keeping Contract Address, Web3 HttpProvider and Account Address away from the DApp UI/Frontend User

texts:
I am building with Quorum and Web3js. As I build the DApp UI/frontend, I realised that details such as address of the node, contract address and the account address (from:) are in plain text. One just need to right click the web page and "View Page Source" and voila, the details are all there. Sure these details are also exposed to all other nodes who are on blockchain. However, what if one wants to keep these details (account address, contract address and node URL and RPC port) from the user of the DApp UI?

Sample code below:

window.web3 = new Web3(new Web3.providers.HttpProvider("http://nathan.aw.loves.blockchain:22000"));

var contractAddress = "0xpmj28d341d1f27f1f1e989e301550de60503941";
var contractInstance = web3.eth.contract(abi).at(contractAddress);

from:"0xyt2d61dbc6fdc72c2ffa6e7d5b8198a4eb705q08"

Nathan Aw


texts: What happens if GitHub path for import changes?

texts:
I wondered what happens if for example OpenZeppelin changes the path of a contract I have imported like this: import "@openzeppelin/contracts/token/ERC721/ERC721.sol";? Will my contract still be working as before?
I could imagine that the EVM searches for the exact same contract in its memory and then just changes the import to the path where the EVM stores this file... Just asking to make sure my contract still works in like 3 years after I use such imports


texts: Can't call function with modifier from another contract even if the owner himself calls

texts:
So I have multiple contracts that use the same modifier.

contract Token is ERC20Basic {

using SafeMath for uint256;

mapping(address => uint256) balances;

Owned private owned;

/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
    require(msg.sender == owned.getOwner());
    _;
}

function Token(address _owned) {

  owned = Owned(_owned);

}

function changeOwnerContract(address _owned) onlyOwner {

  owned = Owned(_owned);

}

function transfer(address _to, uint256 _value) public returns (bool) {

require(_to != address(0));

balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;

}

 /**
 * @dev Gets the balance of the specified address.
 * @param _owner The address to query the the balance of.
 * @return An uint256 representing the amount owned by the passed address.
 */
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}

function increaseTotal(uint256 _amount) public onlyOwner {

totalSupply = totalSupply.add(_amount);

}

function addToBalance(address _to, uint256 _amount) public onlyOwner {

balances[_to] = balances[_to].add(_amount);

}

}

And the second one:

contract TokenController {

Token private token;

Owned private owned;

event Mint(address indexed to, uint256 amount);

/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
    require(msg.sender == owned.getOwner());
    _;
}

function TokenController(address _sapien, address _owned) {

    token = token(_sapien);
    owned = Owned(_owned);

}

function changeBasicToken(address _sapien) onlyOwner {

    token = Token(_sapien);

}

function changeOwnerContract(address _owned) onlyOwner {

    owned = Owned(_owned);

}

function mint(address _to, uint256 _amount) onlyOwner returns (bool) {
    token.increaseTotal(_amount);
    token.addToBalance(_to, _amount);
    Mint(_to, _amount);
    return true;
}

}

Here is the Owned contract:

contract Owned {

address private owner;

/// @notice The Constructor assigns the message sender to be `owner`
function Owned() {
    owner = msg.sender;
}

address private newOwner;

/// @notice `owner` can step down and assign some other address to this role
/// @param _newOwner The address of the new owner. 0x0 can be used to create
///  an unowned neutral vault, however that cannot be undone
function changeOwner(address _newOwner) {

    if (msg.sender != owner)
        revert();

    newOwner = _newOwner;

}

function getOwner() public returns (address) {

    return owner;

}

function acceptOwnership() {
    if (msg.sender == newOwner) {
        owner = newOwner;
        newOwner = 0x0000000000000000000000000000000000000000;
    }
}
}

If I try to deploy on Mist (all contracts from the same address) and then call "mint" from TokenController, I get an error saying that the function can't be executed. If I don't put onlyOwner in Token at "increaseTotal" and "addToBalance", it works. But it should also work if I have the modifier there, because I basically call from the same address that deployed Owned, Token and TokenController....

Do you know why it doesn't work?


texts: Incentive to vote early in Casper FFG protocol?

texts:
If I understand the Casper FFG protocol correctly, (1) all votes are public, and (2) the optimal voting strategy would be to observe other votes and vote accordingly (see this post, section "The Validator Strategy").

Given that, why would anyone every vote early? What incentive is there for any validator to be the first one to submit a vote?


texts: filter indexed events from browser using web3.js

texts:
I Have a  contract defined which logs 2 events :

 myEvent(string data, uint32 indexed id),
 myEvent1(string data, uint32 indexed id).

I want to filter all the events on the browser using web3 by passing   the indexed id.

How to get all the events with the passed id.
when I try to get the event from the txHash it returns the event data but only string paramater is decode correctly. the uint32 type is returned as a Big number. How do is resolve their two issues??


texts: I want to create a very close to random number generator for a smart contract which I would like to do HTTP calls to webservices to do. Is that able to be done with Solidity? I am just digging into the docs now and have yet to read any mention of it, thanks!


texts: Invalid number of arguments in ERC20 code?

texts:
Im using the official ERC20 code example from here: https://www.ethereum.org/token

I've got everything running fine in truffle, but when i call this function:

function transfer(address _to, uint256 _value) public {
        _transfer(msg.sender, _to, _value);
    }

I get Error: Invalid number of arguments to Solidity function

I'm running these commands from the truffle console:

 var token;
 Token.deployed().then((res) => {token = res});
 var alice = '0xbb452da6021229d93b28a6fea487fd3098eb8b16';
 token.transfer(alice, 44);

I've copy pasted the address from the accounts listed by testrpc
Any idea whats going on?
Thanks!


texts:
I had to reformat my OS since the last time I did any mining and so I don’t have any of the data originally on my HD. I do have my Geth account # and assuming I can remember my password is that sufficient to recover my account and transfer my ETH?

Alternatively was there a key of some kind of my old computer that is now lost which will inhibit me from being able to recover my ETH?


texts: Transaction not mined but block number created

texts:
When I send a transaction it generates hash number but the transaction index number not increased as per below. Can someone care to explain?

eth.getTransaction("0x46542d25d044f73cff4c19081284ac84623de6bcaceb1aadd0545d21cd44a056")
{
  blockHash: "0x71d79df1f93332f4cf3b239231a487ec61f4f0385447520078e51c56913fa091",
  blockNumber: 2,
  from: "0xed9d02e382b34818e88b88a309c7fe71e65f419d",
  gas: 4700000,
  gasPrice: 0,
  hash: "0x46542d25d044f73cff4c19081284ac84623de6bcaceb1aadd0545d21cd44a056",
  input: "0x4a78245865ad5c90515ab305fbdb5959abd40a8fba263eb4a30497a4c354b9a77a649c11d3e2f8cd305468fcfef474c001b7d7d5fa3fa7f482a64a3513cc5923",
  nonce: 1,
  r: "0x47e083e2d701c89eb0919733fde0163d5bdf878e46f8aa0bee300214d00b6cfd",
  s: "0x2a60267c3f549437a0fb7f474f5e00d9a2afa019cfb5b9a800875948cf14e4d7",
  to: null,
  transactionIndex: 0,
  v: "0x25",
  value: 0
}


texts:
I want to run ethkey under Parity with this answer.

But when I run the first command cargo build --release -p ethkey --features=ethkey-cli under the parity source folder, it returns:

  error: Package ethkey v0.2.0
  (file:///home/yangyifei/Parity/parity/ethkey) does not have these
  features: ethkey-cli

If I delete --features=ethkey-cli, it runs correctly. But I can't execute the second command, with returns no file or directory.

How can I run the command?


texts:
I have a smart contract that outputs a different bytecode when compiled with truffle, and with remix, even though both seem to use the same compiler version: 0.5.7+commit.6da8b019 Is that a known issue ? Is that normal ?

This causes issues to verify my smart contract on etherscan, and thus to be trusted by my users, which is kind of a big deal.

Thanks for your help.


texts:
As I understand, privacy on of the key features or Raiden.

Let's say that I want fast transactions but at the same time I want to have the transparent transactions history for an independent observer, like on the main network.

Should I go with a Plasma in that case or theirs some way I can handle it with Raiden or other off-chain solution?


texts:
What is the total number of ethers that will be generated/mined?

See https://forum.ethereum.org/discussion/1451/how-many-ethers-will-ever-exist


texts: Store and retrieve data in an array in Solidity

texts:
How can store and retrieve data (many stings) while the array is an attribute of an object. I mean how to store the user info including stings in the sting[] and retrieve all User info including all the strings in the string array

 struct User {
   uint256 id;
   //other attributes
   string[];
}


texts: Install geth with tools on Mac using brew

texts:
geth can be installed on the Mac OS X using brew

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

Is there a way to use brew to install Geth and tools?


texts: What is the gas cost for verifying signature, run AES and conditional transaction?

texts:
I am new to the field of dAPP so this question might looks silly.
I learnt that a standard transaction fee is 21000 gas. While designing my application, I am facing such a question:

How much does it take for such a smart contract:

Verify some(saying 4) messages and their corresponding signatures with a given public key.
Verify if a private key can be used to decrypt a particular ciphertext into a particular plaintext.
Verify if two strings(about 1Kb long) are equal.
If any of the verification fails, the money(say 1ETH) goes to account A, otherwise it goes to another account B.

Thanks in advance!


texts:
I'm new to ethereum.

I downloaded eth, geth, and mix from https://www.ethereum.org/cli, but I can't find ethconsole.exe file in the zip file.

The only executable in the zip file is eth.exe. I tried 'eth.exe console' command but did not work.

How can I run eth console with eth.exe file?

Thanks in advance.


texts: How to obtain small quantities of Ether?

texts:
As a newcomer currently evaluating the platform (for smart-contracts, experimentally, not as an investment, hence the low amount - I just need to pay for gas), I don't want to commit any large amount of currency to it at this time. This, though, leaves me with the problem of obtaining ether at all to do said evaluation, without mining hardware, and with most exchanges either not wishing to deal in, or imposing proportionately high fees for, fribbling small change - such as purchasing $5-worth of ether at a time.

What is the best way to purchase ether in such small quantities, if it is indeed possible?


texts: Solidity : About function calls between deployed contracts

texts:
I want to make a function call between a token (MyToken.sol) that inherits MintableToken.sol of OpenZeppelin and manipulate that token (Buy. Sol).

(MyToken.sol)

pragma solidity ^0.4.21;
import "https://github.com/OpenZeppelin/zeppelin-solidity/contracts/token/ERC20/MintableToken.sol";

contract MyToken is MintableToken {
  string public constant name = "MyToken";
  string public constant symbol = "MyToken";
  uint public constant decimals = 18;
}

(Buy.sol)

pragma solidity ^0.4.21;
import "https://github.com/OpenZeppelin/zeppelin-solidity/contracts/ownership/Ownable.sol";
import "./MyToken.sol";

contract Buy is Ownable{
    MyToken my_token;

    function setToken( address _cotract_address ) public onlyOwner{
        my_token = MyToken( _cotract_address );
    }

    function buyPoint( uint _amount ) public{
        my_token.transfer( owner, _amount );
    }
}

I call the transfer function inherited by MyToken from the buyPoint function.
According to Remix of IDE, it seems that the transfer function is called by another thing set to my_token.
Even if you call buyPoint after mint, revert() will be called because token is missing.

It is concrete procedure below.

Deploy each contract
Call the setToken function with the address of the deployed MyToken as an argument
Mint with the same address as 2
Call the buyPoint function → require (_value <= balances [msg.sender]); with revert

Before moving the step to the inside of the transfer function, it is confirmed that my_token contains normal data.
If you step forward through the transfer function, there is no value that should be stored in balance, it is empty.
As a result, revert () will be called by stuck on require.

Is the function call method incorrect?
Can someone teach me?


texts:
Can anyone explain or point me to a specific source where I can learn about .providers functions. In particular I am trying to understand what this block of code does:
for (let i = 0; i < 257; i++) {
    await ethers.provider.send("evm_increaseTime", [1]);
    await ethers.provider.send("evm_mine", []);
    console.log(await ethers.provider.getBlockNumber());
  }

I've tried searchintg the etherjs library but I can't search specific info for providers.* functions. Maybe I just don't know how to use the documentation search properly.
Furthermore, I've tried running it with an Alchemy API, apparently the method is unsupported. Is there an equivalent method?


texts: Is there any Ethereum HD wallet java library? I find a popular java library on Github, web3j, which doesn't support HD wallet yet.


texts: Interact with a contract function using Web3.js

texts:
I finished testing my smart contract functionality with "unlocked accounts" (which don't require complex signing) on a local dev blockchain, but now I would like to deploy on MAINNET and use private keys.
After I deploy, I want to interact with a function in my smart contract using Web3.js, but all the tutorials I've seen use "unlocked accounts" on private local chains which unfortunately aren't helping.
What do I have to add to this contract instance in order to broadcast real signed transactions that are valid and will invoke functions on MAINNET.
const Web3 = require('web3');
const myContract = require('./build/contracts/myContract.json');   //because I use Truffle

const init = async () => {
    const web3 = new Web3('https://mainnet.infura.io/v3/MY-INFURA-ID');
    const id = await web3.wth.net.getId();
    const deployedNetwork = myContract.networks[id];
    const contract = new web3.eth.Contract(
        myContract.abi,
        deployedNetwork.address
    );
}

//I have the HDwallets package if that's relevant..

Help would be really really appreciated, I'm lost!


texts: Parity wallet freezes on first setup page on Mac osx

texts: I'm trying to install parity for a mate on his name Mac. After the install, on the first setup page where it asks me to put in my wallet name etc, it freezes on that table only. I've left it for an hour thinking maybe it was syncing but that didn't help. Reinstalled 3 times. We both don't know how to do anything technical on a Mac so sorry for the simple noon technical explanation.


texts: From a traditional web based application how can I able to call ethereum network node?

texts: Let's say there is a web application running on server 12.34.45.45 ip. Peer A open this web application in his own browser.Now how he will be able to connect a ethereum node where peer B is running.Please note ip of peer A,peer B are different from the ip where web server is running i.e. 12.34.45.45.


texts: How to print the value of a Struct ?(mapping)

texts:
If the set function receives two inputs

1.["0xca35b7d915458ef540ade6068dfe2f44e8fa733c",50,"ROC","park"]

2.["0x14723a09acff6d2a60dcdf7aa4aff308fddc160c",60,"AU","school"]

How do I display the string position in an array?(ex:["ROC", "AU"]), because I want to use time, location and position to do some if-else statement and then return the results to the user. thanks

pragma solidity ^0.5.1;

contract matching {

    struct User {
        uint time;
        string location;
        string position;
    }
    User[] people;

    mapping (address => User) user_mapping;
    address[] public userAccounts;

    function set(address _address, uint _time, string memory _location, string memory _position) public {
        User storage users = user_mapping[_address];

        users.time = _time;
        users.location = _location;
        users.position = _position;

        userAccounts.push(_address) -1;
    }

    function getAccounts()public view returns(address[] memory) {
        return userAccounts;
    }

    function getInfo(address _address) view public returns (uint, string memory, string memory) {
        return (user_mapping[_address].time, user_mapping[_address].location, user_mapping[_address].position);
    }

    function countInfo() view public returns (uint) {
        return userAccounts.length;
    }

}


texts: Generate rich list (Top Ethereum holders) using Geth/Web3

texts: I'm wondering if it's possible to generate a list of the top Ethereum holders, of the Public Ethereum MainNet, using Geth or Web3, but I'm not sure this is even feasible. Is there a way to do it? Can we interface with the database directly? Do we have to make a specialized script iterating through each block and comparing the inputs minus outputs?


texts: eth.sendTransaction from eth.coinbase makes multiple transactions and decrease the eth.coinbase balance

texts:
Im working on a distributed application using Ethereum, the go-ethereum implementation (Geth).

On a Digital Ocean droplet (Ubuntu 16.04) i have installed geth.

I have created a structure like this:

devnet$ tree -L 2
.
├── accounts.txt
├── boot.key
├── genesis.json
├── node1
│   ├── geth
│   ├── keystore
│   └── password.txt

I have:

One bootnode/discovery node
One Seal/full node

The seal node is initialized this way:

geth --datadir node1/ init genesis.json

Then the bootnode:

devnet$ bootnode -nodekey boot.key -verbosity 9 -addr :30310
INFO [02-07|22:44:09] UDP listener up                          self=enode://3ec4fef2d726c2c01f16f0a0030f15dd5a81e274067af2b2157cafbf76aa79fa9c0be52c6664e80cc5b08162ede53279bd70ee10d024fe86613b0b09e1106c40@[::]:30310

And after the bootnode is listening, i run geth on the node1:

geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr 'localhost' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://3ec4fef2d726c2c01f16f0a0030f15dd5a81e274067af2b2157cafbf76aa79fa9c0be52c6664e80cc5b08162ede53279bd70ee10d024fe86613b0b09e1106c40@127.0.0.1:30310' --networkid 1515 --gasprice '1' -unlock '0x87366ef81db496edd0ea2055ca605e8686eec1e6' --password node1/password.txt --mine

Note: this are examples, the real ip, bootnode "enode" value and account arent those.

On this private ethereum network i have deployed a ERC20 contract, with a basic Transfer function, so, i wanted to invoke that function from Metamask, using some random address.

For that, i needed to get some ETH in my account, so i have connected to the geth console and transfer some ether from the eth.coinbase to that addres:

eth.sendTransaction({from:eth.coinbase, to:"0xf17f52151ebef6c7334fad080c5704d77216b732", value: web3.toWei(10, "ether")})

After that, I discovered that some transactions that I had no way to identify,  i mean, it was only a transaction to send ether from one account to another, why that result in multiple transactions submitted?

Here is a screenshot of the situation:

Also, every one of those transactions is decreasing the eth.coinbase balance (eth.coinbase == the address that deploys the contract), so i started with a huge amount of Ether on that account and after some of those "ghost" transactions the balance of eth.coinbase was like 0.0026 Ether..

So, i have 2 questions

Is there any scenario that could decrease the contract owner address/coinbase balance?
Any ideas of why those transactions appear?

EDIT:

Caused by bots:


texts: Getting undefined transactions with web3.js

texts:
I use the following script to monitor pending transactions for a certain account:
const sub = web3.eth.subscribe('pendingTransactions', (err, res) => {
    if (err) console.error(err)
})

sub.on('data', async (hash) => {
    try {
        let tx = await web3.eth.getTransaction(hash)

        if (tx.to.toLowerCase() === account) {
            console.log({ address: tx.from, value: web3.utils.fromWei(tx.value, 'ether'), timestamp: new Date() })
        }

    } catch (err) {
        console.error(err)
    }
})

I'm connected to my local geth node over websockets. I expect this to just log all transactions, but a lot of times I get a null transaction:
TypeError: Cannot read property 'to' of null
    at Subscription.<anonymous> (.../index.js:18:16)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Does anybody know why this is? I want to be able to check ALL transactions.


texts: Transfer function not working in basic deposit and withdraw contract

texts:
I have this simple contract used with remix.

pragma solidity^0.4.24;

contract test{
    mapping (address => uint) balances;
    function Deposit() public payable{
        balances[msg.sender] += msg.value;
    }
    function Withdraw() public{
        msg.sender.transfer(balances[msg.sender]);
        balances[msg.sender] = 0;
    }
    function CheckBalance() view public returns(uint){
        return balances[msg.sender];
    }
}

I can send the payable amount through remix, and the balance shows accordingly. The transaction will also show the correct value in wei. But withdrawing will result in a transaction of 0 wei.

The balance is deducted in the contract, but no transfer has occured to the msg.sender.

Thanks for help!


texts: Nethereum: CallAsync return a wrong msg.sender

texts:
I write this simple contract:

contract greeter {
    event LogSender(address sender);
    function getSender() constant returns (address) {
       LogSender(msg.sender);
       return msg.sender;
   }
}

Web Env [OK]

Google Chrome with MetaMask Plugin
Remix for Compile, Deploy and Run My contract
Geth client in private test network

I choose account in MetaMask, call the function getSender() and it return the right value (the selected address in MetaMask)

C# Env (Nethereum) [WRONG]

Windows Form app with included Nethereum Portable Lib
Geth client in private test network

try
{
    Web3 web3 = new Web3(new ManagedAccount(txtAddress.Text, txtPassword.Text), "http://localhost:8545");

    GreeterService gs = new GreeterService(web3, txtContractAddress.Text);

    var res = await gs.GetSenderAsyncCall();

    txtLog.AppendText("getSender: " + res + "\n");
}
catch(Exception ex)
{
    txtLog.AppendText(ex.Message + "\n");
}

When I call the function with C#, res => first address of geth accounts! The address used for create an instance of ManagedAccount is not recognized!

Please give me support guys!!!


texts: During gas-free transaction get an error "No relay responded! 4 attempted, 4 pinged"

texts:
I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless

However, when I'm trying to write some tests
it fails and provides me the following error

     Error: No relay responded! 4 attempted, 4 pinged
      at RelayClient.relayTransaction (node_modules/tabookey-gasless/src/js/relayclient/relayclient.js:264:15)
      at processTicksAndRejections (internal/process/next_tick.js:81:5)

the logs are

relayTransaction: req: from:0xc.....
to:0x8f.....
encodedFunctionCall:0xa9059cbb0000000000000000000000000949d494a5ca5afdbd2881d58b3804d9382a48db0000000000000000000000000000000000000000000000000000000000000064
gasPrice:2000000000
gasLimit:65000
nonce:0
relayhub:0x1349584869A1C7b8dc8AE0e93D8c15F5BB3B4B87
relayAddress:0x5b747ee070f18463e86ef08485e5115d82b675b9
relayTransaction: [object Object]
One batch of relays failed, last error:  No response matched filter from any server: [object Object]

Here is an implemented code:

    var tabookey = require('tabookey-gasless');
    var provider = new tabookey.RelayProvider(web3.currentProvider, {});

    it("test transfer gas free", async function() {

        web3.setProvider(provider);

        let initBalance = await web3.eth.getBalance(account_one)

        let tokenTestAddress = "0x8......."
        let tokenTestRelay = await new web3.eth.Contract(Token._json.abi, tokenTestAddress);
        let result = await tokenTestRelay.methods.transfer(account_two, 100).send({ from: account_one, gasPrice: 2000000000, gasLimit: 65000});
    });

I use Ropsten network for tests relayHub is 0x1349584869A1C7b8dc8AE0e93D8c15F5BB3B4B87

I sent funds for one of the relay addressed, however, this does not help.


texts:
I have a rpi 3 where I wrote a script in JS( a socket),which takes data from a python script.
So I have this var “data”(which is an array of string) in JS and I want to save it in ethereum blockchain.
I know I need web3.js library to interface with ethereum node and I’ve already installed npm and node.js
So my question is…how I pass the value contained in “data” in a smart contract,which stored them?

Further information: Till now I am using testRPC as test network and Truffle to try a contract.

This is the JS socket


texts: which nodes have evms and how do they compare the results?

texts: which nodes have ethereum vm? I have read that nodes with evms run the transactions and check if they all got the same result. How do they sync and compare their results?


texts:
Well, I have a smart contract called Register. The test script is quite straightforward:

const Register = artifacts.require("Register")

contract('Register', (accounts) =>  {
    let register;

    beforeEach('create new Register contract', async () => {
        register = await Register.new("test", 0, {from: accounts[0]});
    })

    it("test register enntity", async () => {
        register.entity().then(entity => {
            assert.equal(entity, accounts[0], "Entity is wrong!");
        })
    })
})

If I create 2_migrate_contracts.js in folder migrations with content:

var Register = artifacts.require("./Register.sol");

module.exports = function(deployer) {
  deployer.deploy(Register, "tesst", 0);
};

then the truffle test process finish with no error.

As far as I know, the test script creates a new Register contract, which should be irrelevant with the migrated contract. So if I comment out the 2_migrate_contracts.js file and let the test script do all the jobs. However, I got this error:

"before all" hook: prepare suite:
 Uncaught Error: Attempting to run transaction which calls a contract function, but recipient address 0x4f94fdfc235abc73a163bff1ba9341f6226ff6bd is not a contract address.

I tried to delete the ./build folder. No help.

So I am confused. Does truffle test have to begin with a migration process? i.e., I can not skip the migration process and created new contract in test script only?

Thanks in advance.

=================== UPDATE ======================

I just take a step forward. In my project, actually, there is another contract named Authorization, and accordingly, there is another test file named TestAuthorization. Now if I run the test file by file such as:

truffle test ./test/TestRegister

Then the test will be fine. But if I run all the test together using truffle test. Then the 'recipient address is not a contract address' error shows again.

According to the Josesph's reply, it is said When running your tests against Ganache or Truffle Develop, Truffle will use advanced snapshotting features to ensure your test files don't share state with each other. Now the question is: how can I run multiple test with truffle test?


texts:
I have a non-upgradeable contract that gives an EOA the non-revokable permission to pause certain actions in the contract. I inherited from OpenZeppelin's PausableRole.sol but I removed the "renouncePauser" function.
My question: is there any way to effectively "burn" the EOA? That is, to get it into a state in which it  can't send txs anymore, or at least can't send txs to this specific contract.
I know that this is probably impossible, but I thought to ask the question anyways. Maybe it is possible to use CREATE2 and mine a contract at the exact specific address, which doesn't have the ability to ping the pausable contract?


texts: How can I retrieve the transaction hash / block hash of a contract that has already been deployed?

texts:
If you use Web3.py to deploy a Solidity contract to the blockchain, you can retrieve a transaction hash, like this:

tx_hash = w3.eth.sendRawTransaction(signed.rawTransaction)

Once you have that tx_hash, you can retrieve a transaction receipt, like this:

tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)

However, I haven't been able to find a straightforward way to retrieve that information for a contract that I didn't deploy (or that I deployed at some point in the past and didn't record).

Couple of notes:

There could be multiple transactions across multiple blocks for that contract.
I'm looking for a solution using Web3 -- I'd prefer not to traverse the entire blockchain or go to Etherscan and look up the information.

I would like to get an array of either:

all the block numbers that contain a transaction for a given contract
all the transaction receipts for a given contract

after the contract has been deployed.  Is that possible?

For example, let's imagine that I wanted to find all of the transaction receipts for a smart contract deployed on the Ropsten test network.

Let's use the helloWorld contract deployed at this address: 0xb1Afb360F9ba99883166236a4b2DdAa9e3ff397a

This contract has been verified on Etherscan, so its ABI is available.  You can see it on Etherscan here: https://ropsten.etherscan.io/address/0xb1afb360f9ba99883166236a4b2ddaa9e3ff397a#code

The following Python code will allow you to instantiate the contract, and call functions defined in the ABI:

abi = '''
[{"constant":false,"inputs":[{"name":"_wordsToSay","type":"string"}],"name":"sayAnything","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"sayHello","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
'''

contract_address = "0xb1Afb360F9ba99883166236a4b2DdAa9e3ff397a"
contract = w3.eth.contract(address=contract_address, abi=abi)

pprint.pprint(contract.functions.sayHello().call())

The only other attributes I have been able to retrieve are the address and the ABI.

Is there any way to retrieve the block numbers or transaction hashes for an already deployed contract?


texts: how can ethereum addresses are same between different networks (testnet & Main)?

texts:
I found, Wallet address are remain interchangeable if i switched between the different networks(Main Network , Ropsen Network & Rinkeby Network)

is it assigned to particular machine IP, if not then how can process identified between testnetwork or main metwork ??

how addresses are work internally in blockchain?

Currently, I am using Metamask wallet for the same.

Please help us to get rid of this confusion, share the links for the same which you find more effective for me.


texts: Should I avoid CLI geth and Ethereum-Wallet both using the same data dir

texts:
I've been running Ethereum-Wallet as my wallet on OSX for a while, and it's fine. It's using /Users/myname/Library/Ethereum as it's data dir.

I've just installed geth via homebrew with a view to trying out some CPU mining (on the real network, not the testnet).

It, too, appears to be using /Users/myname/Library/Ethereum as its data dir, yet still needed to download the blockchain on first use.

I am planning to use a new account to mine to, rather than mine into my main etherbase account.

[Update: it appears that geth has found the same account as Ethereum-Wallet, which makes sense if it's the same data dir. So, if I make a new account for mining, that should work - I think.]

Is there a risk I'll kill my wallet? What am I not getting here?


texts: Consuming require() errors in web3.js client

texts:
Using require helps in validating user inputs before an action can be taken. However, it seems not many options exist to handle the scenario when require indeed returns false. The example mentioned in this answer uses Events that are fired after testing an if condition. This answer bluntly says that it is not possible to handle revert (even though the question was about require) from the front-end.

So, is it possible to consume a require false outcome at all? Or, can it be piped into an Event that can be consumed in a web3.js client?


texts: Every transaction that modifies blockchain state costs gas. However, I have a doubt and would like to ask. Does it cost gas when sending ether from a contract to an address? If it does, how to implement deposit/withdraw scenario? After a user deposits some ethers to the contract, he/she likely would not withdraw the same amount of ethers because he/she needs to pay the transaction fee. So, how deposit/withdraw works anyway?


texts: Why contract function return null decoded output in private network?

texts:
I am trying to update contract variable value and return value in the same function, It will return value if I deploy it on JavaScript VM but it returns null when I deploy contract on private network.

JavaScript VM:

    Private Network:

Am I doing something wrong on my Private Network Setup ? What else could be the possible issue as everything else is entirely the same.


texts: Attempting to transfer erc20 token, but keep encountering insufficient funds for gas * price + value

texts:
I'm attempting to transfer an erc20 token, but keep running into insufficiant funds for gas * price + value, regardles of how much eth I have, I also have an estimate function which returns a value thats several times lower than what I have in eth.
I'm using Infura.
My ETH balance is:
79475000000000000 (0,079475)

Here's my estimate output:
2020-08-31 14:49:26,036 INFO  [EthResource] (vert.x-worker-thread-1) ########## Entering doTokenEstimateTransactionFee...
2020-08-31 14:49:26,513 INFO  [Web3jService] (vert.x-worker-thread-1) >>>>>>>>>> (Token tx) DefaultGasProvider.GAS_LIMIT = 4300000
2020-08-31 14:49:26,673 INFO  [Web3jService] (vert.x-worker-thread-1) >>>>>>>>>> (Token tx) ethEstimateGas.amountUsed = 21584
2020-08-31 14:49:26,674 INFO  [Web3jService] (vert.x-worker-thread-1) >>>>>>>>>> (Token tx) ethGasPrice.gasPrice = 217000000000
2020-08-31 14:49:26,674 INFO  [Web3jService] (vert.x-worker-thread-1) >>>>>>>>>> (Token tx) estimated tx fee = 4683728000000000
2020-08-31 14:49:26,674 INFO  [EthResource] (vert.x-worker-thread-1) ########## (success) Leaving doTokenEstimateTransactionFee...

So the fee should be 0,004683728, which is less than my balance.
Here's my code:
@Synchronized
fun TokenTransferFrom(TokenTransferFromDto: TokenTransferFromDto): ResultDto {
    return try {
        val sourceCredentials: Credentials = Util.generateCredentialsBip32(TokenTransferFromDto.sourceMnemonic)
        return if (TokenTransferFromDto.sourcePrivateKey == sourceCredentials.ecKeyPair.privateKey.toString(16)) {
            val fastRawTransactionManager = FastRawTransactionManager(web3j, sourceCredentials, NoOpProcessor(web3j))
            // Load contract by source
            val TokenSource = load(infuraTokenContractAddress, web3j, fastRawTransactionManager, DefaultGasProvider())
            val transactionReceipt = TokenSource.transfer(TokenTransferFromDto.destination, TokenTransferFromDto.amount).send()
            if (!transactionReceipt.isStatusOK) {
                return wrapError("transactionReceipt.isStatusOK false", transactionReceipt.status)
            }
            logger.info(">>>>>>>>>> TokenTransferFrom txHash = ${transactionReceipt.transactionHash}")
            ResultDto("success", null, "", transactionReceipt.transactionHash, null, null, null)
        } else {
            wrapError("", "Invalid mnemonic or private key")
        }
    } catch (e: Exception) {
        logger.error(">>>>>>>>>> EXCEPTION: ${e.message}")
        wrapError("", e.message.toString())
    }
}

Can someone tell me what I have to change to be able to specify my own GAS_LIMIT as I'm stumped?
Here's the error that I endlessly keep encountering:
2020-08-31 14:54:34,787 ERROR [Web3jService] (vert.x-worker-thread-4) >>>>>>>>>> EXCEPTION: Error processing transaction request: insufficient funds for gas * price + value

I'm completely new to kotlin, java, so sorry if I'm dumb. Thanks.


texts: Is there a plan / EIP for native multi-signature transactions?

texts:
We have a 2-of-3 multi-signature wallet contract which works fine. However, when sending to exchanges or wallets which use RPC calls (rather than contract events) to capture incoming transactions, they do not see ours (see this for why).

It seems reasonable and useful to have native multi-signature addresses which can initiate transactions and be treated as first-class senders in transaction objects.

Does anyone know of a plan to add this feature in an upcoming protocol update, or an EIP on which to discuss it?


texts:
I need your help to write a smart contract to the best way and avoid an attack.

I have a function that user can call to buy Service and update the state.
Now, I am confused, it will be different if I change the state before or after the user transferring tokens with the function transferFrom.

For example:

 function buyService(uint256 IDService,address ServiceUser,uint256 costService) public  {
    Status storage s=StatusUsers[IDService][ServiceUser];
    require(s.state == StateService.Init);
    token.transferFrom(ServiceUser,owner,costService);
    s.state=StateService.Paid;
    s.cost=costService;
    emit Paid();
}


texts: How to create a git repository on swarm?

texts:
I'm running geth --testnet on ropsten testnet and attached a swarm node to it. Now I should be able to use mango to host my git repositories on swarm. I installed mango-admin and git-remote-mango nodejs modules.

However, here the documentation somehow stops with specifics. It suggests to run mango-admin create to initialize a repository. But I somehow suspect it defaults to IPFS. And I can not find out how to tell mango to use Swarm instead.

Also, creating a default repository does not work either:

 $ mango-admin create
Initialising...
/usr/lib/node_modules/mango-admin/node_modules/web3/lib/web3/httpprovider.js:87
        throw errors.InvalidResponse(request.responseText);
        ^

Error: Invalid JSON RPC response: undefined
    at Object.InvalidResponse (/usr/lib/node_modules/mango-admin/node_modules/web3/lib/web3/errors.js:35:16)
    at HttpProvider.send (/usr/lib/node_modules/mango-admin/node_modules/web3/lib/web3/httpprovider.js:87:22)
    at RequestManager.send (/usr/lib/node_modules/mango-admin/node_modules/web3/lib/web3/requestmanager.js:58:32)
    at Eth.get [as coinbase] (/usr/lib/node_modules/mango-admin/node_modules/web3/lib/web3/property.js:107:62)
    at Object.<anonymous> (/usr/lib/node_modules/mango-admin/mango-admin:69:37)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

How to create a git repository on swarm with mango?


texts: Should I use different sender addresses for multiple transactions in same block?

texts:
I am designing an off-chain service that handles requests and posts a transaction to the blockchain when each request is complete. During the time interval of a single block, the service may handle many requests for many users. The completion transactions are functionally independent of each other and the order in which they are executed doesn't matter. I want to reliably post each transaction without worrying about interactions that might cause failures.

In Multiple transactions from same address, Paul S writes:

  If you have transaction dependencies in your off-blockchain application you should wait until the prior transaction has been mined before submitting the next transaction.

I don't have functional transaction dependencies, but still: As an example of the sort of problem I would like to avoid, suppose I simultaneously send N transactions from the same address, correctly incrementing the nonce for each. If all of these transactions are to be included in the same block, the miner must ensure that they occur in increasing-nonce order to compose a valid block. Or if only a subset of K<N transactions is included, the subset must be the first K transactions, again in order. Given the way pending transactions are probabilistically relayed throughout the network, I am concerned that a burst of transactions from the same address may not be reliably mined into a block.

Is the best approach to use a different sender address for each transaction?

That seems to solve the transaction pool and nonce issue, but complicates other aspects of the dapp, such as private key management and sender address whitelists in contracts.


texts: What is pendingtotal and nicependingtotal in cpp-ethereum?

texts:
If I enter > web3.admin.eth.allAccounts() in my eth client I get the following answer after it lists my accounts:

  },
  nicependingtotal: '21.173 ether',
  nicetotal: '16.168 ether',
  pendingtotal: '0x125d7efa42fd28720',
  total: '0xe060fa8c05ea2720'
}

I interpret it as if I had 5 that should be 'credited', is that correct?
How can I find more info about these?

edit : 3 days later, having done no transactions, the pending disappeared, really weird


texts: Too low nonce error with web3j and rinkeby

texts:
All of sudden my application on testnet has stopped working due to low nonce error. No change in source code. My app connects to the network via infura. Any ideas what could be wrong here.

java.lang.RuntimeException: Error processing transaction request: nonce too low
57879         at org.web3j.tx.TransactionManager.processResponse(TransactionManager.java:67) ~[core-3.3.1.jar!/:na]
57880         at org.web3j.tx.TransactionManager.executeTransaction(TransactionManager.java:51) ~[core-3.3.1.jar!/:na]
57881         at org.web3j.tx.ManagedTransaction.send(ManagedTransaction.java:83) ~[core-3.3.1.jar!/:na]
57882         at org.web3j.tx.Transfer.send(Transfer.java:65) ~[core-3.3.1.jar!/:na]
57883         at org.web3j.tx.Transfer.lambda$sendFunds$2(Transfer.java:97) ~[core-3.3.1.jar!/:na]
57884         at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:30) ~[core-3.3.1.jar!/:na]
57885         at bitmovio.service.blockchain.manager.WalletManager.makeExternalPaymentForRecurringWithdrawl(WalletManager.java:1331) [classes!/:1.0-SNAPSHOT]
57886         at bitmovio.service.blockchain.manager.WalletManager.settleMonthlyRecurringWithdrawl(WalletManager.java:1162) [classes!/:1.0-SNAPSHOT]
57887         at bitmovio.service.blockchain.manager.WalletManager$$FastClassBySpringCGLIB$$76b35353.invoke(<generated>) [classes!/:1.0-SNAPSHOT]
57888         at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
57889         at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746) [spring-aop-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
57890         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]
57891         at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport


texts: Can anyone explain what is the main purpose of events in solidity and when to use it?

texts:
pragma solidity ^0.4.24;

contract assignment2{

  event ageread(address,int);
  function getage(address peridentifier) public returns(uint){
    human = mystruct("adam",10); //using struct mystruct
    ageread(peridentifier,stateintvariable); //stateintvariable is age
  }
}


texts: Generate wallet public and private key using web3 PHP

texts:
I am using this to get public key:

https://github.com/sc0Vu/web3.php#assign-value-to-outside-scopefrom-callback-scope-to-outside-scope

I am in need of to get the public and private key using PHP web3 like this:

https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#create

How can I do that?


texts: Gas deduction on contract creation inside a contract

texts:
I want to create a Contract (TokenTimelock from Open Zeppelin) inside of a registry contract.
It seems as if my contract needs gas to do this.
So I am wondering about using delegate call because I want the caller to pay for the gas, or I need to store ETH in my resgistry contract which I do not really want to do.

Am I correct that if a Contract is creating another contract that it is the one that will need to pay gas?


texts: Difference between .sign and .signTransaction

texts:
I have this two kind of codes and I would like to know what is the difference between them:

First. .sign()

var tx = new Tx(rawtx);
tx.sign(privateKey);

Second .signTransaction()

web3.eth.accounts.signTransaction(tx, privateKey)

When should be used each of them?


texts: How to generate Ethereum wallets & keys on serverside with JS?

texts: Anybody knows, how can ether wallets be generated on serverside (node.js). It's needed for service, to create a new wallets for new customers. Maybe something like bitcoinJS-lib but for ethereum? But can't find with my own, please help :)


texts: Error while catching returned value from contract

texts:
I am trying to set a string and receive it back from my contract.

This is my code

    import web3
import json

from web3 import Web3
def main():
    w3 = Web3(Web3.HTTPProvider("http://localhost:8545"))
    w3.eth.defaultAccount = w3.eth.accounts[0]
    print(w3.eth.defaultAccount)
    with open('abi', 'r') as abi_definition:
        abi = json.load(abi_definition)
    contract = w3.eth.contract(address=w3.toChecksumAddress('0x82A978B3f5962A5b0957d9ee9eEf472EE55B42F1'),abi=abi)
    contract.constructor().transact()
    contract.functions.storeID('yes').call()
    get = contract.functions.getID().call()
    print(get)

if __name__ == '__main__':
    main()

I am getting following error

Traceback (most recent call last):
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/web3/contract.py", line 1214, in call_contract_function
    output_data = decode_abi(output_types, return_data)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/abi.py", line 63, in decode_abi
    return decoder(stream)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/decoding.py", line 99, in __call__
    return self.decode(stream)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_utils/functional.py", line 22, in inner
    return callback(fn(*args, **kwargs))
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/decoding.py", line 135, in decode
    yield HeadTailDecoder.as_decoder(tail_decoder=decoder)(stream)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/decoding.py", line 99, in __call__
    return self.decode(stream)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/decoding.py", line 113, in decode
    start_pos = decode_uint_256(stream)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/decoding.py", line 99, in __call__
    return self.decode(stream)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/decoding.py", line 162, in decode
    raw_data = cls.read_data_from_stream(stream)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/eth_abi/decoding.py", line 244, in read_data_from_stream
    len(data),
eth_abi.exceptions.InsufficientDataBytes: Tried to read 32 bytes.  Only got 0 bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/sapan/PycharmProjects/GlobalCA/Node.py", line 18, in <module>
    main()
  File "/home/sapan/PycharmProjects/GlobalCA/Node.py", line 14, in main
    get = contract.functions.getID().call()
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/web3/contract.py", line 979, in call
    **self.kwargs)
  File "/home/sapan/PycharmProjects/GlobalCA/venv/lib/python3.5/site-packages/web3/contract.py", line 1236, in call_contract_function
    raise BadFunctionCallOutput(msg) from e
web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced?


texts:
So I did this simple greeter smart contact (tutorial here: https://www.ziggify.com/blog/blockchain-stack-1-installing-ethereum-geth-smart-contract/)

Very simple. Just a greeter.greet() and it returns hello world.

It works when I first did it. But then I logged in today and it no longer works saying greeter is not defined.

Why would my smart contract disappear? Why cant I use greeter anymore? I know its on the blockchain because it shows up on https://ropsten.etherscan.io

Any thoughts?


texts:
my geth (geth-windows-amd64-1.5.5-ff07d548) is taking too long to sync. It has been two days and it is still not fully synced. Still missing about 600 000 blocks.
Ports are opened (TCP 30303, UDP 30301), using geth.exe --cache=512 --datadir G:\Wallet\data\ and my internet connection is 6MB/s.
The G: drive is internal western digital black 2TB.
Windows 10
Edit: 1 block sync takes about 12min. (600 000x12=years)


texts:
The setup of the contracts has 3 contracts: a library contract, a Controller contract with modifiers and a main contract as follows:

DataSet.sol

library DataSet {

  struct IndexValue { uint keyIndex; uint256 value;}
  struct KeyFlag { uint key; bool deleted; }
  struct KeyValue { uint key; uint value; }

  struct Data {
      mapping(uint => IndexValue) data;
      KeyFlag[] keys;
      //KeyValue[] kvpairs;
      uint size;
  }

  function stringToBytes32(string memory source) returns (bytes32 result) {
      assembly {
          result := mload(add(source, 32))
      }
  }

  function getCurrent(Data storage self) returns(uint index){
      return self.size - 1;
  }

}

Controlled.sol:

contract Controlled {
    address public userAddr;

    struct User {
      address a;
      string name;
      string email;
      uint phone;
    }

    mapping (address => User) Users;

    function registerUser(string _name, string _email, uint _phone) returns (bool success) {
      Users[msg.sender].a = msg.sender;
      Users[msg.sender].name = _name;
      Users[msg.sender].email = _email;
      Users[msg.sender].phone = _phone;
    }

    modifier onlyUser {
        if (msg.sender != userAddr) throw;
        _;
    }

}

contract Main is Controlled {
  using DataSet for *;
  DataSet.Data d;

  struct userProduct {
    address user_address;
    uint id;
    string description;
    uint price;
  }

   userProduct[] products;

  function newUserProduct  (
    address u,
    uint i,
    string d,
    uint p) onlyUser returns (bool added) {

    userProduct memory newProduct;
    newProduct.user_address = msg.sender;
    newProduct.id = i;
    newProduct.description = d;
    newProduct.price = p;
    products.push(newProduct);
    added = true;
  }

  function getUserInfo (uint g) constant returns (address ,bytes32, uint ) {
      for (uint i = 0; i <= products.length; i++) {
          if (products[i].id == g) {
             return(products[i].user_address, DataSet.stringToBytes32(products[i].description), products[i].price);
          }
      }
  }
}

Registering the user by invoking Controlled.registerUser works fine after which associating a product to the user by invoking Main.newUserProduct also works fine to give a tx_id. However, when I try to call getUserInfo, I either get an invalid jump error while using embark and returns [0x, 0x, 0x] while using truffle. I am unable to resolve the issue whether it is the case of the modifier or if the library is not correctly being instantiated. Any suggestions would be immensely helpful!


texts: Remix error : Function declared as view but this potentially modifies state

texts:
This code is inside a view function and gives the error : Function declared as view but this potentially modifies state.

if ( auction.iS == false){      //check if such auction exists
emit NoSuchAuction(msg.sender, _auctionName);
return; }

NoSuchAuction() is an event.
_auctionName is a string.
auction is a structure and iS is a boolean.


texts:
I found an ERC20Basic interface floating around which closer matches what I wanted to implement for a token as I'd prefer to not have support for approve and transferFrom. What are the implications of implementing https://github.com/ethereum/EIPs/issues/179 instead of the standard ERC20 interface?

Consider:

How it shows up in Etherscan and others explorers and tools.
Issues with exchanges?
Any good reasons for that functionality that I haven't thought of?

Also, if I have all of the functions from the ERC20 interface and just put revert() for the allowance-related ones, am I gaining anything over just not having them there at all?

I figure this question is complicated because it depends on how the most popular users of the Ethereum block chain are programmed. For instance, I would want to play nice with Etherscan to have everything showing up correctly and also not be turned down by exchanges for a preventable technical reason.


texts: Is it possible to make approve and transferfrom in single transaction?

texts:
I know that owner should call approve in advance then allowed spender call transferfrom to make transaction. We need two steps(tx).
Iam curious is it possible to make it by single tx! single step.


texts: Where to define the MetaMask window.ethereum.on Listener

texts:
I have tried to include the window.ethereum.on listener to detect account changes in MetaMask, in my mounted () {} method. When the listener is triggered, it itself triggers the location.reload() method.
When including this listener and location.reload() method in my mounted () {} method, it is triggered in an infinite loop, the location.reload() method being infinitely re-triggered at every reload. However, if I include the listener outside the mounted method, it is never called. Where should the listener be defined?
 mounted () {
   ...
   window.ethereum.on('accountsChanged', function (accounts) {
     ...
     window.location.reload(true)
   })
 }

Thank you. J


texts: What are the differences between Ethereum Sharding Proposal and Plasma? I know plasma can run on top of sharding, but what are the differences innterms of paradigm and technology?


texts:
As stated in the docs:

  [...] Up to three parameters can receive the attribute indexed which will
  cause the respective arguments to be treated as log topics instead of
  data. The hash of the signature of the event is always one of the
  topics. All non-indexed arguments will be stored in the data part of
  the log.

What are the possible use cases of having event arguments as log topics?


texts: Uncaught Error: Error: Number can only safely store up to 53 bits

texts:
I am trying to execute a transaction on the blockchain by adding an item to a mapping with the following Javascript code. Keep in mind that it is executed from Polymer.

var id = Math.random().toString(36).substr(2, 10);
var receiver = this.assetOwner;
console.log(this.assetsBlockchain);
var asset = this.assetsBlockchain[0].address;
var start = this.web3.toBigNumber(1000).dividedBy(1000).plus(3600);
var end = this.web3.toBigNumber(1000).dividedBy(1000).plus(10800);

var factory = this.web3.eth.contract(this.rentalRequestFactoryABI.abi).at(this.rentalRequestFactoryAddress);
var tx = factory.createRentalRequest(id, receiver, asset, start, end, {
    from: this.mobilist,
    gas: this.web3.toWei(0.5, "ether")
});
console.log(tx);

The createRentalRequest function in the smart contract is as follows:

function createRentalRequest(bytes32 _id, address _receiver, address _asset, uint _start, uint _end) returns (bool) {
    RentalRequest memory request;

    request.receiver = _receiver;
    request.asset = _asset;
    request.start = _start;
    request.end = _end;
    request.accepted = false;
    request.rejected = false;

    requests[_id] = request;
    Notify(msg.sender, _receiver, _asset);
    return true;
}

A solution which I am going to try is to accept the uints as byte arrays and converting them to uint. Is there any reason why the error mentioned in the title appears though?


texts: How to track incoming to smart contract transactions using web3js?

texts:
I've got one Ethereum smart contract which calls functions of the other one. How could I track these calls using web3js or some other tool if it is possible at all? I need it because I want to execute some JavaScript (or other non-solidity language) code after receiving such call and then call other function of first smart contract so the sequence of calls should be following:

Smart contract N1 calls N2 smart contract function.
JavaScript (or other non-solidity language) code catches this call and execute some code.
Smart contract N2 calls back N1 using data from previous step.

Could anybody help with it?


texts: How to get address of contract from inside the contract?

texts:
contract FooContract{

    address myAddress = ??
}

How to get the address of a contract from inside (the contract itself)?


texts: Security measures to overcome 51% attack

texts:
I was reading During a 51% attack, What Can the Attacker Actually Accomplish?

from there, i understand the after-effects are something serious, so what are the security measures which ethereum have and what if all they fail?


texts: How does Etherscan.io figure out constructor arguments without contract verification

texts:
Recently, I've seen that Etherscan is able to automatically figure out passed constructor arguments.
how were they able to figure it out?


texts: Remix: Contract exceeds gaslimit even tho blocks have a high enough gas limit


texts:
I want the blocktime to be the same as in the genesis-block, currently the longer the chain becomes the longer the wait time is.

So far I found the following resolution:
fast blocktime in private net

However when I check the file in the go-ethereum repository under:
https://github.com/ethereum/go-ethereum/blob/master/core/block_validator.go

Then I don't see the difficulty being set. Where can I change the function so that the difficulty remains the same as in the genesis block? How do I make sure this change works on all my nodes? Does the hash-value of the files needs to be the same or how does the system know the nodes are the same?


texts: Is it dangerous to publish the enode address?

texts:
Someone mailed me and asked about my supernode ip / enode address. From go ethereum gitter:

Hello all. I'm running a little over 100MH/s doing solo mining. Atm, we have a very high uncle rate, probably because I haven't altered the bootnodes or default max peers. If I wanted to find nodes across the US/EU to add to the bootnode list, where would I do that?
I can't seem to find the addresses for the supernodes listed on ethstats.

Is it dangerous to share the enode address of my supernode?


texts: GUI Ethereum just closes and does not import presale JSON wallet

texts:
When I try to import presale JSON wallet using the Ethereum GUI just closes (Kind of crashes) and does not import, has anyone seen this?

It appears the password is good I have checked the eth address and it shows the amount of ether I expect.

So I can't import my presale ethereum seed wallet. Has anyone fixed it and how to continue?


texts:
Get a users/contracts pending transactions?
I'm trying to get a users/contracts pending transactions so that when the Dapp is refreshed (or a new window is opened), any 'Pending' UI elements can know if that this User has a pending transaction for Dapp (contract).
I'm using ethers.js as a library.


texts: Can i use a the msg.sender which is a address to call a function of the contract?

texts:
I am trying to mint a ERC721 token using openzeppilin/contracts. It was working correctly, but later had to change the design. So now i am forced to use the msg.sender who is the minter to call the mint fuction.

I was trying to use msg.sender to call the mint function of a contract, will it work?

msg.sender.call.gas(1000000).value(1 ether)(abi.encodeWithSignature("mint(address,uint256)",to,tokenId));

It does execute with out any errors, but i cannot get the Transfer event.So i am sure it was never minted.


texts: Changing blockchain storage location in official wallet?

texts:
I'm aware that geth can take an option to change the location, as described here:
Possible to store the blockchain in a different directory?

But what about the graphical Ethereum Wallet? There doesn't seem to be a config file anywhere. (I'm on Linux.)

My home directory is a flash drive and I have a larger disk drive for bulk storage, so changing would be nice.

If there's also a way to change the place keys are stored, that'd be cool too, since secure delete works better on disks than on flash.


texts:
pragma solidity >=0.4.22 <0.7.0;
contract D {
  uint public n;
  address public sender;

  function delegatecallSetN(address _e, uint _n) public {
    _e.delegatecall(abi.encode(bytes4(keccak256("setN(uint256)")), _n));
  }
}

contract E {
  uint public n;
  address public sender;
  uint test = 10;

  function setN(uint256 _n) public {
    n = _n;
    sender = msg.sender;
  }
}

Question 1:
I have this contract. Now, when I call a delegatecallSetN from remix with the address of E, it successfully calls E contract's setN function.  as we know how delegatecall works, it sets my passed _n value on D contract. Now, what about sender value on D contract ? It still is 0x000000...000 . Why doesn't it set msg.sender on it ?

Question 2:
Let's say in contract E's setN function, I add test = 50. As we know, the code of setN will be executed in the context of Contract D which doesn't have test variable at all. Why doesn't it result in exception or error at all and why does the transaction still succeed ?
UPDATED CODE:

pragma solidity >=0.4.22 <0.7.0;

contract D {
  uint public n;
  address public sender;

  function delegatecallSetN(address _e, uint _n) public {
    _e.delegatecall(abi.encodeWithSignature("setN(uint256)", _n));
  }

}

contract E {
  uint public n;
  uint public test;
  address public sender;

  function setN(uint256 _n) public {
    n = _n;
    sender = msg.sender;
    test = 20;
  }
}


texts: How to call a delegate function from web3js

texts:
I am trying to call a delegate function from web3 but, everytime its saying its not

var myContract = new web3.eth.Contract(abi,add);
myContract.methods.enterMarkets(['cadd']).send({from:ethereum.selectedAddress});

error

Uncaught TypeError: myContract.methods.enterMarkets is not a function at <anonymous>:1:16

0xe7bc397DBd069fC7d0109C0636d06888bb50668c this is the smart contract on kovan

can you please explain how to call a delegateFunction from web3? with example would be great.

edit

smart contract 1 0xe7bc397DBd069fC7d0109C0636d06888bb50668c here

interface ComptrollerInterface {
/**
 * @notice Marker function used for light validation when updating the comptroller of a market
 * @dev Implementations should simply return true.
 * @return true
 */

/*** Assets You Are In ***/

function enterMarkets(address[] calldata cTokens) external returns (uint[] memory);
function exitMarket(address cToken) external returns (uint);

}

smart contract 2 0x1f5D7F3CaAC149fE41b8bd62A3673FE6eC0AB73b here

smart contract 3 0x3Afec0b1Ec510E59A757133059039828640839c7 enter link description here

contract Comptroller is ComptrollerV2Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential {
/**
 * @notice Add assets to be included in account liquidity calculation
 * @param cTokens The list of addresses of the cToken markets to be enabled
 * @return Success indicator for whether each corresponding market was entered
 */
function enterMarkets(address[] memory cTokens) public returns (uint[] memory) {
    uint len = cTokens.length;

    uint[] memory results = new uint[](len);
    for (uint i = 0; i < len; i++) {
        CToken cToken = CToken(cTokens[i]);

        results[i] = uint(addToMarketInternal(cToken, msg.sender));
    }

    return results;
}
}

sorry these are not my contracts, its from compound.finance on kovan Testnet
but, most importantly how do we call delegateFunction from web3js?

this is the transaction working.

and i am trying to call the same on the same contract that is mentioned in the transaction but same error.


texts:
I'm trying to store the sha3 hash of a string in a struct.

The problem is that its size exceeds what fits into a bytes32 type. As such, the alternative would be to have it in a bytes[] or string[]. The problem here is then that it can't be easily returned from a function.

One option would be to split the hash in two and save it like

struct hash {
    bytes32 hash1;
    bytes32 hash2;
}

This looks a bit bad though, I think.

Is there a common workaround for this issue?


texts: how a transaction is confirmed after all block are mined (newbie)

texts:
I'm completely a newbie in crypto currency. There is a question stuck in my head:
Fact:
- when an amount is sent from me to someone then a transaction is created and broadcasted on network.
- this transaction must be included in a block to be mined by a miner to create a NEW BLOCK (then its state becomes "confirmed")
Question:
- When all block are mined in far future (e.g: 21 mil blocks for bitcoin). Then there is no NEW BLOCK to be mined then How transaction is confirmed then?
Thank you in advance!


texts: Testing Smart Contract with multiple clients

texts: After deploying a smart contract on Ropsten Testnet using Truffle framework, we can use truffle tests to do unit testing (create a client to interact with the deployed contract). My question is, how can we set up multiple clients to interact with the deployed contract parallelly?


texts: Contract.deployed() does not work as expected

texts:
I use Truffle to test a contract. When i use Contract.deployed() and i fetch address, for example :

In a first test, the contract's address is
0x07D899846146b3503dE9D9Dc36B94C2e428eA434
In a second one, the contract's address is
0xF79f3B32b78ebD07B2E661b52e9CF374e311f1d5

Another problem is that it seems that on each time i test the contract, it's state is reinitialized.

It seems that Contract.deployed() create works like Contract.new(), it create a new instance of the contract for each test.

Which can cause this problem ?


texts: How to set up a Private network and connect peers in geth?

texts:
I am trying to setup a private network and trying to connect peers. Currently I'm trying it on my laptop and desktop (both of them are connected to different internet).

I run the below command in first terminal(in both systems (data dir is different in both systems)):

geth --rpc --rpcaddr "0.0.0.0" --rpcport "8545" --rpccorsdomain "http://localhost:5000, http://localhost:6000" --port "2403" --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --networkid 1001201 --datadir "E:\User\priv\data" init "E:\User\priv\genesis.json"

then I run:

geth --datadir "E:\User\priv\data"

Now, in the second terminal:

geth attach ipc:\\.\pipe\geth.ipc

then on 1st PC,

admin.addPeer("enode://e0c4960659b6ce4eda71c67b337055636f67660a711d157a81572b5eff1ed1b77931bef4bd079e2660baa661ac16d696b831e9394cb619378071a2593ecdf17a@[192.168.1.2]:30301");

on 2nd PC,

admin.addPeer("enode://5512657323add8ceafddb4fc64426b99b58473bfdfab795fe3847fdd6a09c25667d57c5c187d2d48de4ae63d02ce1e221a068dfe5e0476fe21d8aaa8a57d3356@[13.75.117.156]:30302");

both of them return true.
But admin.peerCount returns 0.

Can somebody please help me to setup a private geth network?


texts: How to capture error reason of "ALERT: Transaction Error. Exception thrown in contract code." from Metamask in the front-end

texts:
Let's say we have a smart contract test with a function foo() and a modifier so that only the contract owner can call this function.
Now we have a front-end with a user that is not the contract owner and is calling this function: the user will see the following alert in Metamask before confirming the transaction:

ALERT: Transaction Error. Exception thrown in contract code.

My question: is there a way to capture the error reason from the front-end to show the user why the transaction will fail? it looks like Metamask is "pre-launching" the transaction and detecting that some condition will fail (either require, out of gas, etc).
The closest thing I've been able to do from the front-end is to catch the error after the transaction has failed:
    await test.methods
        .foo()
        .send({ from: wallet.account })
        .on('error', (err: any) => {
            console.log('Error description: ', err);
            return;
        });

And even this way, the error description is just showing false in the status field. The goal would be to show the user why the transaction will fail before actually launching such a transaction.


texts:
I'm trying to compile my code in Remix and I try to fix it but I keep getting the same error:

  Data location must be “calldata” for parameter in external function, but none was given".

The problem is in the function createNewUser() external

event startMessage(string message);

function createNewUser (string _name, string _email, uint _aadhaar, string _sign) external {
  if((checkUser[msg.sender] == true)||(checkAadhaar[_aadhaar] == true))
  {
    startMessage('Failed !! User already Registered..');
  }
  else if((checkUser[msg.sender] != true)&&(checkAadhaar[_aadhaar] != true))
  {
    var newUser = Person(msg.sender, _name, _email, _aadhaar, _sign, new uint[](0), new uint[](0));
    addressToPerson[msg.sender] = newUser;

    checkUser[msg.sender] = true;
    checkAadhaar[_aadhaar] = true;

    startMessage('Welcome !! Successful Registration on Charter');
  }
}


texts: In the Ethereum Modified Merkle-Particia tree, what do the prefix, key and value signify?

texts: What does the prefix '3☐' mean in the leaf nodes?


texts: Transaction receiving ether from a contract address

texts:
Are transactions sending ether from contract addresses to normal addresses listed in block.transactions or are they not trivial to detect?
If not in block.transactions than how to detect?


texts: account nonce - what if it did not exist?

texts: I can't understand how account nonce actually avoids double spending. Every answer about this on the internet follow the pattern "If you only have 50 Eth and try to send 50 to A and 50 to B with higher gas price the network refuses because che counter skipped a unit bla bla..". Ok this is how it works now but.. what if nonce did not exist? Suppose i'm sending two transactions, 50 Eth to A and 50 to B with higher gas price but i only have 50 Eth. And suppose there is no nonce in Ethereum. What will happen? What will the nodes do?


texts: This contract does not implement all functions and thus cannot be created. for myfirstcontract contract Bank is working

texts:
pragma solidity ^0.4.24;

contract Bank {
    uint private value;

    function Bank(uint amount) {
        value = 10;
    }

    function deposit(uint amount) {
        value += amount;
    }

    function balance() constant returns (uint) {
        return value;
    }

}

contract MyFirstContract is Bank {
    string private name;
    uint private age;

    function setName(string newName) {
        name = newName;
    }

    function getName() returns (string) {
        return name;
    }

    function setAge(uint newAge) {
        age = newAge;
    }

    function getAge() returns (uint) {
        return age;
    }
}


texts: what information is provided to the miner with the transaction

texts:
I am wondering what information is provided to the miner with a transaction that needs to invoke a contract?
I thought about Gas, GasPrice, name of function to invoke and input.

But, whether the miner can access to the source code of the contract before executing the transaction? Whether the miner will be able to know what operations (e.g., storage to memory or just simple arithmetic operations) need to be executed?

Any good source to learn about such technical details about this?


texts: How long do my files stay on IPFS when I upload it?

texts: I'm trying to grasp the concept of how IPFS works. Say if I upload 1GB of data to IPFS. How long does it stay there? Or do I have to leave my computer on at all times for the file to be live on the IPFS system? If thats the case, why don't I just host it myself. What about SWARM? I'm trying to find a decentralized file storage system where I can upload once and it stays there forever.


texts: Can Artificial Intelligence be used to mine ethereum faster?

texts: Can Artificial Intelligence algorithm be used to improve hit rate of mining ethereum?


texts:
Is ETH (or ETC, for that matter) that was purchased after the HF in their respective chains at any risk of replay attack such that splitting via contracts is still advisable, or is that just a risk for any ETH held pre-HF?

How will replay apply to the ETC produced from DAO-C withdrawals on Aug 30, or will it?*


texts:
I've recently started developing contracts on Ethereum.

I currently have a contract which is a forwarding contract. The idea is that it sits there until 2 parties "sign" it, once that is done, the contract proceeds to create a child contract.

What we are struggling with is the signing of the contract by both parties, I'm hoping someone can point me in the direction of some documentation or explain how it is done...

Thanks in advance.


texts:
Is there any payment channel on Ethereum blockchain to support ex. Micro-payments ? Similar to the payment channels listed here :
https://en.bitcoin.it/wiki/Payment_channels

Such that we are able to use these payment channels using Smart Contracts.


texts: How to create the contracts on ethereum?

texts:
I need to create the ethereum tokens for this i learn about contracts. I try with simple contract using this link https://www.ethereum.org/greeter

when i try this contract

eth.getCompilers()

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

var greeterCompiled = web3.eth.compile.solidity(greeterSource)

the above line got the error like this

Error: The method eth_compileSolidity does not exist/is not available

Then we search about this error. the functions are depricated on the latest version

so how we can create this contracts. I can't get the correct solution for this on online so please help anyone

Thanks in advance


texts: How do I verify and query my transaction? (Web3.py + Infura + Remix)

texts:
I've used buildTransaction() (which works at Contract.transact()) and I can see my transaction has taken place.

(https://ropsten.etherscan.io/tx/0xebcd3e42340688087162bbf4359390de3d77c2b43d8a4683277651b462117a81)

While doing so, I've used the abi and bin contents for calling BuildTransaction, i.e. contract_ = w3.eth.contract(abi=filecontents,bytecode=bincontents)

transaction = {
'to': '0x6c8B815c51D8B84324804167DD6A1a5623407a3F',
'value': 0,
'gas': 4700000,
'gasPrice': w3.eth.gasPrice,
'nonce': w3.eth.getTransactionCount(address)
}

tx = contract_.buildTransaction(transaction).setGreeting('Omid')
signed = w3.eth.account.signTransaction(tx, pk)
final = w3.eth.sendRawTransaction(signed.rawTransaction)

Solidity contract

contract Greeter {
string public greeting;

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

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

function greet() view public returns (string) {
  return greeting;
}

How can I check that the value I've tried setting through setGreeting has been updated in my contract constructor (whose address I haven't mentioned for calling setGreeting above)?


texts: How to automatically add a custom token to MetaMask with ethers.js

texts:
I was playing around with creating BEP-20 tokens on cointool.app and noticed that whenever you generate a new token and pay the gas fee to mint it, the website automatically prompts you to add this custom token to your wallet. The dialogue window that pops up looks like this:

I am wondering how I could implement the same functionality into my dapp that is build on ethers.js. Usually when a user trades a custom token for the first time they are being asked to manually copy and paste its address into the Metamask or other web wallet to see its balance. But this is inconvenient and requires more effort than just pressing a Add Token button in a dialogue window. I can't find any documentation on this method, so if anyone knows how to do something similar with ethers.js or other library I'd be grateful to hear your suggestions.


texts:
Can anyone explain to me, why the transaction object I receive via web3 always has a value of 0?
When I open up the transactionhash in etherscan, it shows under the to field which is named "interacted with" that a certain amount of tokens had been transfered, but my code returns transaction.value of 0.
Sorry, I am new to the whole topic.
Regards


texts: I have three data fields in a form which will return a string. I would like to hash the value of these three strings and store it in the blockchain. However the data in these three strings is sensitive and I only want the person who has access to the private key of the public key it was encrypted with to see the data. Is there a possible way to do it. At the moment I am using solidity's sha256() function to hash and store it in a mapping but like that anyone can decrypt it and get the data that I stored.


texts:
How could I create a new smart contract token and copy the balance of every address from an old contract.

Essentially fork a contract.

I want to make this a one time function in the contract so that it can only be called once. Or even better do it during the contract creation.


texts: How can a deployed contract call another deployed contract by _interface_ and address?

texts:
There is a nice article about writing upgradable Solidity code article about writing upgradable Solidity code

The question is however (ref the article) if ITokenLedger is intentionally "contract" and not "interface"? Can ITokenLedger be "interface" and how this will affect the implementation of the calling "contract"?

What are the recommended methods of calling "contract" within another "contract" provided caller is only aware of the callee's ABI and address, with respect to gas consumption?

While this is most likely an noob question I appreciate your patience and thank you in advance.


texts: Using same port for web-hosting and geth node

texts:
I'm hosting a Django website on an Apache virtual machine and wanted to connect it Ethereum. Currently, the page I'm working on is hosted at

146.169.45.149:9002

Since I wanted to run a node at that address so I could connect the two, I ran this to start geth

geth --genesis customGenesis.json --rpc --rpcaddr "146.169.45.149" --rpcport "9002" --datadir testchain --nodiscover --networkid 1234 console

However, this isn't working and I'm getting the following error

Fatal: Error starting RPC: listen tcp 146.169.45.149:9002: bind: address already in use

Everything else seems to be working but the code is this

<!------- SCRIPT------------------>
<script type="text/javascript">
    var Web3 = require('web3');
    var web3 = new Web3();
    web3.setProvider(new web3.providers.HttpProvider("146.169.45.149:9002"));
    var mining = web3.eth.mining;
    document.getElementById("Mining").innerText = mining;
</script>

</body>

I'm new at this so it could be something related to rpc but I couldn't figure it out from what I read.


texts:
Actually Im working on a blockchain application based on smart contracts that allows to buy/sell properties and paying in cryptocurrency using Ethereum and Bitcoin.

I wonder I develop smart contract with Solidity (js) or Web3j(Java) ?

The front of the app will be with angular but I dont know what to use in back: Java or Java script ? What is easier and more workable.

And Thank you !


texts:
I am building a Ruby on Rails application and I want to subscribe to an event watcher of a published solidity contract in a Ruby task.  I know that if I were programming in Node I could use web3.js to do this.  What is the best way to do this in Ruby??

I am considering making a mini nodejs script that collects the event list and pub-subs it to Ruby using JSON-RPC.  However this seems silly because then I would have Ruby talking to that node script over JSON-RPC which would then be taking to geth over JSON-RPC.  Am I missing something?

Andy


texts: Invalid number of arguments to Solidity at InvalidNumberOfSolidityArgs

texts:
I made a simple contract for the testing purpose.

pragma solidity ^0.4.18;
contract LocalEthereum {
    address public owner;
    function LocalEthereum() public {
        owner = msg.sender;
    }

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }
    function setOwner(address _newOwner) onlyOwner external {
        owner = _newOwner;
    }
}

In the js application side,

  setOwner(account){
    contract.deployed().then(function(instance) {
      var instance = instance;
      return instance.setOwner( {from: account});
    }).then(function(txResult) {
       console.log('setowner',txResult)
    }).catch(function(e) {
      console.log(e);
    })
  }

running the js throws a exception,
Invalid number of arguments to Solidity function at Object.InvalidNumberOfSolidityArgs

I can not figure out how such exception occurs?
a second question, for the initialization code as shown below

    function LocalEthereum() public {
        owner = msg.sender;
    }

when does it come to execute?


texts: Get truffle contracts Global Method names

texts:
Right now you can access each deployed contract method with Truffle because each is exposed globally.

But I need a way to enumerate each contract say like:

 Object.keys(contracts)

But since all contracts are in the global namespace, I can't simpy enumerate them through window. (Or I'd have to filter it in some way, but that's messy and inefficient).

Any way to get this?

Or if not, what I basically need is get some reference(address) to existing contracts in the chain. (Right now I can see them in truffle output when I deploy a new contract) Can I get the contract's name somehow? Or are you stuck with just an address once you deploy?


texts: How a smart contract can call it's own function if it's not in the code

texts: Please tell me how can smart contract call it's own function if this is not in smart contract code? Here is an example: https://github.com/gnosis/MultiSigWallet/blob/master/contracts/MultiSigWallet.sol. It has onlyWallet modifier applied to addOwner function, but addOwner is not called in the code. Thanks.


texts: Unhandled promise rejection(gas limit) when deploying Contract to rinkeby using truffle-hdwallet-provider

texts:
I am trying to Deploy a beginners contract onto the rinkeby test network through Infura node. It is throwing the following error.

(node:35183) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: The contract code couldn't be stored, please check your gas limit.
(node:35183) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Contract

    pragma solidity ^0.4.17;

    contract Inbox {
        string public message;

        function Inbox(

string initialMessage) public {
        message = initialMessage;
    }

    function setMessage(string newMessage) public {
        message = newMessage;
    } }

I used some console logs to determine where the error is being thrown, I have marked it below with a //COMMENT.

Deploy script

const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode } = require('./compile');

const provider = new HDWalletProvider(
    'word frog gentle happy chicken book sneeze provide stick handle four fan',
      'https://rinkeby.infura.io/myStringOfRandomLetters'
);
const web3 = new Web3(provider);

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

    console.log('Attempting to Deploy from account', accounts[0]);

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

    console.log('Contract deployed to', result.options.address);
};
deploy();

Things I have tried to fix it:

Increasing the gas limit to 2,000,000, 4,000,000 and decreasing to around 500,000 and 21,000. I hit a "too small amount of gas" error, so I know gas amount is not the issue.

It may have been the npm module "truffle-hdwallet-provider" not installing properly, so I uninstalled, then sudo installed, then found the error fix on the internet (add --unsafe-perm to the commmand). like below

$ sudo npm install truffle-hdwallet-provider --unsafe-perm

still same error. I noticed another identical question Here however (as of now)it is also unanswered.


texts: Become your own Oracle? Can you put your own real world data into your Ethereum contracts?

texts:
I was reading this link and have a question that I don't think was answered there .

I understand that the third party providers act as Oracles and they bridge the gap by putting real world info into their contracts and then they can influence your contracts.

Is there a way to actually do on your own instead of relying on these third parties?

Just say I want to build a contract that takes information from the real world, can I just connect my Ethereum client into the real world directly? I know that other people running the contract can't do the same, but at least I can get data in and out without needing to rely on these companies.

EDIT: The possible duplication has only two answers for two third party services. I am looking into not using Oraclize or Reality Keys at all and running my own input/output into an Ethereum contract becoming my own Oracle.


texts: Is there a standard way for 3rd party to pay gas?

texts:
A smart contract can be modified to provide, for each functions that allows a 3rd party to pay gas, an alternative of that function which takes a signed message and assume the signer to be the sender, therefore allowing any 3rd party to pay on behalf of the user.

I found at least 2 ways how this is implemented.

https://github.com/bokkypoobah/BokkyPooBahsTokenTeleportationServiceSmartContract

https://github.com/ethereum/EIPs/issues/875 where atomic swap can be done by a 3rd party.

Since smart contracts, once written, is difficult to update, what is the most standard way to write smart contract that allows 3rd party to pay the gas that is accepted by the majority?


texts: Starting Geth on system startup - Ubuntu (on AWS)

texts:
Hi all,
I am running a couple of private nodes on AWS, and I am trying to get Geth to start on system start up.

I found this post --> Is there the start/stop script of geth after Debian/Ubuntu booting?

and followed it, trying the following in the geth@.service file

[Unit]

Description=Start geth

Requires=network.target

[Service]

Type=forking

User=%I

ExecStart=/bin/sh -c "/usr/bin/geth --networkid 1900 --nodiscover --verbosity 4 init /home/ubuntu/.ethereum/InitGenesis.json"

Restart=on-failure

[Install]

WantedBy=multi-user.target

However I cannot get Geth to start.

systemctl status geth@ubuntu outputs:

● geth@ubuntu.service - Start geth

   Loaded: loaded (/etc/systemd/system/geth@.service; disabled; vendor preset: enabled)

   Active: inactive (dead)

I am not sure what I am doing wrong. Can anyone point me in the right direction?


texts: Metamask won't display correct balance after creating customrpc for ganache accounts

texts:
I made a customrpc network on metamask using the correct server and imported a private key from ganache, which worked but the eth balance is displaying 0 when I expected it to display 100.

According to some user reports adding a / to the end of the rpc server fixes the problem, but it didn't work for me. I also deleted and reinstalled metamask from chrome, restarted computer and that didn't work either.

Does anyone know why this might be happening and some possible solutions that might fix it? Do i have to install some dependencies or something to sync the two clients? or perhaps I just give it some time to load the proper balances, maybe the network is clogged idk.

Any help would be greatly appreciated.