texts: How to recover BTC that wasn't converted into ETH by Shifty via Mist?

texts:
I tried the "deposit with BTC" option
BTC transfer was recognized in "Awaiting Deposit"
Then "Awaiting Exchange" timed out, I got a "try again" dialog, and was shown no way to get my BTC back or to try only the exchange part again without a new BTC deposit.

How do I get either my BTC back or the ETH I paid for? Who should I talk to, ShapeShift or Ethereum?


texts: Get all transactions by recipient's address on a light client

texts:
I would like to continuously get the transactions sended to a specific address while using a light client. I underscore that I am talking about regular transactions, not the contract invocations.

As far as I understood, there is no elegant way to do that in Ethereum.  The only two options that I see is to get the whole block and parse the transactions in JS ( as was suggested through eth_getBlockByNumber Common useful JavaScript snippets for geth ).  Or to first get the transaction hashes and request the transaction receipts for each of them through eth_getTransactionReceipt.

But what exactly will light client will do in the second case?  Will it issue a separate TCP packet for EACH transaction receipt?  Will the overhead in such a case be more than that of the first above described option?  So, what do you think is the most viable option?

Also, it was suggested here ( https://ethereum.stackexchange.com/a/45957/49595 ) to use getBalance (i.e. eth_getBalance) first to make sure that the balance has changed (so that some transaction appeared within the block).  Hm.  Pretty cool, but still - what is the best way to to get the sender's address if no transaction hash is known beforehand?

Edit: At the same time I don't quite understand how eth_getBalance will work on the light client.  According to the LES specification, it has to download the whole block even if only the balance from one certain transaction is required.  Right?

Edit2:  I am just testing out JSON RPC on my private blockchain.  I made two transactions by transfer of 1 Wei from one account to another.  Then I outputted the pending block header.  The sad part is that logsBloom is all zeroes - so there is definitely no information is kept about regular transactions.

Edit3: I looked at LES specification once more.
It has a GetReceipts function which accepts the hash of the block.  And at the same time eth_getTransactionReceipt accepts the hash of the transaction instead.  It is confusing, but it probably ultimately means that once any receipt is requested, the light client will call GetReceipts for the whole block.  Which is a good idea in my case, since I have to pull all the receipts anyway.


texts: what is [Reverted] during contract execution

texts:
I have sent ETH to a contract address, and it "failed" the transaction saying it is: Warning! Error encountered during contract execution [Reverted]

contract address and transaction failure here:

https://etherscan.io/tx/0x84f659b078abc10c419c59f90e81263817b0b645fd05e56effe52389697aa990

can someone help and explain please?

Theo


texts: How to deploy existing DAPP to my private ethereum node?

texts:
I am looking to build a PoC around a trading platform on a block chain platform. I am trying to deploy the dapp available here to my local ethereum node.

Package contains:

a. HTML frontend part

b. Solidity Contracts

Please help me in making this in running state. Any help would be highly appreciated.


texts: Why use a private block chain over a shared database?

texts:
Isn't a shared database able to provide all the guarantees that a private block chain could provide. Since you can track transactions,have transaction restriction and have authenticated access to certain users.

Even in cases where users of the shared database don't trust each, can't you just easily revert back to a previous state?


texts: Hash a message in ethereum-js and check in Solidity

texts:
I'm trying to check an hashed message inside my Solidity smart contract. In JavaScript I hash the message as follows:

util.sha3(Buffer.concat([
  new Buffer(address1),
  new Buffer(bytes32),
  new Buffer("0"),
  new Buffer(address2),
  new Buffer("0")
])).toString("hex");

When I check in Solidity I do

keccak256(id,ca,dataHash, false, address(0), false);

I've tried both with keccak256 and sha3, but both yield a different hash than the one produced in JavaScript. I'm suspecting some encoding issue (probably due to Buffer doing something different than Solidity), but I can't find anything about that.

Note that I'm not signing anything, so the issue described in this question should not apply (at least, not as I understand the answer and documentation)


texts: How can I sure that miners not cheat on gas usage?

texts:
How can I compute the gas consumed in order to be sure that the miner does not cheat on gas used?

Moreover, I don't understand how gas consume is computed, e.g. why writing to a storage variable with value 0 can cost more gas than if it was non-zero?


texts: Cannot download keystore or JSON files when creating MY ether wallet

texts:
I'm new to all cryto currencies.
 My question is. when I downloaded "MY Ether Wallet"
I printed the wallet just fine. saved the public and private keys
and tried to download the json and the keystore files nothing happened
I tried multiple times to click the unresponsive buttons. Result
No keystore or json download.

The Wallet opened successfully.
Currently no funds are deposited.

Any help to get these file appreciated .

Thank you. jpmiller


texts: Cannot deploy empty contract fom node.js applications

texts:
I can't deploy an empty Solidity contract to a local Geth blockchain using either a web3js or ethers.js node.js application. Web3js throws a “contract cannot be stored”  exception, ethers.js returns a transaction receipt with status 0x0, getCode returns 0x0, and geth displays the “stack underflow” VM error message. However, I have no trouble deploying the same contract from the Geth console using the same ABI and byte code data generated by the Solidity compiler in the applications.

The only explanation I can think of is that the ABI or bytecode data is corrupted in the JSON-RPC layer between the application and the ethereum node. Has anyone else experienced this problem? Is there any guidance you can give me concerning how to isolate, debug, and fix this?

Except from Web@0.20.1 code: exception thrown on second callback invocation

var theContract = web3.eth.contract ( JSON.parse(compile.interface) ) ;
var transObj = { from: accounts [0] , gas: … , gasPrice: … , data: byteCode } ;

var contractInstance = theContract.new ( transObj , function(err, myContract){
          console.log ( " Inside callback ..... " ) ;
       // NOTE: The callback will fire twice!
       // Once the contract has the transactionHash property set and once its deployed on an address
});


texts: Should contracts be written as if everyone has their own copy?

texts:
I'm trying to start my first ethereum project with truffle. I noticed that one of the contracts that comes with truffle init is:

contract MetaCoin {
  mapping (address => uint) balances;

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

  function MetaCoin() {
    balances[tx.origin] = 10000;
  }

  function sendCoin(address receiver, uint amount) returns(bool sufficient) {
    if (balances[msg.sender] < amount) return false;
    balances[msg.sender] -= amount;
    balances[receiver] += amount;
    Transfer(msg.sender, receiver, amount);
    return true;
  }

  function getBalanceInEth(address addr) returns(uint){
    return ConvertLib.convert(getBalance(addr),2);
  }

  function getBalance(address addr) returns(uint) {
    return balances[addr];
  }
}

However, to my understanding everyone has their own copy of the contract. So how would something like balances[receiver] += amount; or balances[msg.sender] -= amount; work?

If Person A sends Person B money, then on Person A's contract what's the point of adding to Person B's balance locally (through balances[receiver] += amount;)? Person B's contract should just update itself. It's not like anyone will ever ask Person A what Person B's balance is, so I don't see why it's stored.

Or perhaps it's the opposite? There's only 1 copy shared among every user in the network?


texts: How to add a custom JSON-RPC endpoint to geth?

texts:
I'm building an Ethereum private network and I want to make a custom JSON-RPC endpoint.

I've been customizing and adding some things in the go-ethereum source code but I don't know yet where to look to make this and which files would be involved...


texts: msg.sender problem for calling ERC20 token contract from another contract returns contract address

texts:
when i am going to call approve function of erc20 contract.log prints tokenOwner and tokenSpender address same which is contract address msg.sender returns contract address. but i want tokenWner = caller address and tokenSpender = contract address please help.

THis is erc20 method

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

    return true;
}

And this is my contract method that is calling token method

 function approve(address token, uint256 _value) public returns (bool) {
 return ERC20Interface(token).approve(this, _value);
}


texts: Function which only reads data still using gas/tx fee

texts:
I have a function call  which only reads data from contract but it still costs gas to execute:

   function foo(int256 x) public returns (bool) {
    if(tuna[x].validOnce == true){
      if(dog[x] == true)
        return true;
      else
         return false;
    }

    else
      return true;

 }

I ve read about pure and view that I can add to my method header. However Im not sure if this is a case in point where I need to use such headers?


texts: Token Tutorial: How to provide an address correctly to the `mintToken` function?

texts:
I worked the Token tutorial. At one stage, newly minted tokens can be supplied to a target address. However, when I provide the address from a test account on a private net (eth.account[1]), I get an error:

> eth.accounts
["0xf134f55797c344c5894d009d2784c0f32fd74199", "0x922d2931678e0641dc7d13cb38a2f0897252b0de"]
> token2.mintToken(eth.accounts[1], 1000000)
invalid address
    at web3.js:3887:15
    at web3.js:3713:20
    at web3.js:4939:28
    at web3.js:4938:12
    at web3.js:4964:18
    at web3.js:4989:23
    at web3.js:4055:16
    at web3.js:4141:16
    at <anonymous>:1:1

I got the same error, when truncating the address by the prefix 0x, as I read about somewhere else.

How else do I need to format an address to provide to a contract?

Address is valid:

> var isStrictAddress = function (address) {
....     return /^0x[0-9a-f]{40}$/i.test(address);
.... };
undefined
> isStrictAddress
function(address)
> isStrictAddress(eth.accounts[0])
true


texts:
in my Smart Contract I have a function such that it fires an event at the end of its code.

    function sendTran(arguments) public {
    *code*
    emit Event(argument 1,argument 3,argument 3,argument 4);
}

In nodejs I have an API like this

router.post('/send', function (req, res) {
  contractInstance.methods.sendTran(arguments).send({
    *stuff*
}).on('transactionHash', function(hash){
  console.log(hash);
}).on('error', console.error);
});

How can I modify the API so that I can see in res.send the event emitted by the function sendTran?

Thank you very much!


texts: How to make modifier for authorization of nested mapping addresses

texts:
May I know, how to make modifier for authorization of nested mapping addresses...
Mapping(address => mapping(address => uint) public allowance;

require(msg.sender == allowance[]); // Here we must give index...

But I want to authorize all addresses in this nested mapping... not only one specific address
Appreciate your quick response.


texts: Solidity Error: Doc tag @notice not valid for statements

texts:
I'm trying to compile my Solidity smart contract, but I keep getting this error:
Doc tag @notice not valid for statements.

There is no @notice statement in my code. The error seems to happen with Solidity versions from 0.4 to 0.4.9, with and without optimization.

EDIT: Through divide and conquer I could attribute the error to the following function:

function f(uint blockNumber, bool finalBlock) returns (bool) {
    if (msg.sender != protocolParameters.A)
        return false; // caller is not Alice

    if (blockNumber > protocolValues.blockNumber && blockNumber <= protocolParameters.numberOfBlocks*2) {
        protocolValues.stageNumber = blockNumber*2;

    } else {
        throw; // TODO: is throw angemessen here?
    }
    /// TODO: careful
    if (finalBlock) {
        protocolValues.phaseNumber = 2; // we go to the TERMINAL phase
        setPayoffs(protocolParameters.DA, protocolParameters.DB + protocolParameters.FV);
    }

    return true;
}

Any idea?


texts:
I am trying to get Swarm to run properly on my machine.
I followed the instructions mentioned here and also saw this SE question, but couldn't get it to run with the necessary parameters. I'm stuck at this point :

nohup geth --datadir $DATADIR \
       --unlock 0 \
       --password <(echo -n "MYPASSWORD") \
       --verbosity 6 \
       --networkid 322 \
       --nodiscover \
       --maxpeers 0 \
        2>> $DATADIR/geth.log &

I assumed I just had to copy paste it, but it returns what appears to be an error :

nohup geth --datadir $DATADIR \
>        --unlock 0 \
>        --password <(echo -n "MYPASSWORD") \
>        --verbosity 6 \
>        --networkid 322 \
>        --nodiscover \
>        --maxpeers 0 \
>         2>> $DATADIR/geth.log &
[7] 51688

Did anyone got this output ? It looks like the process just stops.


texts: EIP712: ecrecover returns different address from recoverTypedSignature_v4

texts:
I am trying to sign typed data via MetaMask "eth_signTypedData_v4". Recovering signer via recoverTypedSignature_v4 returns correct address that I signed my data with. But smart contract returns random address every time as ecrecover output. Can't understand what is wrong with the code.
JS:
 //constructing a thing

    const EIP712Domain = [
      { name: 'name', type: 'string' },
      { name: 'version', type: 'string' },
      { name: 'chainId', type: 'uint256' },
      { name: 'verifyingContract', type: 'address' }
    ]

    const domain = {
      name: 'SomeName', //(replaced from original value)
      version: '1',
      chainId: 500, //(replaced from original value)
      verifyingContract: '0xd093dD097772300939Ec1ED7482B415bd43D9246'
    }

    const SomeObject = [
      { name: 'someAddress', type: 'address' },
      { name: 'someAddressTwo', type: 'address' },
      { name: 'someAddressThree', type: 'address' },
      { name: 'value', type: 'uint256' },
      { name: 'valueTwo', type: 'uint256' },
      { name: 'someAddressFour', type: 'address' },
      { name: 'deadline', type: 'uint256' }
    ]

    const message = {
      someAddress: account,
      someAddressTwo: from,
      someAddressThree: to,
      value: '1000000000000000000',
      valueTwo: '17',
      someAddressFour: account,
      deadline: deadline.toString()
    }

    const data = JSON.stringify({
      types: {
        EIP712Domain,
        SomeObject
      },
      domain,
      primaryType: 'SomeObject',
      message
    })

 //signing

    library?.send('eth_signTypedData_v4', [account, data])
      .then(sig => {
        return splitSignature(sig)
      })
      .then(signature => {
        return signature
      })

//using signature in smart contract call

      const args = [
      account,
      from,
      to,
      '1000000000000000000',
      '17',
      account,
      deadline.toString(),
      signature?.v,
      signature?.r,
      signature?.s
      ]

      const response = await mainContract?.doSomething(args)

Smart contract side:
    function doSomething(SomeObject memory someobject) public {

        bytes32 hash = someobject.hash();
        address signer = EIP712.recover(DOMAIN_SEPARATOR, hash, someobject.v, someobject.r, someobject.s);

        //failing here

        require(signer != address(0) && signer == someobject.someAddress, "wrong signature");

    }

    struct SomeObject {
        address someAddress;
        address someAddressTwo;
        address someAddressThree;
        uint256 value;
        uint256 valueTwo;
        address someAddressFour;
        uint256 deadline;
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

    function recover(
        bytes32 DOMAIN_SEPARATOR,
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, hash));
        return ecrecover(digest, v, r, s);
    }

   function hash(SomeObject memory someobject) internal pure returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    SOMEOBJECT_TYPEHASH,
                    someobject.someAddress,
                    someobject.someAddressTwo,
                    someobject.someAddressThree,
                    someobject.value,
                    someobject.valueTwo,
                    someobject.someAddressFour,
                    someobject.deadline
                )
            );
    }

    constructor() public {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256("EIP712Domain(string name,string version,uint256 chainId,address
    verifyingContract)"),
                keccak256("SomeName"),
                keccak256("1"),
                chainId,
                address(this)
            )
        );
    }


texts: truffle deployment: not sure about 2_deploy_contracts.js for 2 contracts

texts:
I am working on Ubuntu 18.04. When I execute the “truffle migrate” command, I am getting first deploying and then replacing contract messages. Is this right?  I am not sure about the code of 2_deploy_contracts.js for 2 contracts.

Somebody please guide me is my 2_deploy_contracts.js correct?

I am following the tutorial at:

Medium JustDev

The migration file 2_deploy_contracts.js is:

const Victim = artifacts.require('./Victim.sol')
const Attacker = artifacts.require('./Attacker.sol')

module.exports = function(deployer){
   deployer
     .deploy(Victim)
     .then(() =>
        deployer.deploy(Attacker, Victim.address)
     )
};

Is the above code correct?

Somebody pleae guide me about the code of deployment file.


texts: I Call SmartContract Token ERC20, Why Show Hashing Output ? (Web3 + Metamask + Javascript)

texts:
I do not know why with this, even though in the previous version (web3 + Metamask) can issue real data. But now used as hashing (output). I took the example in the code and output below (to get the TotalSupply on the ERC20 Token):

const contractInstance = web3.eth.contract(contractAbi).at(contractAddress);
const total_supply = contractInstance.totalSupply.getData();
console.log(total_supply);

  Output : 0x18160ddd (this is my problem)

How to showing real data? In a sense it doesn't come out hashing. Thanks


texts: What is this evm code produced by solc in this public array checking, and why?

texts:
When solc creates code for arrays when they are declared public. In particular, it contains a check on the length of the array. For example, this:

contract OutOfBoundsException {
    uint256[8] public array;
}

compiled with solc --optimize produces:

...
tag_3:
  pop
    /* "contracts/oobtest.sol":46:68  uint256[8] public array */
  tag_4
  calldataload(0x4)
  jump(tag_5)
tag_4:
 # dead code
tag_5:
  0x0
  dup1
  sload
  dup3
  swap1
  dup2
  lt
  tag_6
  jumpi
  invalid
tag6
 # ...

The --optimize flag was used to remove some of the crud and simplify some of the above.

What is going on in the basic block that starts tag_5 and why is it needed?


texts:
I have downloaded the slides from the site:
Compliance and Security patterns
It says "No writes after calls." I can understand this concept. It’s a remedy for reentrancy problem. But it shows compliance and security patterns in some technical language related to Datalog or to some language related to software representation. Can somebody please guide me what is the meaning of those equations?


texts: Is it possible to know which Events a given transaction triggered?

texts: I've noticed the GetTransactionReceipt function returns an array of logs that were created as a result of the transaction being processed. However, I wonder if there is a way to get a list of Events that a transaction created during its execution, since those two don't seem to be synonymous. Or does GetTransactionReceipt already return both logs and Events?


texts: Solidity: Error with declaring a constant variable

texts:
I getting an error while declaring a conatant variable, my code is given below:
pragma solidity ^0.5.1;
contract Governmental{
   function lendGovernmentMoney ( address buddy ) public  returns ( bool ) {
      address owner;
      uint[] memory creditorAddresses;
      uint lastTimeOfNewCredit =0;
      uint amount = msg. value ;
      uint creditorAmounts = 0;
      uint profitFromCrash = 0;
      uint round = 0;
      uint lastCreditorPayedOut = 0;
      uint constant TWELVE_HOURS = 12;
      // check the condition to end the game
      if ( lastTimeOfNewCredit + TWELVE_HOURS > block . timestamp ) {
         msg. sender . send ( amount );
         // Sends jacpot to the last creditor
         creditorAddresses [ creditorAddresses . length - 1] . send ( profitFromCrash );
         owner . send ( this . balance );
         // Reset contract state
         lastCreditorPayedOut = 0;
         lastTimeOfNewCredit = block . timestamp ;
         profitFromCrash = 0;
         creditorAddresses = new address [](0);
         creditorAmounts = new uint [](0);
         round += 1;
         return false ;
      }
   }
}

The error message is:

solc prg17.sol
prg17.sol:12:12: Error: Expected ';' but got 'constant'
uint constant TWELVE_HOURS = 12;
^------^


texts: How do I commit an Account Creation when using EthereumJ

texts:
I'm currently using EthereumJ-StandaloneBlock and I'm trying to create an account.

Account account = ApiServer.jsonRpc.addAccount(aSCreateAccountIncomingVO.getEmail());

   logger.info("ASCreateAccount-jsonRpc.eth_accounts():"+ApiServer.jsonRpc.eth_accounts());

    try {
        logger.info("ASCreateAccount-account:address"+account.getAddress());
        String address = TypeConverter.toJsonHex(account.getAddress());
        servletObject.setJsonObject("balance",account.getBalance());
        servletObject.setJsonObject("address",address);

    } catch (Exception e) {
        e.printStackTrace();
    }

I'm able to get the account.

{
  "balance": 0,
   "address": "0x82dec192ab6cae33fdd96a668bb3d6e31dd3fe67"
}

but when i restart the program, I can no longer retrieve this account.
Is there a step I'm missing out, like setting AutoBlock, create Block or something?


texts: `Error: Invalid params: invalid format.` when deploying Contract to testrpc

texts:
Tried to deploy a contract to testrpc network, but it is giving an error Error: Invalid params: invalid format.. Contract bytecode and ABI json is taken from frozeman's example.

deployContract.js

Web3 = require('web3')
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

contractCode = '6060604052610157806100136000396000f30060606040523615610048576000357c01000000000000000000000000000000000000000000000000000000009004806318559e19146100b457806394707dab146100cb57610048565b6100ae5b60003411156100ab577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b565b60006000f35b6100c56004803590602001506100e6565b60006000f35b6100dc600480359060200150610131565b8060005260206000f35b80600060006101000a81548160ff021916908302179055507fc86aa3e5b1bc5a674de25655f9a3ccf734594e22d008e71d7ede3fe5c93e138460405180905060405180910390a15b50565b6000600060009054906101000a900460ff1660ff168260ff16149050610152565b91905056';
abi = [{"constant":false,"inputs":[{"name":"givenNumber","type":"uint8"}],"name":"setNumber","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"givenNumber","type":"uint8"}],"name":"guessNumber","outputs":[{"name":"","type":"bool"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"SetNumber","type":"event"}];

GuessNumber = web3.eth.contract(abi)
var contractInstance = GuessNumber.new({from: web3.eth.accounts[0], gas: 200000, data: contractCode});

Error

C:\Users\username\Desktop\Code\testdapp\node_modules\web3\lib\web3\requestmanager.js:61
        throw errors.InvalidResponse(result);
        ^

Error: Invalid params: invalid format.

testrpc started using

testrpc -u 0

I am using web3@0.20.1 and TestRPC v4.1.3. What is wrong with the code?


texts: Wrong parameter passed in the constructor. How can I fix it?

texts:
I've published a crowdsale contract with a wrong parameter. How can we fix this?

Can I contact Etherscan for help, or is the only option to publish a new contract?
Is it a problem to have two similar published contracts, but with different parameters passed in the constructor?


texts: Trezor - How to see the balance on a particular address?

texts:
Trezor uses MEW or MyCrypto to display the balance of my Ethereum accounts.
However, I cannot enter a particular address and have the website search for that wallet in my HD derivation path.
I know that it is not a problem with a solution in general (since the user could enter a wallet that do not belong to the Trezor and the program would never know if it did not find yet or if does not exists), but if I could generate a hundreds of address and check, it would be better than the option at the moment.

How can I search for a particular address (even if for a limited number) in Trezor?


texts: Difference between Ethereum Consortium Blockchain template and STRATO Blockchain Individual Instance template in Azure

texts:
I have recently started analysing Blockchain as a service and found it's very interesting. But, I am not able to interconnect these information's.

What is difference between Ethereum Consortium Blockchain template and STRATO Blockchain Individual Instance template?  What are the use cases for above templates?

So, Kindly help me to fill the gap.


texts: AlethZero browser won't connect to the internet

texts:
When I launch AlethZero, the program starts seemingly fine. The browser included, from my understanding, should be able to browse the internet like any other browser. However, when I type www.google.com, it returns the following error:

"Error downloading DApp: " Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type: struct dev::Exception
std::exception::what: Unknown exception
[struct dev::tag_comment *__ptr64] = Dapp content hash does not match

Ok. So maybe it's looking for a DApp that doesn't exist.

When I type http://google.com or http://www.google.com, I get this error:

qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error

These combinations of errors are thrown for any variety of websites I try. I am very new to all of this and would like to know how to get AlethZero's browser to work. I am on Windows x64 machine.


texts: Can someone confirm that the sender will receive the correct amount of tokens?

texts:
I've tried to get this to work. But every time I deposit 1 Finney it only gives me 0.00000000000000000001 Tokens.

What am I missing?

For every 1 Finney, I want the buyer to receive 1 KEFT token automatically.

Here is the code:

pragma solidity ^0.4.16;

contract KidsEducationFund {

    string public name;
    string public symbol;
    uint8 public decimals = 18;

    address owner = 0x0121B8054c407533E7A56fC85c148CDfCF094BAc;

    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;

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

    function KidsEducationToken() public {
        balanceOf[msg.sender] = 1000;
        name = "Kids Education Fund Token";
        symbol = "KEFT";
    }

    function _transfer(address _from, address _to, uint _value) internal {
        require(_to != 0x0);
        require(balanceOf[_from] >= _value);
        require(balanceOf[_to] + _value > balanceOf[_to]);
        uint previousBalances = balanceOf[_from] + balanceOf[_to];
        balanceOf[_from] -= _value;
        balanceOf[_to] += _value;
        Transfer(_from, _to, _value);
        assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
    }

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

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowance[_from][msg.sender]);
        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }

    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowance[msg.sender][_spender] = _value;
        return true;
    }

    function () payable public {
        require(msg.value >= 0);
        uint tokens = msg.value / 1 finney;
        balanceOf[msg.sender] += tokens;
        owner.transfer(msg.value);
    }
}


texts: How to use bootnode in private blockchain to connect to nodes

texts:
I am trying to set 2 geth on same system to connect each other using bootnode option.

I got two different folders with same genesis file then how to initilize and start geth console to see two nodes sync.


texts: Initialization of object in storage(inside contract ) vs Initialization of object in memory(inside function)

texts:
I am creating an object of another contract in my contract, if I create the object outside any function(global)it works fine but if I create it in any function or constructor the methods of that contract are not accessible, I cant understand why this happens.

following is the working code

This is my storage contract

contract Storage{
    uint id;
    uint status;

    function setId(uint mid){
        id=mid;
    }
    function setStatus(uint mStatus){
        status=mStatus;
    }

}

I am accessing it in to my logic contract, I need multiple objects of this storage contract to storage data with different ids, so that I am mapping the objects with ids.

import './Storage.sol';
contract A{

    mapping (uint=>Storage) idToStorage;
    Storage storage=new Storage();

    function addNewB(uint id){
         idToStorage[id]=storage;
    }
    function getStatus(uint id){
         idToStorage[id].status();
    }

}

This works fine but the issue is object of Storage contract is created globally, and whenever I put object into mapping(ie.idToStorage) the object is pointing to same address, when I change the state of object for any Id that was reflected to the objects for all the Ids,

to over come this I have created the local objects of the Storage contract as in following code

import './Storage.sol';
contract A{

    mapping (uint=>Storage) idToStorage;

    function addNewB(uint id){
         Storage storage=new Storage();
         idToStorage[id]=storage;
    }

    function getStatus(uint id){
         idToStorage[id].status();
    }
}

by this method the issue of same address was resolved, and every object has different address but now the issue is I am not able to access the methods of Storage contract, whenever I tried to access the methods It returns

  error: Invalid opcode

can anyone explain, How to handle this case??


texts:
I have Ubuntu 18.04 installed, and I just installed Mist. To my understanding, installing Mist should have installed Geth as well, but when I do the command

geth

in a terminal, I receive

geth: command not found

Question:

Is this supposed to happen? Am I doing it wrong?

More context:

I installed the Mist-linux64-0-10-0.zip found on https://github.com/ethereum/mist/releases , then I extracted it in a folder, and then I run the

./mist

command, which opens up mist, and I downloaded the blockchain from there. So mist works as far as I can tell. However I was unable to import a private key for some odd reason because when I go to

File > Import accounts

It is grayed out. I don't know if this is geth related, but I saw online tutorials that teach you how to import private keys with geth if you're having problems the other way. Though since I can't seem to get geth to work, I am at a standstill.

All help is very much appreciated!


texts: How can I get intellisense to work when writing javascript tests in truffle?

texts:
Truffle injects a global web3 instance into your tests and also seems to set up some mocha functions in the global scope (contract, describe and it). When I open the test file for a truffle project in vs code I don't get completion for the global web3 instance and I'm not able to jump to the definition of the mocha testing methods.
How can I configure a project so that the IDE is able to provide intellisense for all the elements inside a truffle test?


texts:
I have read this question but it didn't solve my problem.

I'm trying to connect the Remix IDE to a running node on my computer. The node is running without issues, it's connected to the Rinkeby network and to a Dapp I'm creating. For completeness, I'm starting the node with

geth --networkid=4 --datadir=$HOME/.rinkeby --verbosity 0 --syncmode=light --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303?discport=30304 --rpc --rpccorsdomain "https://remix.ethereum.org" --rpcapi=eth,web3,net,personal,ssh,db,debug console

However, when I do Contract > Environment > Web3 provider > 127.0.0.1:8545 (or localhost:8545 have tried both) the accounts that appear are not the same as the ones I get on my running geth console by typing eth.accounts. I don't know where the accounts that show up in Remix after connecting to 127.0.0.1:8545 are coming from actually.


texts:
For this contract, there is a 0.1% "fees" on the transfer. I amended the ERC20 transfer function as follow;

function transfer(address _to, uint256 _value) public {
    uint256 fees = (1*_value)/1000;
    _value -= fees;
    _transfer(msg.sender, _to, _value);
    _transfer(msg.sender, 0x7261fc332463f4f211ee316d14bb22fb5f37ebb3, fees);
 }

The function works fine, by checking the wallet.

However the 0.1% transaction do not show up on any block. Is there a way to make it show up on etherscan.

Thank you!


texts: Transaction error. 0x0 Transaction mined but execution failed

texts:
function tipPoolOwner() public payable{
    require(msg.value > 0);
    require(msg.sender != owner());
    address payable poolOwner = address(uint160(owner()));
    poolOwner.transfer(msg.value);
    emit TipSent(msg.sender, msg.value);
}

I have this tipping function running on the remix IDE. the contract will deploy but when trying to run the function and tip the owner of the contract, I get 0x0 Transaction mined but execution failed.

I tested it and it specifically fails at the transfer function. I checked gas price of the mined transaction and it's at 30926, well within the acceptable range.

Edit:
Here is the owner method:

address private _owner;
constructor () internal {
    _owner = msg.sender;
    emit OwnershipTransferred(address(0), _owner);
}

function owner() public view returns (address) {
   return _owner;
}

Here is the Transaction:


texts: Truffle deployment error while deploying with Infura (Error: Callback was already called)

texts:
I am trying to deploy a token smart contract to Ropsten test network with Infura, but I am always getting an error as I am using

  truffle migrate --reset --network ropsten_infura

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:358
                callback(err);
^
Error: Callback was already called.
    at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:43:1
    at WriteStream.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:358:1)
    at WriteStream.emit (events.js:315:20)
    at WriteStream.destroy (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/level-ws/level-ws.js:140:1)
    at finish (_stream_writable.js:681:14)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

Here are my truffle-config.js config file :

const path = require("path");
require("dotenv").config({path: "./.env"});
const HDWalletProvider = require("@truffle/hdwallet-provider");
const AccountIndex = 0;

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  contracts_build_directory: path.join(__dirname, "client/src/contracts"),
  networks: {
    development: {
      port: 7545,
      host: "127.0.0.1",
      network_id: 5777
    },
    ganache_local: {
      provider: function() {
        return new HDWalletProvider(process.env.MNEMONIC , "http://127.0.0.1:7545", AccountIndex)
      },
      network_id: 5777
    },
    goerli_infura: {
      provider: function() {
        return new HDWalletProvider(process.env.MNEMONIC, "https://goerli.infura.io/v3/INFURAKEY", AccountIndex);
      },
      network_id: 5
    },
    ropsten_infura: {
      provider: function() {
        return new HDWalletProvider(process.env.MNEMONIC, "https://ropsten.infura.io/v3/INFURAKEY", AccountIndex);
      },
      network_id: 3
    }
  },
  compilers: {
    solc: {
      version: "0.6.1"
    }
  }
};

I am using:

truffle 5.1.23
npm 6.14.4
node 14.0.0
truffle-hdwallet-provider 1.0.34

Thank you in advance for your help !


texts:
I am new to this community.

I have question regarding new ICO offering from PlexCoin.  They are offering (as of Aug 7th) for sale an initial 50million coins (tokens) at start price of $0.13 USD per unit.  This is all well and good.  On their website (plexcoin.tech) they are claiming a total sold tokens of approx. 14 million from approx. 8500 buyers.  Where my questions comes in is why none of these transfers or transactions are showing up on EtherScan Token Transfers or Token Holders?  Should there not already be data showing here??  https://etherscan.io/token/0xb3203DB25a01fa7950a860B42b899Ad7Da52DDD6

Could someone from Ethereum verify that transfer of PLX are actually happening through the BlockChain to holder wallets?

Thank you! :)


texts: geth console returns command not found on Mac

texts:
I am just getting started on ethereum programming on a Mac (OS Siera 10.12.6) and am trying to set up my environment. I am following the Ethereum.org installation instructions.

I completed these steps to install geth I believe:

brew tap ethereum/ethereum
brew install ethereum

and I'm now at the geth account and console steps.

However, I get this error:

geth account new
-bash: geth: command not found

and

geth console
-bash: geth: command not found

and when I cd to the directory ./Library/Caches/Homebrew/ethereum--git/cmd/geth

and run it there I get the same error.

Also, these are the files I see in the directory and don't see one specifically for geth.

ls /Users/me/Library/Caches/Homebrew/ethereum--git/cmd/geth
accountcmd.go       genesis_test.go
accountcmd_test.go  main.go
bugcmd.go       misccmd.go
chaincmd.go     monitorcmd.go
config.go       run_test.go
consolecmd.go       testdata
consolecmd_test.go  usage.go
dao_test.go

Is there an installation step I still need to perform?

Is the documentation out of date? Are there some good, current documentation and tutorials you would recommend?

I do see this command: consolecmd.go

I'm not familiar with the go language but see quite a few files with the .go extension.

I don't think I have Go enabled because when I tried to cd to the directory it wasn't found:

cd /usr/local/go
-bash: cd: /usr/local/go: No such file or directory

Any help would be appreciated.


texts: Type bytes32[] memory is not implicitly convertible to expected type bytes32 [] storage pointer

texts:
I am receiving, the error below:

Type bytes32[] memory is not implicitly convertible to expected type bytes32[] storage pointer.

when unpacking what should be a bytes32 i.e. a in Problem struct (1).

//FileOne.sol
contract ExampleOne {

  struct Problem {
    bytes32 a; // (1)
    bytes32 b;
    bytes32[] c;
    uint d;
    }
  mapping (bytes32 => Problem) public problems;
}

//FileTwo.sol
contract IExampleOne {
  function problems(bytes32) public returns (bytes32, bytes32, bytes32[], uint);
  }

contract Example Two {

  IExampleOne exampleOne;

  constructor(address _exampleOne) {
    exampleOne = IExampleOne(_exampleOne);
  }

  function func(bytes32 name) {
    (bytes32 a, bytes32 b, bytes32[] c, uint d) = problems(name); //ERROR
    ...
  }
}


texts:
Whenever I do modification in a contract and deploy the contract again, the data in the existing contract is completely lost as the new contract is deployed in a new address.

For instance, I have a registration Contract. When I first Deployed I forgot to retrieve the Name of the user. So, i had to modify the contract and deploy it again. In this case i lost all the registration details of the users who had registered to my application.

Now my question is: Is there a method by which i can retrieve back all the data stored in my old contract to my new contract?


texts: What does signing transactions mean ? and where does it happen?

texts:
I am having some problems with understand the action of signing transactions on ethereum. i actually never had to do it manually or even using my web3 based Interface. I have seen it used in an example of a "secure" authentification based on the ethutils but couldn't really grasp it.

so i want to know what is transactions signing and where and why i would need to use it.


texts: Send Multiple transactions in ethereum from an eth address

texts:
I don't know if this question was already answered but my question is about a normal wallet address and not a smartcontract.

So what I want to do is to launch multiple transactions with small gaz price and let them until they are executed. Is it possible?

Can we do that with metamask for instance?

Also can anyone tell me how it can be possible in the technical part (I mean the blockchain need by construction to have only a transaction from the same address in a block, and the following transaction should be in another block)?

Thank you for your responses


texts: Is Absolute/ Immediate Finality a goal in blockchain consensus or does some areas work better under probabilistic finality such as Ethereum's Pow and to be PoS? (I know that some networks using BFT mechanisms obtain Absolute/ Immediate finality. Is that not the best way to do it?)


texts: infinite gas required of simple external function call

texts:
I have minimized the following solidity code generated in remix to demonstrate the issue. This code warns the test001.regester function requires infinite gas which obviously by the code cannot be.

Could some one determine what the issue really is?

I have tried several versions of calling sequence of the remote call, and all have the same issue. (Other versions are shown commented out in the function code below.)

pragma solidity ^0.4.17;

contract test002 {

    address[] AddressList;

    event ItemAdded(address, address);

    function getItemCount() public view returns(uint) {return(AddressList.length);}
    function getItem(uint index) public view returns(address) {return(AddressList[index]);}

    function addItem(address inItem) public {
        AddressList[AddressList.length] = inItem;
        ItemAdded(this, inItem);
    }

}

contract test001 {

    address AA;

    event Creation(address, address);

    function test001() public {
        AA = new test002();

        Creation(address(this), AA);
    }

    function register() public {
        // option 1
//        test002(AA).addItem(address(this));

        // option 2
//        test002 A = test002(AA);
//        A.addItem(this);

        // option 3
        test002 A = test002(AA);
        A.addItem(address(this));
    }

}


texts: How to see common ENS names that have been auctioned?

texts:
In the ENS documentation, it says that the "DApp" shows you when common ENS names are being auctioned.

  How do the DApp and the twitter bot know what names people are
  auctioning?

  The DApp and the twitter bot have built in lists of common names,
  drawn from an English dictionary and Alexa’s list of top 1 million
  internet domain names. They use these lists to show you when common
  names are being auctioned. We do this because if the app didn’t reveal
  these names, anyone with a little technical skill could find them out
  anyway, giving them an advantage over those who don’t have the
  capacity to build their own list and code to check names against it.

I would like to get a sample of common names that have been auctioned. But can't seem to make sense of how to do so from the documentation. I know how to interact with contracts using the ABI. I'm just not sure what contract "DApp" refers to (the registry, registrar, resolver) or what function to use.


texts: How do I obtain the transfer logs of an ERC721 token through Etherscan?

texts:
Is it possible to get the transfer logs of a specific ERC721 token ID using Etherscan API? For example,  https://etherscan.io/token/0x06012c8cf97bead5deae237070f9587f8e7a266d?a=587058#readContract
I went through their documentation but no luck.


texts: add() function with more parameters on solidity?

texts:
I'm trying to help a friend debug a timelocked transaction within a BSC smart contract written in solidity 0.6.12 but this is the first time I read code on this language and platform. We're trying to understand exactly what this queued transaction is doing. On BSC Scan we can see the signature says: add(uint256,address,uint16,bool)
I have decoded the 4 hex data to 2400, address, 400 and 0, but I don't understand what it means. From what I could get reading the smart contract, it seems add() takes only 2 arguments, and it's a sum using SafeMath library. What am I missing here? Thanks for any help!
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a, 'SafeMath: addition overflow');

    return c;
}


texts:
I am new to blockchain in general and still trying to nail down some basic concepts, this being one of them: if a new block is added to the chain approximately every 10 minutes, does that mean a transaction might take up to 10 minutes to go through?

For example, if I send money to someone, might it take up to 10 minutes for them to receive it?

Thanks in advance.


texts: Unable to withdraw liquidity on pancakewsap v1

texts:
Please I really need help here.
My smart contract was deployed on pancakeswap V2 using RouterV1.
I already added liquidity but then discovered I couldn't swap. I have created a new smart contract on with RouterV2 but the problem is I am unable to withdraw the liquidity on the former one.
I have done the following:

Set liquidityfee to 0
Set tax to 0
Set MaxTxPercent to 100

Each time i try to withdraw liquidity on pancakeswap, I get the following error
{code: -32603, message: "Internal JSON-RPC error.", data: {…}}
code: -32603
data: {code: 3, message: "execution reverted: PancakeRouter: INSUFFICIENT_A_AMOUNT", data: "0x08000000…0000000000000000000000000000000000000000000000000"}
message: "Internal JSON-RPC error."

estimateGas failed 0 removeLiquidityETHWithPermit (10) ["0x1B5d0E2473xxx", "31819805153394637698", "44448462829941701997", "22416422399999999365", "0x349ad59xxx", 1621684887, false, 28, "0xb335b5468887xxx", "0x7323f344xxx"]

estimateGas failed 1 removeLiquidityETHWithPermitSupportingFeeOnTransferTokens
(10) ["0x1B5d0E2473aFC5A70CC026dDD45547Fe7830ba9b", "31819805153394637698", "44448462829941701997", "22416422399999999365", "0x349ad597cA4033f766F3ae2C870187a0454fD7F3", 1621684887, false, 28, "0xb335b5468887ef414cec86d5fff3f432a5cf01e5313ea7f16ec9f8b0add8bd56", "0x7323f344e59f0553xxx"]
0: "0x1B5dxxx"
1: "31819805153394637698"
2: "44448462829941701997"
3: "22416422399999999365"
4: "0x349ad5xxx"
5: 1621684887
6: false
7: 28
8: "0xb335b5468xxx"
9: "0x7323f344xxx"
length: 10

{code: -32603, message: "Internal JSON-RPC error.", data: {…}}
code: -32603
data:
code: 3
data: "0x08c379a0000000000000000000000000"
message: "execution reverted: PancakeRouter: INSUFFICIENT_A_AMOUNT"


texts: Are there multiple instances of Ethereum state or a single latest image?

texts:
Are there multiple instances of Ethereum's state? That is, is there one per mined block? Or a single latest image?

Does Ethereum maintain a state snapshot, for every block since genesis, so that previous states can be checked?


texts: How to verify whether an address variable points to an existing account?

texts:
function pay(address payee, uint value) public {
    // How to ensure that payee is an existing account?
    payee.transfer(value);
}

Many thanks!


texts:
I didn't check on the running Geth instance and when I executed a function that logs everything in the Blockchain, I had an error that the port I was listening to wasn't responding. I figured out that there wasn't enough space in my storage so I upgraded it. After I upgraded the storage, I've been seeing this error when I try to sync my node:

Fatal: Error starting protocol stack: missing block number for head header hash

I couldn't resolve it nor can I use geth attach. Geth instantly terminates after displaying that error. Is resyncing the only way to solve this? I've also read that after resyncing, the problem will still persist.


texts:
I'm pretty new to the concept of blockchain and use cases so please bear with me if this sounds to vague or elementary.
As, I researched more on this, I wanna know how can we use blockchain as a database. Per se, I have product prices database, which contains product price, details and other meta data. The prices of products might change, depending on the product owner. I want to know how to design a solution based on blockchain to store this information and disseminate the updates in near real time. How and where the block-chain will reside ?

Update:
Let's say I'm the owner of a company whose provides IT Products to it's clients. Each client can have different price for the same product based on the pre-signed contracts. Product details are currently stored in a database(lets name it Back_DB)(details defined below)

Product_id
Price
Type
Description

This database is located in different location which I have limited/no access to. I have a database on my side(lets name it FrontDB), which I use to show the prices and details of each products to the clients. I get the updates in the form of data dump from the BackDB to FrontDB once in a day at a defined time. Here comes my use case.
I want to use blockchain concepts and create an architecture such that as soon as there is an update/deletion/creation of product info in the BackDB it is communicated to my FrontDB in the form of a transaction in a block, so that it always contains newest information.


texts: How to see the miner account that earned gas? Or how to know the account where gas goes?

texts: I made a transaction to another account on rinkeby and then saw the record on Etherscan. There is Txn fee as gas. But how can I know where the gas went. I mean the account that gas was paid to. I think there should be a miner account that receives the gas. Is there any way to know the miner's account?


texts: Geth; How to get balance of my address on main network

texts:
I can't get my balance on main network.
How to get it by geth?

I created an account (0xaabbcc...) by MetaMask. And, I send some eth from my bitflyer account.

Then, I want to get the balance of my account. I have run geth by following command geth --datadir="~/blockchain" --rpc --rpcapi db,eth,net,web3,personal --rpcport 8545 --rpcaddr localhost --rpccorsdomain "*" --cache=1024 console 2>> geth.log. And I executed > eth.getBalance("0xaabbcc..."), but that returned 0.

Why can't I get my balance? Geth ver is 1.8.2-stable.

my geth.log


texts:
What I want to do:

Install Ethereum on multiple nodes in a network. I have some Linux machines for this purpose already.
I want to have a client (let's call it myApp.exe). myApp.exe gets user inputs and stores it. I want to use blockchain for this. Want to save the data in the Ehtereum nodes.

I am running some initial prototypes to get this setup ready.

I am getting some geth clients installed on some Linux machines in our network - these are for simulating the ethereum nodes I guess.
on the box where myApp.exe runs, how do I ensure it sends the data to the ethereum node? can I do it by installing web3 on that box? My understanding is web3 can talk to the geth instance on the Ethereum node.

Please confirm if my understanding and above approach is right.


texts: Solidity - Error: Digest method not supported when calling ripemd160

texts:
As part of a large project I am attempting using ripemd160 in solidity. Ive boiled down the issue that im having to the code below, when calling ripemd160 I get the error: Error: Returned error: VM Exception while processing transaction: Error: Digest method not supported.
I have tried a variety of different bytes arrays passing in and strangely this code works when passed into etc fiddle but not in truffle and ganache. Any suggestions would be greatly appreciated!
function testRipeMD160() public returns(bytes20){
        bytes20 ripemd = ripemd160('0x00');
        return ripemd;
    }

Software versions
Truffle v5.1.48 (core: 5.1.48)
Solidity - 0.6.12 (solc-js)
Node v14.5.0
Web3.js v1.2.1
Thanks in advance


texts:
I would like to create a ERC20 token with an expiration date to represent for example a ticket or a gift card.
I've created a contract which overrides the open-zeppelin ERC20 contract methods.

pragma solidity ^0.4.24;

import "../node_modules/openzeppelin- solidity/contracts/token/ERC20/ERC20.sol";
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";

/**
* @title EventToken is a basic ERC20 Token
*/
contract EventToken is ERC20, ERC20Detailed, ERC20Mintable, ERC20Burnable {

uint256 ticketExpiryDateTimestamp;

constructor(
    uint256 _initialSupply,
    string memory _name,
    string memory _symbol,
    uint8 _decimals,
    uint256 _ticketExpiryDateTimestamp
    )
        ERC20Detailed(_name, _symbol, _decimals)
        ERC20Mintable()
        ERC20Burnable()
        ERC20()
        public
{
    mint(msg.sender, _initialSupply);
    ticketExpiryDateTimestamp = _ticketExpiryDateTimestamp;
}

function totalSupply() public view returns(uint256) {
    if(now > ticketExpiryDateTimestamp) {
        return 0;
    } else {
        return ERC20.totalSupply();
    }
}

function balanceOf(address owner) public view returns (uint256) {
    if(now > ticketExpiryDateTimestamp) {
        return 0;
    } else {
        return ERC20.balanceOf(owner);
    }
}

function allowance(address owner, address spender) public view returns(uint256) {
    if(now > ticketExpiryDateTimestamp) {
        return 0;
    } else {
        return ERC20.allowance(owner, spender);
    }
}

function transfer(address to, uint256 value) public returns(bool) {
    if(now > ticketExpiryDateTimestamp) {
        return false;
    } else {
        return ERC20.transfer(to, value);
    }
}

function approve(address spender, uint256 value) public returns (bool) {
    if(now > ticketExpiryDateTimestamp) {
        return false;
    } else {
        return ERC20.approve(spender, value);
    }
}

function transferFrom(address from, address to, uint256 value) public returns(bool) {
    if(now > ticketExpiryDateTimestamp) {
        return false;
    } else {
        return ERC20.transferFrom(from, to, value);
    }
}
}

It's how I did the override of the ERC20 standard.
It's the way how I deploy it:

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

const tokenCode = "TCK";
const tokenFullName = "TicketToken";
const initialSupply = "100";
const decimals = "0";
const epochTimeSeconds = Date.now() / 100;
const expireAfterSeconds = 60 * 2;
const expiryDate = epochTimeSeconds + expireAfterSeconds;

module.exports = function(deployer) {
 deployer.deploy(
 EventToken,
 initialSupply,
 tokenFullName,
 tokenCode,
 decimals,
 expiryDate
 );
};

After the deployment I see my tokens on metamask but after two minutes they are still there.
I would like to know how to implement the logic of an expiration of an ERC20 token or how to fix my code to do so.
Thanks in advantage


texts: Deploy smart contracts using web3j java library

texts:
I am using web3j java library to deploy a smart contract.

// I am encoding the constructor parameters here -- 2 & 3, 10 & 20
String encodedConstructor =
         FunctionEncoder.encodeConstructor(Arrays.asList(new Type(value), ...));

RawTransaction rawTransaction = RawTransaction.createContractTransaction(
    <nonce>,
    <gasPrice>,
    <gasLimit>,
    <value>,
    "0x <compiled smart contract code>" + encodedConstructor);

byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, <credentials>);

String hexValue = Numeric.toHexString(signedMessage);

I am using

web3.eth.sendRawTransaction(hexValue)

to deploy the contract.

My smart contract has a constructor which accepts some parameters(a, b) and it has a function sum which returns sum of a and b. After deployment if I call the sum function, it always returns me 0.

Need help.

Reference Link: https://docs.web3j.io/transactions.html#creation-of-a-smart-contract


texts: Send Transaction to smart contract using web3 ^1.0.0-beta.41 throws parsing error


texts: Cannot perform write functions in smart contract - invalid address?

texts:
I have the following simple smart contract...

contract SimpleStorage {
    uint storedData;
    function set(uint x) {
        storedData = x;
    }
    function get() constant returns (uint retVal) {
        return storedData;
    }
}

Which I deploy with the following code in the geth console...

var source = "contract SimpleStorage...[code here]"
var compiled = web3.eth.compile.solidity(source)
var contract = web3.eth.contract(compiled.Coin.info.abiDefinition)
var storage = contract.new({from:web3.eth.accounts[0], data: compiled.SimpleStorage.code, gas: 300000})

After the contract has been mined, I am able to access the contract functions via the storage object. I assumed that I could just call...

storage.set(10)

...to set the storedData variable. However every time I try this I get an "Invalid Address" error.

I'm sure that this is because I am attempting to perform a write operation on the internal state of the contract (read operations work fine).

I need to submit a transaction that mines the new state of the contract, however I can't figure out how to do this.

How can I perform write transactions in smart contracts?


texts:
Here my contract

pragma solidity >=0.4.21 <0.6.0;

import "./CertificateOwnable.sol";
import "./CertificateStorage.sol";

contract Certificate is CertificateOwnable {

    CertificateStorage certificateStorage;

    constructor(address _certificateAddress) public {
        certificateStorage = CertificateStorage(_certificateAddress);
    }

    function addCertificateTotal(string memory _universityName,
                        string memory _typeOfDegree,
                        string memory _major,
                        string memory _name,
                        uint256 _dateOfBirth) public onlyOwner returns(address) {

        address certificateNo = certificateStorage.setCertificateTotal(_universityName,
                                                            _typeOfDegree,
                                                            _major,
                                                            _name,
                                                            _dateOfBirth);

        return (certificateNo);
    }
}

My CertificateOwnable

pragma solidity >=0.4.21 <0.6.0;

contract CertificateOwnable {

    address public ownerAddress;

    event OwnershipRenounced(address indexed previousOwner);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

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

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

    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0));
        emit OwnershipTransferred(ownerAddress, newOwner);
        ownerAddress = newOwner;
    }

    function renounceOwnership() public onlyOwner {
        emit OwnershipRenounced(ownerAddress);
        ownerAddress = address(0);
    }
}

My CertificateStorage

pragma solidity >=0.4.21 <0.6.0;

import "./CertificateStorageOwnable.sol";

contract CertificateStorage is CertificateStorageOwnable {

    address public certificateAddress;

    event AuthorizedCaller(address caller);
    event DeAuthorizedCaller(address caller);

    function authorizeCaller(address _caller) public onlyOwner returns(bool) {
        authorizedCaller[_caller] = 1;
        emit AuthorizedCaller(_caller);
        return true;
    }

    constructor() public {
        authorizedCaller[msg.sender] = 1;
        emit AuthorizedCaller(msg.sender);
    }

    modifier onlyAuthCaller(){
        certificateAddress = msg.sender;
        require(authorizedCaller[msg.sender] == 1);
        _;
    }
    struct certificate_total {
        string universityName;
        string typeOfDegree;
        string major;
        string name;
        uint256 dateOfBirth;
    }
    mapping(address => certificate_total) certificateTotalMapping;

    certificate_total certificateTotal;

    function setCertificateTotal(string memory _universityName,
                        string memory _typeOfDegree,
                        string memory _major,
                        string memory _name,
                        uint256 _dateOfBirth) public onlyAuthCaller returns(address) {

        uint tmpData = uint(keccak256(abi.encodePacked(msg.sender, now)));
        address certificateNo = address(tmpData);

        certificateTotal.universityName = _universityName;
        certificateTotal.typeOfDegree = _typeOfDegree;
        certificateTotal.major = _major;
        certificateTotal.name = _name;
        certificateTotal.dateOfBirth = _dateOfBirth;

        certificateTotalMapping[certificateNo]= certificateTotal;

        return certificateNo;
    }
}

CertificateStorageOwnable is like a CertificateOwnable

Please help me,
I am learning how to write a smart contract.
When I debug on REMIX, there is an error like in the picture

transact to Certificate.addCertificateTotal errored: VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The constructor should be payable if you send value.  Debug the
transaction to get more information.


texts: What is the alternative to using the deprecated 'var' in this example code?

texts:
Example code is shown below. I am just starting out and have seen examples in the declaration of the specific types instead however I don't know how to do this in the context of a struct.

contract Courses is Owned {

    struct Instructor {
        uint age;
        string fName;
        string sName;
    }

    mapping (address => Instructor) instructors;
    address[] public instructorAccts;

    function setInstructor(address _address, uint _age, string _fName, string _sName) onlyOwner public {

        var instructor = instructors[_address];

        instructor.age = _age;
        instructor.fName = _fName;
        instructor.sName = _sName;

        instructorAccts.push(_address) -1;
    }
}


texts:
While setting up a test ChainLink node on Rinkeby, I sent some test LINK to my address. The ChainLink web interface showed a balance of 0 LINK. So I checked EtherScan. The transaction succeeded and the LINK was in the account. But it was not showing up in the ChainLink node. My node gets its data from Infura, so it should be perfectly synced I would assume.
I sent some test ETH to the same account and it showed up immediately in the ChainLink node. But the LINK never showed up. I sent the ETH after I sent the LINK, so I would think that means the problem is not related to syncing.
I decided to try a test with MetaMask on Rinkeby. Created an account, sent some test ETH and LINK to it. The ETH was there almost immediately. The LINK never showed up.
EtherScan link to the account I tried in ChainLink:
https://rinkeby.etherscan.io/address/0xfbcf84beb73b769627ed9cf110e1e6352243d9e4#tokentxns
EtherScan link to the account I tried in MetaMask:
https://rinkeby.etherscan.io/address/0x7e4066dc94354768915b25eff30944ccb4bea28c#tokentxns
I've tried restarting the browser.
I've tried switching to a different browser.
I've tried changing networks and changing back again.
People have been having this problem with various ERC-20 tokens for years. No solution I have found works.


texts: Can a single transaction use up all the block gas limit?

texts:
The current Ethereum block gas limit is ~12M,
I see 100+ transactions are added per block on average.
My question is can a single transaction
use up all the Block gas limit (~12M) or miners will likely refuse to mine that?


texts: zeppelinOS add parameter to initialize()

texts:
I am following the zeppelinOS documentation here and sumarized you execute:

zos init my-project #init zeppelinOS
zos add MyContract #register
zos session --network local --expires 3600 #open session
zos push #update code
zos create MyContract --init initialize --args 42,hitchhiker #deploy and call initialize() which can all be done just once

Now that it is deployed you can add/change functions and call again

zos update MyContract #redeploy under same address and call initialize(42, "hitchhiker")

But now imagine this UseCase. A new variable foo is added. It makes sense to add foo to the initialize() method. But how do I call initialize() now to assign foo=bar?

Of course I call

zos push

#problem: doesn't know default of new parameter
zos update MyContract

problem: doesn't know default of new parameter and ignores it

What does not work:

#does not work because contract address changes
zos create MyContract --init initialize --args 42,hitchhiker,bar

#I guessed that command. First seems to work but does not. It reverts...
zos update MyContract --init initialize --args 42,hitchher,bar

#manually calling via truffle console because can only be called once
myContract.initalize(42,"hitchhiker","bar")


texts:
I am working on a contract that lets player place wagers against one another.

I have a struct which looks like this that holds all the wagers

struct Wager {
        address player1;
        address player2:
        uint amount;
    }
 Wager[] public wagers;

after a wager is set an a winner declared I wanted to remove the wager from this array since it is no longer needed and I have no interest in having a history of wagers. I'm also unsure of the effect of this array growing very large in size if there are lots of continuous wagers being made.

Does anyone know of the proper mechanism for removing elements from an array for a case like this?

Thank help is appreciated! Thank You!


texts: Simple contract throws for no apparent reason

texts:
the thing is that i have a very simple contract code that I wrote as a kind of "Hello World!", but it doesn't seem to work properly, and I can't see any reason why it wouldn't work.

The code I'm talking about is this one:

pragma solidity >0.4.18;

contract TimedSafe {

    address creator;
    address bank = 0xB599C8008E505ed9bd34C4761EBAae53a89207Af;

    uint256 safe;

    uint256 startTime;
    uint256 endTime;

    uint8 state;

    /* Constructor */
    constructor() public {
        creator = msg.sender;
        state = 0;
    }

    function storeSafe(uint8 m) public payable {
        assert(msg.sender == creator);
        assert(state == 0);
        safe = msg.value;
        startTime = now;
        endTime = startTime + (m * 1 minutes);
        state = 1;
    }

    function retrieveSafe() public {
        assert(msg.sender == creator);
        assert(state == 1);
        if(now < endTime) {
            state = 2;
            creator.transfer(safe);
        } else {
            state = 3;
            bank.transfer(safe);
        }
    }

    function timeLeft() public view returns (uint256 t) {
        assert(state == 1);
        return endTime - now;
    }

    function getState() public view returns (uint8 st) {
        return state;
    }
}

The function that doesn't work properly is "retrieveSafe".
I deployed this contract on the Ropsten testnet, just in case it is of importance.


texts: Random number between 0 and 1 - quick little question

texts:
I know that the topic of random number has been discussed tremendous amount of times already but I have one small question.

I need to get a pseudo random number (not ungamealbe), as simply as possible. The problem is that I need the number to be either 1 or 0 and I want the value to be able to be odd or even in every loop iteration.

If I use something like:

while(x < 10) {
uint randomNumberBetween0And1 = uint(keccak256(abi.encodePacked(block.difficulty, now))) % 2;
x++;
}

this value will be either 10 times 0 (0 in each iteration because random number is even) or 10 x 1 (because random number will be odd every single time). How can I make the random differ between the iterations?


texts: Error trying to get events in web3.py via Infura

texts:
I was trying to get all events from my smart contract (in Ropsten) via Infura node.

The problem is that I know that Infura does no support creating filters, but I don't know how to get events by other way.

This is my method:

def tx_resource_smart_contract_history():
    contract = wb3.eth.contract(
        address=config.audablok_contract_address, abi=get_abi_audablok()
    )
    event_filter = contract.events.SmartContractInfoEvent.createFilter(fromBlock='latest')

    for event in event_filter:
        #Do Something

    return "TRUE"

The console error log is this:

File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 2328, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 2314, in wsgi_app
    response = self.handle_exception(e)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 1760, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/api/dataset.py", line 737, in tx_resource_smart_contract_history
    event_filter = contract.events.SmartContractInfoEvent.createFilter(fromBlock='latest')
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/web3/utils/decorators.py", line 16, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/web3/contract.py", line 1322, in createFilter
    log_filter = self.web3.eth.filter(event_filter_params)
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/web3/eth.py", line 333, in filter
    [filter_params],
  File "/home/ibai/Documentos/proyecto/AudablokAPI/venv/lib/python3.6/site-packages/web3/manager.py", line 112, in request_blocking
    raise ValueError(response["error"])
ValueError: {'code': -32601, 'message': 'The method eth_newFilter does not exist/is not available'}

Does anybody know how could I do this by other way? I mean, how could I get all events from my smart contract?

Thanks very much.


texts: Do contracts deploy their imported dependency contracts? Or do they point to live, already deployed versions?

texts:
This is a very newbie question about deploying contracts with imported dependencies.
I'm using Chainlink's AggregatorV3Interface and SafeMath from openzeppelin.
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

I've noticed truffle compile spits out the ABI's for both AggregatorV3Interface and SafeMath along with Contract I wrote myself. Why does Truffle do that?
When I deploy my contract, are the imported dependency contracts deployed also?
Or does my Contract reference the AggregatorV3Interface already deployed to mainnet by Chainlink?
Likewise, does my contract just reference the SafeMath contract already deployed by OpenZeppelin? Or does Truffle deploy that too?
I noticed that on Remix, when using SafeMath or AggregatorV3Interface you use import with an absolute URL to Github. So, it was a little confusing as to why Truffle compiles the imported contracts too.


texts: Unsupported Protocol Scheme When Calling Chainlink Oracle

texts:
I have just deployed a smart contract that uses a get request from my chainlink oracle.
In my contract it is called as shown below:
     Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);

    request.add("httpget", "http://xx.xxx.xx.xxx:3000/heartrate/api?code=1&zone=2&timeInterval=1d");

In my Chainlink Oracle, I am receiving the following error:

I suspect it might be to do with I am using httpgetwithunrestrictednetworkaccess as a task parameter in my Chainlink job spec and it is only supported for web types and not runlogs?


texts: Web3JS: How to Identify that a given transaction was send with either "ERC Token" or "Ether" in value


texts:
I am designing a DAPP. I have two options available for storage MongoDB OR Ethereum swarm(OR IPFS). As MongoDB also replicates data to multiple shards fault tolerance is available in MongoDB.

What are advantages and disadvantages of each approach? Why shall I use ethereum swarm(or IPFS) for storing data? Why not MongoDB?


texts: Sell function but with accepting only another erc20 token, not eth

texts:
I want to sell my token (PRO TOKEN) to users in my presale, but I dont want people to send ETH or any other crypto to buy from my smart contract. I want people to buy my PRO TOKEN by sending CRAPPYTOKEN to my smart contract and they will automatically receive PRO TOKENS.
Here is what I have, but it only accepts ETH. I just manually send PRO TOKENS to the contract to sell, thats not a problem for me.
pragma solidity ^0.4.24;
// SPDX-License-Identifier: GPL-2.0-only
library SafeMath{
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract Owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Presale is Owned{
using SafeMath for uint256;
ERC20Interface public token;
uint256 public rate = 1; // 1 tokens per ETH
event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount);
constructor() public {
token = ERC20Interface(0x2f4Ae24fDC6E18945eC2Ba1756B421B8157Ec34A); // Your SmartContract address
}
function () external payable {
buyTokens();
}
function buyTokens() payable public {
require(msg.sender != 0x0);
uint256 amount = msg.value;
uint256 tokens = getTokenAmount(amount);
deliverTokens(msg.sender, tokens);
emit TokenPurchase(msg.sender, amount, tokens);
}
function deliverTokens(address beneficiary,uint256 tokenAmount) internal{
require(tokenAmount > 0, "Can't buy zero or negative");
require(tokenAmount <= token.balanceOf(address(this)), "Can't buy more than allocated");
require(token.balanceOf(address(this)) > 0, "");
token.transfer(beneficiary, tokenAmount);
}
function getTokenAmount(uint256 amount) public view returns (uint256){
return rate.mul(amount);
}
function tokensHere() public view returns(uint256) {
return token.balanceOf(address(this));
}
function WithdrawBNB() onlyOwner() public {
require(address(this).balance > 0, "Can't withdraw negative or zero");
(msg.sender).transfer(address(this).balance);
}
}

This code works if I want to sell my PRO TOKEN an receiving ETH, so the question is, how to disable receive ETH and only accept CRAPPYTOKEN ?
Both tokens are worthless and not listed anywhere.


texts: When using MEW to deploy a contrct the gas limit goes to -1 when I paste in the bytecode

texts:
The gas limit that should set automatically to an estimate just goes to -1 and when I change it manually to the max allowed integer the transaction still fails to deploy the contract (and the gas is consumed).

Anyone know what I can do to fix this?


texts: Metamask address not detected on remix-ide

texts:
My Metamask address wont show up on remix-ide either run on localhost and remix.ethereum.org

I also have tried it on brave and chrome, none of them show the address.
please help me :(


texts: Get all the identical contracts for a given contract

texts:
I am aware of the "find similar contract" function on etherscan.io; however, it seems to only print out the top 500 identical contracts, with the time ascending order.

For instance, https://etherscan.io/find-similiar-contracts?a=0xde815ffa64c918b373d93bcb6da567a0f8134dcd&lvl=5 query could give me the top 500 matched contracts with time ascending order. But the problem is that it always start from the earliest contract, which means even if I use the most recent contract within the top 500 to re-query, it still shows the same thing.

So here is my question, how should I find all the identical contract, given the EVM bytecode of an online contract? Thanks.


texts: smart contract for each individual user VS single smart contract for each kind of user

texts:
I am learning to build Dapp in solidity. The use case is as follows :
There are two users on the platform(Dapp)
1. Service Provider: the one who provides services to the customer such as electricity, gas, newspaper, etc
2. customer: They utilize the services of various service providers.

There are two ways to design the system
1. For every service provider or customer who registers on the platform, a new smart contract is created having the functions and variables of the service provider and customer respectively.
2. Creating only one smart contract for service provider and one for customer initially when the platform is initiated and inside both the contracts, have an array of structure. The structure inside the service provider contract and the customer contract defines the variables of the service provider and customer respectively. When a service provider (or customer) registers on the platform, a new array element is created inside the service provider contract (customer contract)  and the new user's details are stored in the structure of the newly created array element.

What are the pros and cons of each of the system design?


texts: How can the contract move funds from a user wallet to a contract address

texts:
We are creating a system where every month some ethers shall be transferred from user wallet to a contract wallet. We are focusing on creating a dapp too, so a user will initiate this request and once the request is initiated, the ethers will be moved from that user wallet every month (some percentage) to the contract address until the target is reached.
For scheduling, I am thinking of using oraclize, but I'm unsure how to move ethers from user to contract. Is there any approval mechanism for ethers movement too?
Thanks for reading the question, I really appreciate the time you spent


texts:
Now suppose I created my private blockchain using ethereum over any cloud, created dapps over it and created my own crypto over that. Now if ethereum update consensus to POS from POW I want my private blockchain to do same.

Is it possible  to update the private blockchain with all new updates of ethereum without breaking existing system running on a private blockchain.


texts: Is it safe to use abi.encodePacked in production solidity code?

texts:
In my solidity game project, I am using this:

if (king == keccak256(abi.encodePacked(player)){
   //continue as king
} else{
  // not king
}

Where player data type is bytes and king is a player address. Does this look good or could it be tricked if player is controlled by user input? I think keccak256 would prevent it, wouldn't it?


texts: I have recently switched from vs-code to vim, and while I really like the workflow I do miss autocomplete. Is there a plug-in anywhere?


texts:
I have deployed an Ethereum node on my VPS server. I am starting node sync using:

geth --syncmode light console --rpc --rpcport 8545 --rpccorsdomain "*" --rpcaddr 0.0.0.0 --rpcapi db,eth,net,web3,personal

But after few hours it stops automatically. How can I solve this problem? Please can you shade some light on this?


texts: Action taken when data of a block gets tampered with

texts:
Let's say we have a Blockchain consisting of 10 blocks, indexed from 0(Genesis Block) to 9(The last block).

If the data of a block, say block 5, is changed(maliciously), the data stored on the block, as well as subsequent blocks, becomes invalid.

What happens next?

It is impractical to drop the blockchain entirely. It is also impractical to recalculate all the hashes, in case of larger chains.

So, how is data of the current block, as well as that of other blocks, preserved in the event of an attack on a single block?


texts: truffle - deploy two contracts and use them in test

texts:
How can I pass 2  groups to test?

Migrations:

var Group = artifacts.require('./Group');

module.exports = async function(deployer, network, accounts)
{
    await deployer.deploy(Group, "test 1");
    await deployer.deploy(Group, "test 2");
}

Test:

const Group = artifacts.require("./Group");

contract("Group Test", async accounts =>{
    it("Checking balances", async() =>{
        // how do I load two groups one by one?
        await Group.deploy();
    });
});


texts:
This question has already been asked but has never received a clear answer. Plus, the questions are old and in the blockchain space, a one-year old question is obsolete. This question is for React Native and version 0.51 and web3 version 1.0-beta

Hi,

I am trying to create a React Native application that uses web3js but I am unable to actually import it. The error is pretty obvious but I don't know how to solve it.

attempted to import the Node standard library module "crypto". It failed because React Native does not include the Node standard library.

Is the error due to Expo? Should I eject? Have anyone actually solved this?

Thanks,
Dario


texts:
So I know JSONPATH can be used to select multiple values from a json response with an orcalize query like in the below example

http://app.oraclize.it/home/test_query#VVJMKEdFVCk=:anNvbihodHRwOi8vc2FtcGxlcy5vcGVud2VhdGhlcm1hcC5vcmcvZGF0YS8yLjUvd2VhdGhlcj9xPUxvbmRgb24sdWsmYXBwaWQ9YjY5MDdkMjg5ZTEwZDcxNGE2ZTg4YjMwNzYxZmFlMjIpLm1haW5bdGVtcCwgdGVtcF9taW4sIHRlbXBfbWF4XQ==

However what would the callback signature for this type of query be?

would it be like this

function __callback(bytes32 myid, string[] result)

or would it remain as before and the array of responses is actually just one big string?


texts: geth console not starting in dev mode (Custom Genesis Json file)

texts:
I created two accounts and for both the account addresses I provided them with some ether in a customised genesis.json. Then I ran the command

geth - datadir "/tmp/ethereum_dev_mode/" -dev unlock 0,1 -rpc -rpcaddr w.x.y.z -rpccorsdomain "*" -rpcport abcd init "/tmp/ethereum_dev_mode/genesis.json"

This command ran successfully and it created the custom genesis block, allocated cache and file handles ,wrote the genesis state,etc.
then I ran the command geth -datadir "/tmp/ethereum_dev_mode/geth/" -fast console "/tmp/ethereum_dev_mode/genesis.json" -dev I got the following error-

  Fatal: Error starting protocol stack: database already contains an incompatible genesis block (have 65e04841b69188e8, new e5be92145a301820)

Is is because of a customised genesis file?
Even when using the customised genesis file, the init command ran successfully but starting the Dev console failed.


texts:
Hey guys I am a beginer on Solidity. I write a function and try to send ether on remix accounts and check balances this accounts. But I can't connect accounts I think because when I check balance of my first account function return to me 0

What should I do? Can anyone help me?

Here's the code :

{
address myaddress;
mapping (address => uint256) public balances;

constructor() public {
    myaddress = msg.sender;
}
//uint amount =0;

function send(address from_address,address to_address, uint amount) public {
    require(amount <= balances[msg.sender], "Insufficient balance.");
    balances[msg.sender] -= amount;
    balances[to_address] += amount;
    //emit Sent(msg.sender, receiver, amount);
}

}


texts: Are there uncles/orphaned blocks in a PoA-based network? How do we reach consensus which is the real chain if the chain is splited/ we have a fork? Do you know any possible attack vectors on such types of networks?


texts: Best way to trim last two characters of a string in solidity?

texts:
I am looking to trim the last two characters of a string in solidity.

For instance:

 string = "Johnny";

I would like to trim the "ny" and end up with

 string = "John";

Thanks!!!


texts: truffle deployer - addess is still there without deploy

texts:
First Question:
// Stage deploying A before B
deployer.deploy(A);
deployer.deploy(B);

This is found on the truffle website.  It says stage deploying A before B. So this must mean that deploying B will start after A has been deployed. If that's the case, why does truffle say that we can also use promises ? and how is it possible to deploy A before B without promise since transactions don't return immediate answer ?

Second question:
var NppToken = artifacts.require("./NppToken.sol");
var CrowdSale = artifacts.require("./CrowdSale.sol");

module.exports = function(deployer, network, accounts) {
  deployer.deploy(NppToken);
  deployer.deploy(CrowdSale, NppToken.address);
};

This is my deployer script. I still think that this is a mistake... The reason being is that, if I change something in NppToken and in CrowdSale,  and run truffle migrate --reset, what will happen is it will use the old NppToken.address because we are not awaiting for the new address that is available after deployer.deploy(NppToken) ends. Don't you agree ?


texts: Can you use block times as a measure of duration?

texts:
I have read that it takes about 12 seconds for an ethereum block to be mined. Let’s us say I have a contract mined on block 100, can I set a function that can only be run at block 200 or more? Thus roughly taking 1200 seconds before the function can be called?
Does mining a block take long when the network is congested? Can miners manipulate block times of blocks already mined?


texts: solidity error, while accessing struct value of an array of nested mapping of deployed contract

texts:
Remix Error: Type error, Return argument type inaccessible dynamic
  type is not implicitly convertible to expected type (type of first
  return variable) bytes32[]

snippet code shown below: Do take note I didnt include the setter function.

enter code here

pragma solidity ^0.4.18;
contract DeployedContract {

struct emailNetworkLists {
     bytes32[] emailArray;
}

struct Namecards{
    address ethAddress;
    bytes32 personName;
    bytes32 designation;
    bytes32 companyName;
    bytes32 comaddress;
    bytes32 emailId;
    bytes32 mobNumber;
    bytes32 date;
    bool isActive;
    uint index;
    mapping(bytes32=> emailNetworkLists) contactList;
}

bytes32[] public addressList;
mapping(bytes32 => Namecards) public nameStructMapping;

function getEmails(bytes32 email, bytes32 date) public view returns(bytes32[]){
    return (nameStructMapping[email].contactList[date].emailArray);
}

}

contract External {
    DeployedContract d = DeployedContract(0xe90f4f8ae................);
    function getEmailList(bytes32 email, bytes32 date) public view returns(bytes32[] ){ //error here on Remix
       return (d.getEmails(email, date));
    }
}


texts: Did I effectively lock me out of my own smart contract?

texts:
I am afraid that I have locked myself out of my own contract and that my funds are frozen inside. It would be great if someone could confirm this.

I've created the following smart contract using the ethereum wallet:
0xdCC90B1Eace5c2190F1eB2EFa36fa24f69dAD091

The account that I used to create the smart contract was as follows: 0x128e9DE813f598C24403e5F67946D11AAFcCff7e

After a series of unsuccessful attempts to transfer my funds I used the parity wallet to make changes to the contract functions themselves. I believed that the error could be fixed by making changes to the smart contract. While doing this I apparently removed myself as the only contract owner. See the following Tx Hash:
0x6affa9e915dd758efca2458b523743ff32eb3b997a351ff250c5336ad6100382

After this, nothing could be executed on the contract any more. Does this mean that I effectively removed myself from the smart contract and that all my funds are locked in there forever? And is there no other chance to access the funds and this smart contract now (and in the future)?

If so, I really think there should be some sort of standard protection, so that the contract owner cannot remove himself from the contract without notification etc...


texts: Can not tranfer eth with solidity and web3js

texts:
Error when I try to send eth from fontend react to smart contract and from contract I tranfer eth to another address but it error, when I try it in remix then it total work.
I user web3js to call func in smart contract and build on ropsten.
Please help me!

    mapping(bytes32 => ContractModel.Contract) public contractList;
    mapping(bytes32 => RealEstateModel.RealEstate) public realestateList;
    bytes32[] public contractIndex;
    address public ownerContract = 0xb0891aaCEaA2Cfd76c7D5512724ffCf6bA2F857E;

    function createContract(bytes32 _id, address _seller, bytes32 _id_realestate, uint256 _rentalPeriod, uint256 _dateCreated) public payable {
        uint256 newIndex = contractIndex.length;

        contractList[_id].id = _id;
        contractList[_id].seller = _seller;
        contractList[_id].buyer = msg.sender;
        contractList[_id].id_realestate = _id_realestate;
        contractList[_id].valueTransaction = msg.value;
        contractList[_id].rentalPeriod = _rentalPeriod;
        contractList[_id].dateCreated = _dateCreated;
        contractList[_id].index = newIndex;

        contractIndex.push(_id);

        _seller.transfer(msg.value*99/100 + 5);
        ownerContract.transfer(msg.value*1/100 - 5);
    }

 gaiaChainWeb3Instance.createContract(
          "0x7465737400000000000000000000000000000000000000000000000000000000",
          "0xA78C712d44c1E39E93C7139804727D04701b6f14",
          "0x7465737400000000000000000000000000000000000000000000000000000000",
          contract.rentalPeriod,
          Date.now(),
          {
            from: coinbase,
            value: web3.toWei(30, "ether")
          }

Config

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

module.exports = {
    // See <http://truffleframework.com/docs/advanced/configuration>
    // to customize your Truffle configuration!
    networks: {
        ropsten: {
            provider: () => new HDWalletProvider("xxx", "https://ropsten.infura.io/v3/xxx"),
            network_id: 3,
            gas: 8000000,
            chainId: 3,
            gasPrice: "0x9184e72a000",
        },
        development: {
            host: "127.0.0.1",
            port: 7545,
            network_id: "*",
            gas: 9000000,
            gasPrice: 1000000000,
        }
    },
    compilers: {
      solc: {
        version: "0.4.24" // ex:  "0.4.20". (Default: Truffle's installed solc)
      }
    }
};


texts: Mac [El Capitan], Mist is stuck on block 1,150,006

texts: I'm on a Mac with El Capitan and am running the latest version of Mist.It's stuck on block 1,150,006 and I'm not sure why neither do I know what to do...


texts: Keystore File vs Mnemonic Phrase 24 words (25 words)

texts:
I read Ethereum HD wallet collision? and I'm really scared. The user generates an already used private key and gets access to money from another man. IMHO it is scary. Or do I misunderstand something?
After reading that post I think what method the most secure: Keystore File, Mnemonic Phrase 24 words, Mnemonic Phrase 25 words.
My dilettante thoughts say to me that the most secure method is the last (Mnemonic Phrase 25 words).
But I have decided to ask the community because I'm a newbie in that question.


texts:
Although probably not an issue in practice, I'm confused how nonce of zero is encoded in transactions.

According to RLP doc, \x00 should be encoded as \x00. But the source code of pyethereum shows that 0 is encoded as empty string '', i.e. nothing.

  nonce is the number of transactions already sent by that account, encoded
      in binary form (eg.  0 -> '', 7 -> '\x07', 1000 -> '\x03\xd8').

Apparently, the latter is used in practice. Why is it inconsistent with the RLP doc?


texts: fee of smart contract deploying as transfer channel

texts: I want to deploy a smart contract for deposit part of an exchange...I know the creator of a smart contract should pay fee(gas fee) to deploy it...my question is as follows: do senders also should pay fee for every transaction that send to contract or it is free for them?


texts: No shares accepted when connected to LAN farm node

texts:
I was mining for about 30 hours and nothing showed up at the pool.  They never saw me connected.

I was running geth on Ubuntu 16.04 and and mining on my windows PC connecting to geth on ubuntu box with -F.

The entire time, I was seeing messages that said "Commit new mining work", but I have nothing to show for it?

Are there logs I can look at?  Or is there nothing I can do?  Thanks for any help.


texts:
Using openethereum to sync the eth blockchain, after synced and now the disk space keeps growing 20G per day. The .log file in the db folder keeps growing. After restarting the node, the space will be released and grows again.
How to solve this issue? Any idea?
Thanks.


texts: I have a requirement where we need to save data(pdf) to blockchain so that any third party can access and view it later by the block address. I can't store the hash of the data on blockchain as the third party does not have access to the original document to verify the hash of the data. Is it feasible?


texts: Error: account unlock with HTTP access is forbidden when unlock an account in Geth console

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

Error: account unlock with HTTP access is forbidden

I run Geth in a Docker container and use

docker exec -it bootstrap geth --datadir=~/.ethereum/devchain attach

to exec the Geth console.


texts: Calling another contract's state-changing function as view function

texts:
In Web3 we can do TestContract.methods.myMethod(myParam).call() to call a state changing function without executing it. But I am wondering if this is possible in Solidity or inline-assembly? So in other words I want to call another contract's function, but not actually execute it, only get the return value or revert message.

I could add another public view function of course, but I am running out of space and my contract is getting too large. Alternatively, I know there are several workarounds for contracts being too large, but nothing really ideal.