texts: Send ethereum tokens with zero gas price

texts:
I have seen the following transaction:

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

And I've seen that the gas price is 0. How could I do the same? When I use web3 it says that transaction is underpriced, however if this guy has sent tokens at gasPrice 0 it must be possible. I've seen that some pools do accept transactions with gas price 0.

Do you know how I could send the tokens without setting a gas price? Is there a specific client that may allow me to do this?

I am aware of the implications of not setting a gas price, the transaction may not get mined and such. I just want to know how this can be done.


texts: Enigma "secret contract" and concealing transactions history: How is it possible?

texts:
Enigma protocol is a second-layer, off-chain network that aims to solve privacy issues in blockchain.
However
In Enigma blog, there is an article (Link to Article), explaining the secret contract, including an example as follows:

"To give an example of a potential secret contract, imagine a lending
dApp that can autonomously give out loans to users. To function, it
operates a smart contract that tests each individual’s eligibility by
scanning their wallets and prior transactions, then computing if the
individual should receive a loan (and if so — how big it should be).
For example, it may examine if you asked for loans in the past, and
whether you paid them back on time.
With a normal smart contract, a user would need to disclose all of
their transactions publicly. This means that everyone would have
complete visibility to your finances. Since most users aren’t likely
to opt into such a service, the only option left to the dApp provider
is to keep the actual computation of eligibility centralized, in order
to limit the exposure of the sensitive data to the provider itself. In
this hybrid approach the dApp is no longer autonomous or truly
decentralized, as it cannot operate without the aid of the provider.
The dApp thus retains all of the weaknesses of centralized
applications, with few of the advantages.
Instead, in a setting where secret contracts exist, a user can share
their transaction history safely with the secret contract itself. The
nodes can execute the contract and receive the eligibility result
without being able to observe the user’s transactions. There is no
longer a need to create a hybrid dApp. This dApp could be autonomous
end-to-end, while guaranteeing both correctness — if a user is
eligible for a loan, she will get a loan; and privacy — no one but the
user can see their transaction history."

My question is about the following phrases:

(1) "With a normal smart contract, a user would need to disclose all of
their transactions publicly"
(2) "Instead, in a setting where secret contracts exist, a user can share their transaction history safely with the secret contract itself.
The nodes can execute the contract and receive the eligibility result
without being able to observe the user’s transactions."

This example is an expanded version of Enigma paper, page 13, section 8.8. Crypto Bank, where this use case is explained as follows:

Crypto Bank:
"Run a full-service crypto bank without exposing private
internal details. Users can take loans, deposit cryptocurrencies or
buy investment products with the autonomous control of the blockchain,
without publicly revealing their financial situation."

From my point of view, a user eventually needs to present himself by using his address (either by normal contract, or by secret contract), by which it is possible for everybody to see all his transactions history using an explorer website.
(1) How can Enigma secret contract prevent someone to see transactions history of a user?
And
(2) How can a user conceal his address and at the same time receive the loan, using secret contract?
Note: For (1): According to Enigma paper (page 8), workers are able to see only encrypted data and eventually public output is stored in blockchain. For (2): Of course, users can generate many addresses to make de-anonymization techniques more difficult. However, the point is that what is the role of secret contract in this particular scenario of this example? As author claims that it's secret contract which prevent someone to see the history of transactions of user who gets loan.


texts: How can I read log/events that have been triggered in the past?

texts:
I have a smart contract with an event.

    event NewContractCreated(address _callerAddress, address _newContractAddress);

I know how to actively listen for new events:

var newContractEvent = myContract.NewContractCreated();
newContractEvent.watch(function(error, result){
      if (!error){
        console.log("Success");
        console.log("New Contract Address: " + result.args._newContractAddress);
        console.log("Creator: " + result.args._callerAddress);
      }
  });

That works just fine for me. But my question is: how do I listen for and pull the exact same data for events that happened before I started watching?

I tried the exact same thing but using get instead of watch... it half worked. It printed the top line "Success" but did not print the rest of the log lines.


texts: Best practices to solve the problem of a contract that is too large?

texts:
My contract is too large to deploy (gas cost) and I can't remove any functionality from it, so I need to split it up into two contracts that interact with each other. The first contract will be the only one the users interact with and the second one will throw any calls to it that are not from the first contract.

However, in my attempts at doing this, I've wrestled with how I should split up my variables and code between the contracts.

Q1: Is there a standard architecture/technique for doing this? How would you go about it?

Also, some questions:

Q2: Do mappings and arrays have automatic accessor functions? What about
mixtures of mapping and array?If so, what is the syntax for these?
Q3: What are the gas concerns related to splitting up a contract in this
way?


texts:
I am working on a private blockchain (currently block #16117). I have pregenerated the DAG for epoch 1 as well. So, I started the geth instance with --autodag=false. However, I still get the following message when I start mining:

I0707 10:24:57.871976 eth/backend.go:452] Automatic pregeneration of ethash DAG ON (ethash dir: ~/.ethash)

I am not sure how to disable this. Is the --autodag=false command wrong? Is there a way to do this from the JavaScript Console?

  geth version - 1.4.9-stable


texts: How to open metamask erc20 transfer window using web3 apis?

texts:
In my frontend I have 'withdraw' and 'deposit' buttons. I want to display the metamask screen that comes after clicking on the deposit and send buttons (of metamask) when the user clicks on the deposit and withdraw buttons (of the frontend) respectively. So basically, the flow would be like - the user clicks on a button in the frontend say 'deposit' then the metamask pop-up should display the screen that would have appeared if one would manually click on the deposit button in the initial metamask pop-up screen and so on.

I'm not too sure if there is really a way to do so. If yes then kindly enlighten..


texts: How to call two functions in atomic transaction from web3 node client

texts:
I need to call two functions in an already deployed contract I do not own in an atomic transaction. I thought the simplest way to do this would be to wrap the two functions in a new contract function.

contract deployedContract {
  function A(uint a1, ...) {}
  function B(uint b1, ...) {}
}

contract myContract {
  function C(uint a1, a2, b1, b2, ...) {
   // pseudo code
   deployedContract.A(a1, a2, ...);
   deployedContract.B(b1, b2, ...);
  }
}

However, the total number of parameters in the two methods I need to call is 20, and therefore I get the stack too deep exception from the Solidity compiler.

Is there any way to make two function calls from a web3 node client atomic?

Thanks


texts:
I used to use the old version of infura and it worked just fine. The latest version is not working as it states that it cannot find the id despite it being there.

https://mainnet.infura.io/v3/da3717f25f824cc1baa32d812386d93f

Error log:

Error=-25300, query={
   class = inet;
   “m_Limit” = “m_LimitAll”;
   ptcl = htps;
   “r_Attributes” = 1;
   sdmn = “Project ID is required in the URL”;
   srvr = “mainnet.infura.io”;
   sync = syna;
}

Snippet: https://github.com/AlphaWallet/alpha-wallet-ios/blob/master/AlphaWallet/Tokens/Helpers/CallSmartContractFunction.swift


texts: How could msg.sender != tx.origin AND extcodesize(caller) == 0 be true?

texts:
I'm working on a puzzle where msg.sender != tx.origin, so the implication is that the caller needs to be a contract or at least something in between the calling account.

But extcodesize(caller) == 0 also needs to be true. So the caller needs to be an address or externally owned account.

How can both of these be true? Can the caller's codesize ever be 0 if not an address/EOA?


texts: Ganache is not updating my contract status

texts:
I am using ganche for local ethereum. I have successfully deployed my contract through web3js on ganache. (The same contract also tested on Remix, all function properly running as per logic). Now i can see my contract on ganache. then i call some of my function (of smart contract) only is responsing , but the functions which can change the status of state variables, are not running.
Here is my code ;

async function manCalFun() {
var myContAddr = '0x8175036782E9564C084eD1DA6C44C27150F24316'; // deployed locally on ganache

var myContractAbiDefenition = sources[0].abi;
var myContractInstance = new web3.eth.Contract(myContractAbiDefenition, myContAddr);
 res = await myContractInstance.methods['balances']("0x2cAe18ac37d85CccdE2ebB63D0c391Fe1ac7c36f").call({from: account1, value: web3.utils.toWei('0', 'ether')})
 res = await myContractInstance.methods['buyToken']().call({from: account1, value: web3.utils.toWei('2', 'ether')}) ..... this is not working
 res = await myContractInstance.methods['setTotalSupply'](5).call({from: account1, value: web3.utils.toWei('0', 'ether')}) ... this is not working
 res = await myContractInstance.methods['getTotalSupply']().call({from: account1, value: web3.utils.toWei('0', 'ether')}).. this working properly
console.log("output: ", res)
}

and here is ganache log (which shows that its taking my transaction, but do nothing, except for getTotalSupply function:

8:41:14 PM] eth_call
[8:42:06 PM] eth_call
[8:42:20 PM] eth_call

Also i want to know that whether is it necessary to send every transaction with signature (even on local ganache) ?. By the way i had deployed my contract through signing my transaction like this ;

const transaction = contract.deploy(params);
const options = {
    data: transaction.encodeABI(),
    gas: await transaction.estimateGas({from: account1})
};

const signed = await web3.eth.accounts.signTransaction(options, privateKey1);
receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction);

Source Code of Contract:

pragma solidity 0.5.12;

contract MyContract {

    uint256 public  totalSupply ;
    mapping( address => uint256) public  balances ;
    address payable public owner;

    constructor(address payable _wallet) public payable {
        totalSupply = 6;
        owner = _wallet;
    }

    function () external payable{
        buyToken();
    }

    function buyToken() public payable {
        require(totalSupply >= (msg.value/1000000000000000000)*2);
        balances[msg.sender] += (msg.value/1000000000000000000)*2;
        totalSupply -=(msg.value/1000000000000000000)*2;

    }
    function getTotalSupply()public view returns  (uint256 ){
        return totalSupply;
    }
       function setTotalSupply(uint256 newSupply) public payable {
        totalSupply = newSupply;

    }

}


texts: General - Guide to getting setup on testnet and solidity on a Mac

texts:
I just purchased a new Macbook with the hopes of getting started developing dapps via solidity. Does anyone have a good resource/guide to getting started with testrpc on a mac?

Thank you!


texts: Is there any possible way to watch missed event? suppose my sever was down when the event was emitted in he contract, how can I watch all those events that I missed to watch during the server off time?


texts: Connect Typescript dependency with Solidity contract

texts:
How can I connect my contract with typscript dependency (https://www.npmjs.com/package/@dydxprotocol/exchange-wrappers).
I need this function (https://github.com/dydxprotocol/exchange-wrappers/blob/master/contracts/exchange-wrappers/OasisV3MatchingExchangeWrapper.sol#L69).

If this information is not enough for a solution, write what you need.


texts: How was the name "Ethereum" chosen? Is there a meaning or story behind it? Did Vitalik Buterin choose it or did someone else?


texts: How difficulty is related to mining in ethereum blockchain ?

texts: I am very much curious to know how difficulty is related to the mining process and how the static difficulty will effect the mining process ?


texts: User Logon setup on dapp with minimal ether

texts:
For my project, I have to set up a user login option on the site (dapp) home page. I do not wish to have conventional server-side setup to save login details. Instead, I want to use web3 based Metamask or related options.
For a simple log-on to the site, I do not wish to charge any ether from the user.

But the side-effect of this implementation will be on the mining of the transaction. Becuase of no incentive associated, I understand that mining of the transaction will be delayed as miners will not be interested because of zero incentives.

Is there any viable option which can trade-off both the aforementioned cases?

I believe many fellow developers must have come across this scenario, please suggest how to circumvent it. Will appreciate if supporting code or blog links can be provided that I can follow for further details?

Please excuse me for my noob status in smart contract design.


texts:
In DEFI does each token-pair produce its own LP token?
Let us say I am in uniswap does each token pair produce its own LP pair when you provide liquidity or is it just one LP token regardless of the liquidity pool?


texts: I've got an error while compiling.Use "constructor(...) { ... }" instead

texts:
I've followed the lecture on Udemy. But I've got an error

here's my 'Inbox/contracts/Inbox.sol'

pragma solidity ^0.4.17;
contract Inbox {
    string public message;

    function Inbox(string initialMessage) public {
        message = initialMessage;
    }

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

and here is a 'Inbox/compile.js' file

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

const inboxPath = path.resolve(__dirname, 'contracts','Inbox.sol');
const source = fs.readFileSync(inboxPath, 'utf8');

console.log(solc.compile(source, 1));

and after I compile this file on terminal

  node compile.js

got an error like below

  errors:
           [ ':6:5: Warning: Defining constructors as functions with the same name
as the contract is deprecated. Use "constructor(...) { ... }"
    instead.\n    function Inbox(string initialMessage) public {\n    ^
    (Relevant source part starts here and spans across multiple lines).\n' ],

I use mac.
One thing I did differently from the lecture was 'npm init' in other folder instead of Inbox and
I coppied and pasted all the files created to inbox folder.


texts: web3.admin.addpeers return BigNumber Error

texts:
When I using ethconsole to deal with a private chain. I hope it can connects to another node which I get the node information.
But the command "web3.admin.addPeer("enode://...@192.168.1.29:30304",function () { console.log(arguments) })" return an error.
That is "BigNumber Error: new BigNumber() not a number: enode://...@192.168.1.29:30304 ".
What happened here? How to connect to another node by using ethconsole in cpp-ethereum client?


texts: populus : how do i deploy a contract with args in the constructor?

texts:
Suppose I have a contract with some parameters that can be passed in the constructor, how am I suppose to pass them within the framework ?

I tried to search the docs at the deploy part but can't find the answer there.

I see that git pull that seems to be kind of what I want, but I fail at knowing how practically I can pass them.


texts: Equivalent of `web3.eth.accounts[x]` in web3 1.0.0-beta.27

texts:
I have testrpc initialised:

testrpc -a 10

And have connected via http from a node command line using web3 version 1.0.0-beta.27:

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

I'd like to be able to access the 3rd of the accounts initialised in testrpc using web3. In version 0.x.x I'd use web3.eth.accounts[3]. In the  beta it seems that the process will change (docs) to use a getAccounts function.

Here's what I've attempted with the console output - I can see the list of accounts but can't seem to access them - there's possibly something simple I'm missing?

> web3.eth.getAccounts(console.log)[3]
undefined
> null [ '0xEc9F5cEF462dc92C1A04758b93Bf940142dD9AB8',
  '0xF1EB9C3FCa1e8e43597eB9Ec9204b57811317483',
  '0xCf7127dAc175E7d0cB5AB989DDCBa993Af5CC257',
  '0xddAB30A0b405FDe916060dAb961A8939bcB0292c',
  '0x76721db21AA265453BD17FCE53637D5A621AD434',
  '0x8a2D213434034DbE47501DEC88Cf2c74eaF7cA78',
  '0xBa523A69318A831F7463C88CF2e96143e4643Ae1',
  '0xDE8f72ad2221f5dc188cC2c780E256Ce0f8e16A4',
  '0x9E10ec8A473a15b37D8EcdD65d3f9c4f04f5eD83',
  '0xedc486961d350d26F8Df6D9b5CD5451Dc4ebCAc5' ]

> web3.eth.getAccounts().then(console.log)[3]
undefined
> [ '0xEc9F5cEF462dc92C1A04758b93Bf940142dD9AB8',
  '0xF1EB9C3FCa1e8e43597eB9Ec9204b57811317483',
  '0xCf7127dAc175E7d0cB5AB989DDCBa993Af5CC257',
  '0xddAB30A0b405FDe916060dAb961A8939bcB0292c',
  '0x76721db21AA265453BD17FCE53637D5A621AD434',
  '0x8a2D213434034DbE47501DEC88Cf2c74eaF7cA78',
  '0xBa523A69318A831F7463C88CF2e96143e4643Ae1',
  '0xDE8f72ad2221f5dc188cC2c780E256Ce0f8e16A4',
  '0x9E10ec8A473a15b37D8EcdD65d3f9c4f04f5eD83',
  '0xedc486961d350d26F8Df6D9b5CD5451Dc4ebCAc5' ]

I've tried a few variants of the above - the output I'm aiming for is 'OxddAB...'

What command in web3 v1.0.0-beta.27 reproduces the behaviour of web.eth.accounts[3] in web3 v 0.x.x?

I'd like to understand the reason for the proposed change, in case anyone here knows or can provide a link...

Edit - Managed to do it like this:

var a=web3.eth.getAccounts(console.log)
a._rejectionHandler0[3]

but it seems clunky/incorrect - can anyone improve?


texts: A public node URL which can take connection of ethers.js in React Native app

texts:
I just installed ethers.js in my React Native 0.63 app and would like to conduct brief checks to see if the lib is up and running. What I need is to have a Ethereum node URL as there is no Metamask or other node on the mobile device. Here is the test code :
 let url = NODE_URL; //need a URL of ethereum node which can be connected by the app
 const provider = new ethers.providers.JsonRpcProvider(url);
 provider.getBlockNumber().then(result => {
 console.log("blockNumber returned : ", result);
}).catch(error => console.log("Connection mainchain error ", error)); //<<==test by getting the blocknumber

Is there a public ethereum node which my React Native app can make connection to? Or is there other way to test the connection of the lib?


texts: Understanding data payload on contract call

texts:
I'm running truffle's default example Metacoin:

import "ConvertLib.sol";

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

  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;
    return true;
  }

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

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

When I run the application and send some coins, it generates the following payload:

{
    "jsonrpc": "2.0",
    "method": "eth_sendTransaction",
    "params": [{
        "from":"0x86b737b44e4b04d92ff7ee7b5604cc755e2c1124",
        "to":"0xea1ab86f57e0faccca14510d883cc660d5453995",
        "data":"0x90b98a11000000000000000000000000914e95d7b57c1899f0a77fb1f08a9ae02b01258200000000000000000000000000000000000000000000000000000000000000ff"
    }],
    "id":38
}

I've sent 255 Meta to address 0x914e95d7b57c1899f0a77fb1f08a9ae02b012582 calling sendCoin(). Then I was trying to understand the data payload, breaking it down:

?? 0x90b98a11000000000000000000000000

address to (20 Bytes) -> 914e95d7b57c1899f0a77fb1f08a9ae02b012582

uint value (32 Bytes) -> 00000000000000000000000000000000000000000000000000000000000000ff

The first part (16 Bytes) of the data payload I assume will identify the sendCoin method inside the deployed contract.

If so, how?
Do these 32 Bytes just identify the method name or can it be broken down even more?


texts: Truffle has not out of the box support for MeteorJS. Does this mean that meteor is not supported by Truffle? How easy is it to bring it together?


texts: I have a smart contract in Remix and would like to be able to filter events using Infura. I know nothing on how to get started. I went to infura and created a project which has a project ID. What should I do next? How do I connect them together?


texts: Trying to understand how to calculate the profitability of Ethereum mining based on hashrate

texts:
I'm very new to Ethereum/cryptocurrencies, I'm trying to understand how to rate the efficiency/profitability of GPU cards

Question

If I exclude power bills / hardware aquisition costs, am I correct that hashrate is pretty much the only thing that matters to calculate profitability, and that it depends on:

GPU Card
Hash algorithm

Story behind

So I found this post, where OP is enquiring about hashrate of the GTX 1060.

One of the posts gave these hashrate numbers:

Lyra2REv2 ==> 22.5 MH/s
blake2s ==> 1180 MH/s
LBRY ==> 175 MH/s

The hashrate difference between algorithm is huge, is this normal?

I found many conflicting hashrate numbers all over the Internet, but most comments I've read are talking about 20 MH/s, which makes the blake2s 1180 MH/s rate so extreme that I'm wondering if I'm missing something...


texts: Does geth have to sync before getting public data?

texts:
I started a geth node, passed in the ABI and ran contractInstance = MyContract.at('..').

Then when I ran contractInstance.somePublicVariable(123) I am seeing 0 values everywhere.

Is this because my geth node hasn't synced with this public contract? Does my geth node need to sync if its in fast syncmode? Or does it just ask peers for this data? What about in light syncmode?


texts: Is it good practice to throw in Solidity Constructor

texts:
If I have a Smart Contract with a different Contract as parameter the parameter can be undefined which would be bad. Is it good practice to have a require(address(paramContract) != 0x0) statement in the constructor?

I'm tempted to do it because it makes sense but it sounds wrong to have a possible throw in the constructor


texts: geth 1.8.8 miner hashrate 0 after join network where major miners ran on older version

texts:
I am planning to upgrade my miners from 1.7.x to 1.8.x.

For testing purposes, I've made a copy of geth's data and then I run a new version of the geth miner against my copied data. After the new miner finishes DAG generation, I waited to see the Hashrate of the new miner. Unfortunately, the new miner hashrate is always zero.

Did I do something wrong?


texts: I tried to get rinkeby ethers from https://faucet.rinkeby.io/ by creating a tweet but the website shows "insufficient funds for gas * price + value” error. I also tried the website faucets.blockxlabs.com, it shows the transaction to be successful but I didn't receive any rinkeby ethers. I am a newbie in working with test networks, any help would be appreciated. Thank u!


texts: Is it possible to get transaction history on a wallet address from inside a smart contract in solidity?

texts:
I'm hoping to implement something like this, for even external tokens:

transaction_details(address, token_contract)

which will return the transaction history, i.e. sender, receiver, amount, timestamp...

Is this possible from inside a smart contract?


texts: Dapp fundamental q about listening solidity events

texts:
Sol:
I created contract with events that are raised when is called some function.

Html fo:
Those functions are called via web3.js with abi and address - easy.

Backend (no js) asp or php:
I am not familiar with node.js so i am trying find something different.
I want store all events raised by my contract in relation database.
- and that's the point when i am completelly out ..how to catch every new raised event
1. Do I need own rpc node?
2. Do I need websocket - endpoint?
3. Must I send requests  to the EVM everytime or how can I get every raised event from my contract?
4. Exist somewhere some simple implementation or article that solved this fundamental question. Perhaps I am wrong and i don't understand how it works. please correct me.
ty.


texts:
I'm using a low level delegatecall to forward my calls to a library.

I need to (in this order) :

load bytes4 sig into _message from memory
load bounty (STRUCT) into _message from storage
load bytes _data into _message
Delegatecall with the new message
Get return valuesThe contract works (eg the getBounty function will work) but I'm having trouble with the assembly in my forwarder() function. https://ethfiddle.com/po3wHGQraJ

I'm having trouble making my forwarder (in assembly) work properly however.

  function forward(bytes32 _sig, bytes memory _data) public payable {
    bytes memory data = _data;
    bytes4 sig = bytes4(_sig);
    address _impl = impl;
    require(_impl != address(0));
    assembly {
      let _message := mload(0x40) //find empty memory location
      mstore(_message, sig) //place sig at beginning of empty storage
      //add _bounty
      mstore(add(_message, 4), sload(bounty_slot))
      //add _data
      calldatacopy(add(_message, 36), 100, sub(calldatasize,100))
      //mstore(add(_message, 36), data)
      let size := returndatasize
      let result := delegatecall(gas, _impl, _message, msize, 0, 0)
      //return data ??????
      returndatacopy(_message, 0, size)
      switch result
      case 0 {revert(_message, size) }
      default { return(_message, size) }
    }
  }

This is what the storage looks like:

0x00
0x687474703a2f2f6170692e6269746275636b65742e636f6d2f33303433303430
0xe1bb4acb579f780cbaf21cef9ac3641b8e3fcd69
0x5b7eaef7
0x3334303330340000000000000000000000000000000000000000000000000000
0x012a05f200
0x00
0x00
0x059ce9161d4fb0
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00


texts: Solidity external call with bytes4 / keccak256

texts:
I want to call a Contract1's function from Contract2.
I know the way i've tried is deprecated, but i want to understand. This is why i've set a very old solidity version with the pragma directive.
I do not understand why f1 and f2 are still equals to zero when i call test_call3 function...
Any idea ?
Thanks
pragma solidity 0.4.11;

contract Contract1
{
  uint public f1;
  uint public f2;

  function myfunction(uint param1,uint param2) external
  {
      f1 = param1;
      f2 = param2;
  }
}

contract Contract2
{
  Contract1 c = Contract1( <deployment_address_of_Contract1>);

  bool public success;

  function test_call3() public
  {
       success = address(c).call(  bytes4(keccak256("myfunction(uint256,uint256)")),  400, 500);
  }
}


texts:
I am trying to upload the file to IPFS from HTML page and below is my code but I am getting below error.

Uncaught ReferenceError: Buffer is not defined

I have imported below statements

src="https://unpkg.com/ipfs/dist/index.min.js"
src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"
src="https://unpkg.com/ipfs/dist/index.js"
src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.js"
src="https://unpkg.com/ipfs-api/dist/index.js"
src="https://unpkg.com/ipfs-api@9.0.0/dist/index.js"
integrity="sha384-5bXRcW9kyxxnSMbOoHzraqa7Z0PQWIao+cgeg327zit1hz5LZCEbIMx/LWKPReuB"
crossorigin="anonymous"

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

 <form action="/">
      <fieldset>
        <legend></legend>
        <input type="file" name="photo" id="photo">
        <button type="button" onclick="upload()"></button>
      </fieldset>
    </form>


texts: what is data in this upgradeable smart contract constructor and how to calculate it

texts:
I am trying to deploying a proxy contract address, however I do not understand what is data in the constructor and how will I calculate it? I know there will be some argument encoding involved but I am confused about that.
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
  /**
   * Contract constructor.
   * @param _logic address of the initial implementation.
   * @param _admin Address of the proxy administrator.
   * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
   * It should include the signature and the parameters of the function to be called, as described in
   * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
   * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
   */
  constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
    assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
    _setAdmin(_admin);
  }


texts: How to get an instance for a previously migrated contract with truffle?

texts:
Scenario:

Token contract migration file
Dapp contract migration file

I want to interact with the already deployed token contract in the dapp contract migration file.


texts: Can I use eth.subscribe for incoming transactions tracking?

texts:
In Parity docs I see the following description of eth_subscribe:

Starts a subscription (on WebSockets / IPC / TCP transports) to a particular event.
For every event that matches the subscription a JSON-RPC notification
with event details and subscription ID will be sent to a client.

Is there any way to use it for tracking transactions coming to my wallet - considering that sender doesn't has any Smart Contract features in his wallet?


texts: Can't claim EOS tokens. Problem with GAS amount when claim EOS tokens

texts:
To make story short,I participated in 167 EOS distribution period, so i've sent ETH amount to their account 0xd0a6E6C54DbC68Db5db3A091B171A77407Ff7ccf. Then i've registered my public EOS key and right after 167 distribution period ended i tried to claim tokens as it described here https://prnt.sc/hkuko6

Claim EOS Tokens

Select claimAll.

Unlock your Wallet

Amount to Send: 0

Gas Limit: at least 90000

But i have error every time, it says:

Warning! Error encountered during contract execution [Out of gas].

Here is a screenshot http://prntscr.com/hkvb1z.
I had this error a few times, despite the fact that suggested gas amount should be at least 90 000. Also i've spent 15$ equivalent to ethereum with no result. Does anybody know where the problem is?


texts:
I see that this has been a widely discussed topic in the past but I still don't understand why the future block hashes shouldn't be used for lottery-type games. As long as the incentive for a miner to not publish a given block (in order to alter the results of the game) is less than the difference in uncle vs main block reward, this should work. Given, that in case of losing in the game, the miner can choose to publish as an uncle so that the block hash does not determine the outcome of the game.

It's true that the game won't be completely shielded from miner influence, but considering that blockchains in general are based on incentives to keep everyone honest, this seems like a decent solution. Is there something that I'm missing?


texts: Basic Blockchain Implementation: how is the blockchain on a given node "synced" with that on another node?

texts:
Here's my understanding of the execution flow of blockchain:

Consider two nodes, node1 and node2. Let's say there are 10 users on node1. They're making transactions, but none of these are actually carried out since no block is mined.

When a block IS finally mined, these unconfirmed transactions are put into the block and executed - and the block is added to node1's blockchain. Then, through the consensus protocol, node1's blockchain in "synced" with node2's blockchain so that they both carry the same copy.

My question is: how does this "syncing" take place? Do you just supply node2's blockchain with the blocks it doesn't currently have? Or do you pass node1's blockchain by reference like this: node_2_blockchain = node_1_blockchain?


texts: Loading modified contracts keeping the same super class

texts:
I am trying to implement upgrade of contracts. One pattern by [1] is to have a layer to resolve the actual address of a contract.
I implemented that adding the Pausable manipulation. My idea was to pause the old contract before replace them.
The old and the new implementation are Pausable contracts (Open Zeppelin). I imagined that it was possible to load the existing contract using their superclass (Pausable).
However, this code does not work when trying to change the contract by the second time.
In the first time, the code is ok because Resolver was compiled with the original contract and knows that it is Pausable.
In the second time, it seems that Resolver cannot understand the load as a kind of Pausable. Do you know how the EVM works? Any idea to solve that?

contract Resolver {

mapping (string => address) nameToAddress;
mapping (string => address[]) nameToPreviousAddresses;

function changeContract(string memory name, address newAddr) public onlyOwner returns (bool) {

    address contractAddr = nameToAddress[name];
    if(newAddr != contractAddr) {

        if (contractAddr != address(0)) {
            Pausable pausable = Pausable(contractAddr);
            pausable.pause();
        }

        nameToPreviousAddresses[name].push(newAddr);
        nameToAddress[name] = newAddr;
        return true;
    }

    return false;
}

function getAddr(string memory name) public view returns (address) {
    return nameToAddress[name];
}

}

[1] https://consensys.github.io/smart-contract-best-practices/software_engineering/#upgrading-broken-contracts


texts:
Looking for a way to schedule an event within the smart contract. When the event is occurred should be able to invoke the method of the contract.

I want to implement this whole feature, within the smart contract itself an not by using some NodeJS API operation.


texts:
Maybe this question it seems to be stupid but is it possible to change elements of fixed-size array like bytes32. For example:

bytes32 _b32 = sha3(1);
_b32[0] = 100;                // => Error


texts: How can I get a list of of transaction data which are sent to a specific contract?

texts:
I'd like to get a list of all transactions which are sent to specific contract or method of contract.
What kind of way do we have to implement it?


texts: Deployment transaction mined but contractAddress still empty

texts:
I'm trying to deploy a very simple smart contract on Ropsten through Infura
When I launch (on Ubuntu) my deploy.js script, everything seems to work except I don't get the contractAddress in the receipt
The deployment of the same smart contract works fine on Remix, and I'm using the same account
I'm getting the bin assembly from Remix or solcjs on the same machine

Pretty frustrating...

nicola@geth2:~/ethnow$ node deploy.js
(node:4348) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
0x5d
0x280ae02eb54e65fbfc2f0da87e67ad7203abee77daa00d73982dc7b67217cd03
undefined
{ blockHash:
   '0x3e9c216ab012194c35761545201568bd4cac851a308222a7dd47b889a85db9c0',
  blockNumber: 7454336,
  contractAddress: null,
  cumulativeGasUsed: 25796,
  from: '0x4f73dc0aafbfab1151b5823a66736a8f46fa49e6',
  gasUsed: 25796,
  logs: [],
  logsBloom:
   '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  status: true,
  to: '0x0000000000000000000000000000000000000000',
  transactionHash:
   '0x280ae02eb54e65fbfc2f0da87e67ad7203abee77daa00d73982dc7b67217cd03',
  transactionIndex: 0 }

Smart comntract:

pragma solidity ^0.6.0;

contract SimpleStorage {
    uint storedData;

    event Set(
        address indexed _from,
        uint _storedData
    );

    function set(uint x) public {
        storedData = x;
        emit Set(msg.sender, storedData);
    }

    function get() public view returns (uint) {
        return storedData;
    }
}

Deploy script

var Web3 = require('web3');
var Tx = require('ethereumjs-tx');
//const fs = require('fs');
//const solc = require('solc');

//WSS INFURA wss
//var web3 = new Web3(new Web3.providers.WebsocketProvider('wss://:324af3552e8f4cb389c324e18131659b@ropsten.infura.io/ws/v3/1ef4898b08a84c3b98c755cd48476b92'));

//HTTPS
var web3 = new Web3(new Web3.providers.HttpProvider('https://:324af3552e8f4cb389c324e18131659b@ropsten.infura.io/v3/1ef4898b08a84c3b98c755cd48476b92'));

var privateKey = new Buffer('-----------------', 'hex');

//var abi = [{"inputs":[],"name":"get","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","nam$

web3.eth.getTransactionCount("0x4f73Dc0AAFbFAb1151B5823a66736A8F46Fa49E6").then(function(res){

_nonce = web3.utils.toHex(res);

console.log(_nonce);

var rawTx = {
  from: "0x4f73Dc0AAFbFAb1151B5823a66736A8F46Fa49E6",
  nonce: web3.utils.toHex(_nonce),
  gasLimit: web3.utils.toHex(3000000),
  gasPrice: web3.utils.toHex(20000000000),
  to: '0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x608060405234801561001057600080fd5b50610117806100206000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806360fe47b11460375780636d4ce63c146062575b600080fd5b606$
  chainId: web3.utils.toHex(3)
}

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

var serializedTx = tx.serialize();

web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'))
.on('transactionHash', console.log)
.on('receipt', function(err, res){console.log(res); console.log(err)})
.on('error', console.log);

}
)


texts: TestRPC/Truffle - how to change accounts?

texts:
I deployed a contract under with Truffle. I am able to use my contract as user: web3.eth.accounts[0]. What if I wanted to use this deployed contract object as a different user, say: web3.eth.accounts[1]?

I have the private key for all these accounts, since TestRPC gives them to you at start up. But the web3.personal.unlockAccount does not work for me. Also this function seems to require a PASSWORD. I have a private key, whats this got to do with a password?

truffle(development)> web3.personal.unlockAccount(web3.eth.accounts[1])
Error: Error: RPC method personal_unlockAccount not supported.
    at GethApiDouble.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/lib/subproviders/geth_api_double.js:49:16)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at SolcSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/solc.js:28:7)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at VmSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/vm.js:40:12)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at GethDefaults.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/lib/subproviders/gethdefaults.js:17:12)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at FilterSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/filters.js:87:7)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
    at RequestManager.send (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:61:22)
    at Personal.send [as unlockAccount] (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/method.js:145:58)
    at evalmachine.<anonymous>:1:15
    at ContextifyScript.Script.runInContext (vm.js:53:29)
    at Object.runInContext (vm.js:108:6)
    at TruffleInterpreter.interpret (/usr/local/lib/node_modules/truffle/lib/repl.js:136:17)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:433:10)


texts:
I want to write a contract that uses a library. This library should be exchangable.

Meaning I want the contract to have an updatable (only by owner) address variable always pointing to the current version of the library.

Thus I could write and deploy a new library and just tell the contract the address where the the new library is. No need to update and re-deply the whole contract.

I'm sure it's possible but I can't figure out the right syntax/architecture.


texts: How to make atomic swap between Ethereum and POS chain?

texts:
There's simple way to make atomic swap for smart-contact chain and any POW chain.

For example for Ether <> BTC:

Alice sends some Ether to the swap smart-contact which locks this money. While doing that she specify her BTC address and Bob's ethereal address.
Bob sends BTC to Alice.
Bob shows the proof of this BTC tx on to the smart-contract and unlocks his Ether.

Bob's proof is a signed transaction and merkel path which lead to the valid market root. So smart-contact should either believe that root is legit because it has sufficient level of work (number leading zeros, so it's very costly to fake it) or there's oracles who send time to time these BTC block's headers to the contact and takes the chain with larger PoW as the legit one.

The question is: how atomic swap can work when second chain is POS?


texts: Specified HTTP/RPC port, yet Geth 1.9.15 will not map that port

texts:
I am trying to expose port 8545 on a local geth client for use with MetaMask on Chrome 83.0.4103.106 (x86_64), using a Windows host (10.0.18362.900). I store all my blockchain data on a separate drive, R:. I use geth --datadir=R:\geth --rpc --rpccorsdomain "*" --rpcaddr 127.0.0.1 --rpcapi "eth,web3" --rpcport 8545 to start the full node. IPC connections work normally, and I can see that geth outputs:
INFO [06-21|17:52:34.051] Mapped network port     proto=tcp extport=30303 intport=30303 interface=NAT-PMP(192.168.86.1)
INFO [06-21|17:52:34.059] Mapped network port     proto=udp extport=30303 intport=30303 interface=NAT-PMP(192.168.86.1)

However, I do not see the same thing for port 8545. No matter which options I tried or omitted, and also while trying to run as administrator, 8545 always remains closed (when checked with nmap). This means that I am unable to access the node through MetaMask. I have already tried changing rpc to http. since the flags are deprecated, but this did not have any effect. I have also tried to specify "Custom RPC" in MetaMask and use my local IP address instead of 127.0.0.1. Is there any way to explicitly tell geth to map 8545 as a TCP port?
I would also like to note that geth doesn't recognize that I specified 127.0.0.1, ignores the option, and proceeds to use my local IP. See:
INFO [06-21|17:52:34.016] HTTP endpoint opened     url=http://192.168.86.36:8545/ cors=* vhosts=localhost

Geth is done with IBD and is only about 100 blocks behind, with 10 peers connected.


texts: I am trying to use chain link using remix

texts:
I'm getting this error
/*
Internal exception in StandardCompiler::compile: /root/project/libsolidity/interface/CompilerStack.cpp(93): Throw in function solidity::frontend::CompilerStack::CompilerStack(ReadCallback::Callback)
Dynamic exception type: boost::wrapexcept<solidity::langutil::InternalCompilerError>
std::exception::what: You shall not have another CompilerStack aside me.
[solidity::util::tag_comment*] = You shall not have another CompilerStack aside me.
*/

What do I need to do?
Here is my code
pragma solidity ^0.6.7;

import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

contract PriceConsumerV3 {

    AggregatorV3Interface internal priceFeed;

    constructor() public {
        priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
    }

    function getLatestPrice() public view returns (int) {
        (
            uint80 roundID,
            int price,
            uint startedAt,
            uint timeStamp,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        return price;
    }
}


texts: Is the transaction nonce strictly sequential?

texts: Do we have to keep track of the nonce/transaction status, if I am creating a couple of quick/parallel transactions. ie Could we skip a number when creating a raw transaction, if the previous one is dropped/rejected.


texts: Is it possible to build a simple dice rolling game on Ethereum with Solidity?

texts:
total noob here.

But i like to learn.

I want to build a simple d20 dice rolling game with Solidity.

Is it possible?
if yes, what I need to know and use, to do it?

Thanks in advance.


texts: Mapping Multiple Struct Instances To One Address

texts:
How can I map multiple struct instances to one user without overriding the previous instance? I want to retrieve both instances through one mapping query. Should I use a multi-dimensional array here or a nested mapping?

As an example. If I have the below two structs. The problem is that the cookie mapping will only retrieve the latest cookie hidden by the cookieContributor but I want to retrieve all the cookies contributed by this particular address? How should my mapping look to achieve this?

contract HiddenCookies {

    struct Cookie {
        string cookieID
        string name,
        string color,
        string flavor,
        uint amount
    }

    struct CookieJar {
        address[] cookieContributors;
        mapping(address => Cookie[]) cookies;
        Cookie[] cookieJarContent;
        uint cookiesHiddenForLater;
    }
}


texts: Send eth from one account to another using transfer() function

texts:
I am trying to write a smart contract that will send eth from one account to another account :

Contract Send {

 event Sent(address from, address to, uint amount );

 function send(address _receiver, uint _amount) public payable{
    _receiver.transfer(_amount);
    emit Sent(msg.sender, _receiver, _amount);
 }
}

Here, the amount is deducted from the sender's account but not being added to receivers account.
I want to use transfer() function for this.

Thanks in advance!


texts:
i have tried following the mentioned steps at  this
but this connects to remix IDE. i want to connect to real ethereum wallet and use ether from there. please help.


texts: Query ethereum chain without owning a node

texts:
When I want to query the ethereum blockchain I use infura server with a curl command like this:

curl https://mainnet.infura.io/v3/2a8c33bac50647a6be2638a92f9d4a4c
-X POST
-H "Content-Type: application/json"
-d '{"jsonrpc":"2.0","method":"eth_getBalance","params":[0xfe05a3e72235c9f92fd9f2282f41a8154d6d342b, "latest"],"id":1}'

This work well, but what if I want to use another chain like a testnet ?


texts: web3j is lightweight and to achieve so it heavily relies on a single selected client (full node) to access the ethereum network. I seems like there is too much trust on this single selected full node, all access has to go through it. What happen if this node is compromised. How will the web3j end find out or any protection against it?


texts:
I've found a good API I want to use to see if my geth is in sync: admin.chainSyncStatus.

However, when I call it through web3/nodejs, I get this error:

/home/myuser/Documents/Code/Crypto/ethRaceWithdrawer/approver_test.js:14
var syncStatus = web3.admin.chainSyncStatus;
                           ^

TypeError: Cannot read property 'chainSyncStatus' of undefined
    at Object.<anonymous>     (/home/myuser/Documents/Code/Crypto/ethRaceWithdrawer/approver_test.js:14:28)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

What's wrong? I'm including the admin API when calling geth, this way:
geth --rpc --rpcapi eth,web3,personal,admin.

Tried also with web3_extended because it adds the admin APIs, but I got a different error:

/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/requestmanager.js:61
        throw errors.InvalidResponse(result);
        ^

Error: The method admin_chainSyncStatus does not exist/is not available
    at Object.module.exports.InvalidResponse (/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/errors.js:35:16)
    at RequestManager.send (/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/requestmanager.js:61:22)
    at Object.send [as chainSyncStatus] (/home/myuser/Documents/Code/Crypto/ethPlayground/node_modules/web3/lib/web3/method.js:145:58)
    at Object.<anonymous> (/home/myuser/Documents/Code/Crypto/ethPlayground/approver_test.js:27:29)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)


texts: Bootnode Discovery with external IPs instead of local ones

texts:
I would like to create a private testnet of mining nodes that external light clients can connect to. The caveat is that I'm doing so on Kubernetes (specifically via the excellent helm chart). So I can get the nodes to manually add themselves to each other via provisioned loadBalancer IP addresses, however the bootnode piece (which worked with just local networking), does not work.

In the logs I see messages along the lines of :

invalid neighbour (10.52.2.49) from 1182aa8c9dbb96cd@35.230.53.216:30301: is self

invalid neighbour (10.52.0.50) from 1182aa8c9dbb96cd@35.230.53.216:30301: LAN address from WAN host

invalid neighbour (10.52.2.48) from 1182aa8c9dbb96cd@35.230.53.216:30301: LAN address from WAN host

I suspect that the bootnode uses the actual local IPs of the nodes to advertise the nodes, which of course is not helpful for external connectivity (although I would think that this should still allow connectivity at least among the full nodes).

I used both the -v5 option on the bootnode as well as the --botnodesv5 and discv option on the nodes. Is there a way in the discovery protocol to specify the IP under which a node should be reachable? I would have assumed that's what a node's enode is for, and all my enodes correctly contain the external IP addresses and not the local ones. (via the --nat=extip:IP option)

Thank you!


texts:
When I test my selling event in truffle.So, the following error comes:-
The solidity code is :-

event Sell(address _buyer, uint256 _amount);
// Buy token
function buyTokens(uint256 _numberOfTokens) public payable {

    // Keep track of tokenSold
    tokensSold += _numberOfTokens;

    // Trigger Sell Event
     emit Sell(msg.sender,_numberOfTokens);

}

And my test.js code like this:-

it('facalities to token buying',function(){

// Keep track of number of token sold
return DappTokenSale.deployed().then(function(instance){
        tokenSaleInstance = instance;
        numberOfTokens = 10;
        return tokenSaleInstance.buyTokens(numberOfTokens,{form:buyer, value:numberOfTokens * tokenPrice})

}).then(function(receipt){
    assert.equal(receipt.logs.length,1,'triggers one event');
        assert.equal(receipt.logs[0].event,'Sell','Should be the "Sell" event');
        assert.equal(receipt.logs[0].args._buyer,buyer,'logs the accounts that purchase tokens');
        assert.equal(receipt.logs[0].args._amount,numberOfTokens,'logs the number of token purchase');
        return tokenSaleInstance.tokensSold();
}).then(function(amount){
    assert.equal(amount.toNumber(),numberOfTokens,'increments the number of token sold');
    // Try to buy the token different form the ether value
    return return tokenSaleInstance.buyTokens(numberOfTokens,{form:buyer, value:1});
    }).then(assert.fail).catch(function(error){
        assert(error.message.indexOf('revert') >=0,'msg.value must equal number of tokens in wai');

});

When I go Ubuntu terminal and hit the command:-
truffle test

So this Error comes:-

  AssertionError: logs the accounts that purchase tokens: expected
  '0x35374bce8edeb31f662944dd8bd1f09dd38a6fea' to equal
  '0x6297dfc898fa47fe7e2592a79ee01c4c207bdc77'.

So,what I mistake in this test.js line:

   assert.equal(receipt.logs[0].args._buyer,buyer,'logs the accounts that purchase tokens');

When I test it on terminal with truffle console command:-

tokenSellInstance.buyTokens(numberOfTokens,{form:web3.eth.accounts[2], value:10 * 1000000000000000})

So, result look like this:-

{ tx: '0x26d8ae437d64c6449d6b1378384441beecf4df8997ad66cb9dafaacb919ac8f1',
  receipt:
   { transactionHash: '0x26d8ae437d64c6449d6b1378384441beecf4df8997ad66cb9dafaacb919ac8f1',
     transactionIndex: 0,
     blockHash: '0xfd74a32ae0629303283fb23b408ef11f6a2d74b110d8c5d65ee630a2191e2c03',
     blockNumber: 52,
     gasUsed: 43196,
     cumulativeGasUsed: 43196,
     contractAddress: null,
     logs: [ [Object] ],
     status: '0x01',
     logsBloom: '0x00000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000001000000000000000000000010000000000000000000000000000000000000004000000000' },
  logs:
   [ { logIndex: 0,
       transactionIndex: 0,
       transactionHash: '0x26d8ae437d64c6449d6b1378384441beecf4df8997ad66cb9dafaacb919ac8f1',
       blockHash: '0xfd74a32ae0629303283fb23b408ef11f6a2d74b110d8c5d65ee630a2191e2c03',
       blockNumber: 52,
       address: '0x6ea8d6042826ca0b0f504384f1b7fd1e89a84efa',
       type: 'mined',
       event: 'Sell',
       args: [Object] } ] }

So why this error comes.Please tell me my mistake as soon as.


texts: The constructor should be payable if you send value. The transaction has been reverted to the initial state

texts:
I'm following a LinkedIn course on Solidity and creating a simple contract. Code below:

I'm new to solidity so I'm not sure exactly where I'm going wrong but I get the following error:

  Transact to Inheritance.Died errored: VM error: revert. The Transaction has been reverted to initial state. The constructor should be payable if you send value.

I have the word payable denoted in my constructor should not sure what is going on. Programming errors can sometimes mean a million things.

Note: I'm compiling and running in remix IDE

//import solidity
pragma solidity ^0.5.1;

contract Inheritance {
    address owner;
    bool deceased;
    uint money;

    constructor() public payable {
        owner = msg.sender;
        money = msg.value;
        deceased = false;
    }

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

    modifier isDeceased {
        require (deceased = true);
        _;
    }

    // setup an array of addresses and call the array wallets
    address payable[] wallets;

    //
    mapping (address => uint) inheritance;

    // needs the modifier oneOwner to run
    // function to setup the wallet
    function setup(address payable _wallet, uint _inheritance) public oneOwner {
        wallets.push(_wallet);
        inheritance[_wallet] = _inheritance;
    }

    function moneyPaid() private isDeceased {
        for (uint i=0; 0<wallets.length; i++) {
            wallets[i].transfer(inheritance[wallets[i]]);
        }
    }

    function died() public oneOwner {
        deceased = true;
        moneyPaid();
    }

}


texts: What is the privatekey to be used to sign web3.js transactions?

texts:
I created an account on metamask, and downloaded the json of my wallet.

It's on rinkeby.

The structure of the json is

{
    "version":3,"
    id":"...",
    "address":"....",
    "crypto":
        {
            "ciphertext":"....",
            "cipherparams":{ "iv":"..." },
            "cipher":"aes-128-ctr",
            "kdf":"scrypt",
            "kdfparams":
                {
                    "dklen":...,
                    "salt":"...",
                    "n":...,
                    "r":...,
                    "p":...
                },
            "mac":"..."
        }
}

My question is related to web3.js, where signing transaction requires a private key.

What is this private key? Is part of the json above?


texts: How to integrate ledger wallet in REACT DAPP?

texts:
i cant seem to find a way to integrate ledger wallet in react DAPP. Like which library to use. Any kind of guidance and starting material would be helpful.
Thank You


texts:
I am using a smart contract on the TestRPC net.
In order to deploy my contract for the first time I write this in the node cmd:

>Web3 = require('web3')
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
> code = fs.readFileSync('store.sol').toString()
> solc = require('solc')
> compiledCode = solc.compile(code)
> abiDefinition = JSON.parse(compiledCode.contracts[':SimpleStorage'].interface)
> SimpleStorage = web3.eth.contract(abiDefinition)
> byteCode = compiledCode.contracts[':SimpleStorage'].bytecode
> deployedContract = SimpleStorage.new(['Rama'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
> deployedContract.address

In this way I get contract abi and address.
The only problem is that evry time I restart TestRPC I have to repeat the above commands...There is a way to avoid this or,at least,make this automatical?

(this is the js script I actually use to use the contract:

var net = require('net');

var HOST = '127.0.0.1';
var PORT = 10001;
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider('localhost:8545'));

net.createServer(function(sock) {

sock.setEncoding('utf8');
sock.on('data', function(data) {
console.log('__________');

console.log(data);

console.log('__________');
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
abi = JSON.parse('[{"constant":false,"inputs":[{"name":"x","type":"string"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]');
SimpleStorage = web3.eth.contract(abi);

contractInstance = SimpleStorage.at('0x08cf472e9192d3c48e03f501472c8aecb9350c16');

contractInstance.set(data, {from: web3.eth.accounts[0], gas: 4700000});

 x=contractInstance.get({from: web3.eth.accounts[0], gas: 4700000});
 console.log(x);

});

// Aggiungiamo l'event handler 'close' per questa istanza di socket
sock.on('close', function(data) {

});

}).listen(PORT, HOST);

console.log('Server listening on ' + HOST +':'+ PORT);

EDIT


texts: What is the difference between sealing and mining a block?

texts:
I have seen numerous sites referring to sealing a block and mining a block. I understand a miner seals a block but I do not really understand what sealing actually involves.

On that point, how does the VM actually know that a miner was 'first' in PoW consensus algorithms?

I assume a miner could just fake a response and listening on the network and then taking the correct answer and presenting that as the miner's own one.

The VM must have a means of controlling this.

On another related issue, the question of validation has come up. Is a validator a miner in a PoW based network?


texts: transaction fees included in blocks mined on the ropsten testnet

texts: As you can see here ^, the first two times I mined a block on the Ropsten testnet I just got the block reward of 5 ethers, I guess this is because there were no gas fees/transaction fees included in those blocks, but in the latest block I mined, it worked out to 5.116374, this is because that block contained actual transactions for me to process, isn't it?


texts:
Hi All

I have made a major rookie mistake 2 days ago and would would it if one of you guys can help me out

I transferred 40 ETH into ETC using JAXX WALLET

Only to find out even though it is in the same wallet but they dont support each other - Is there anyway for me to retrieve this 40ETH - This thing has been occupying my mind for the past 2 days - Any direction from here would be wonderful I am willing to give a ether away for your time :)


texts:
Kyrptono Exchange Customer Support has refused to respond to my problem.  The transaction failed, because it ran out of gas,  I can still see a shadow of my DGX on Kyrptono account, but after 7 months it still reads "in-process"  Is there any way to recover these coins, or is it a total loss?  I did add some ETH to my account.  Could I throw some more gas at it to force the transaction?
Transaction Hash: 0x4f05f8801ff6e28953b18987200436f2a0c6c41642366d75a9c6cea82e793a47


texts: Get pending transactions to a given address/contract

texts:
Is there a way I can get all pending transactions to a given address/contract?  I could get the confirmed transactions by exploring transactions in recent blocks.  But how would I go about getting current pending and unconfirmed transactions to a specific address/contract?

For example, I can go to https://etherscan.io/address/  and I can see "(pending) 6 seconds ago".  How does etherscan.io determine this?  I'd like to do this myself.  Do I need to run a node?  A friend mentioned something about a listener, but i'm not sure if that's the right direction.

******* Edit ********

This etherscan API doesn't seem to return any pending transactions.  Only ones in a block.  But their website clearly shows pending transactions...

http://api.etherscan.io/api?module=account&action=txlist&address=0x1234.....5678&startblock=4271910&endblock=99999999&sort=asc&apikey=KEYGOESHERE


texts: Ethereum redownloading entire blockchain after using geth

texts:
As you can see from the image above Ethereum is redownloading the entire blockchain despite it being present in ".ethereum/chaindata".

This has happened after using Geth for the first time and updating the main client, unsure if one of these if any could be the problem, any ideas?


texts: Can we use block hash as verifiable randomness for the off-chain lottery?

texts:
My team is writing a discord lottery bot, we want to use the block hash of some block in the future as a seed for the random generator.
We want to allow lottery participants to independently verify that our lottery is fair because they could know in advance what block we will use for the randomness.
Do you think it will work in our case (is it secure to use it as randomness source this way)? Thx!


texts: Can a contract's internal storage keep increasing forever?

texts:
In other words, is there a limit on the amount of storage a contract can hold?

Suppose a field is an Array for instance, and the contract has a method for adding items. Can I keep calling the contract so it adds more and more data?


texts: Ethereum wallet keeps redownloading entire blockchain

texts:
I'm having serious problems with my wallet. I was running fine up until a couple of weeks ago, then when opening the wallet I was asked to update. I did, and ever since I've had nothing but trouble.

So firstly, I'm on Windows 10. I have 10mb download, and the data dir is on a mechanical HDD.
When I first updated to 0.8.3, the syncing was excrutiatingly slow. Maybe 100 blocks an hour, if that. Eventually I gave up and attempted to redownload the entire blockchain with Geth --fast. This got a lot further, but still wouldn't sync to the current block. I updated to 0.8.4 and finally managed to sync, but if I exited the software and opened it up even an hour later, it would take the best part of a day to sync back up.

Finally I got somewhere with using Geth separately before running the wallet, and after another three days of syncing, as long as I ran Geth --cache 1024 before starting the wallet, it was usable.

Except that at some point the other day I accidentally ran the wallet without running Geth first - and it started downloading from Block 0 again.
Even if I then exit and run Geth separately, I'm still stuck at block 0.
So I downloaded the entire blockchain again, and lo and behold the same thing is happening. I'm back to block zero after restarting the wallet.

So it seems that the various methods of running Geth aren't interchangable - even though they're the same version and looking at the same chaindata folder. That doesn't seem right to me - but it seems I'm stuck waiting for the wallet to download the blockchain all over again, assuming it can do so, without being able to use geth --fast, if I ever want to keep it stable.

This doesn't sound right to me, and it's going to cost a fortune in bandwidth!


texts: How to switch account from default in testrpc

texts:
I'm working with truffle on testrpc.
When starting the testrpc it gives as usual 9 account to work with. As default I execute my functions with account 0. Now I want to send e.g. transaction from account 1 to 2. So change my default from 0 to 1, right?

How do I change the "executing" account?

Thanks!

Working with solidity ^0.4.4

EthereumJS TestRPC v3.0.5

Available Accounts
==================
(0) 0xc434136c76a349c32f1ba070c988d9b69b8aa6e9
(1) 0x025a7b62a0273bbb2b4504a7a1a0a9e05c23f4ed
(2) 0xc257ed20889a0301de39134f20eb705397bcfda8
...etc.


texts:
I would like to create a token contract and an implementation of that token contract, to be able to replace the implementation if I ever need to.

The constant functions work fine but the functions which modify the state do not.

Here is the code. I stripped some functions to make the code shorter

contract CoinImplementation is Owned, Token {

    mapping (address => uint256) balances;         // each address in this contract may have tokens.
    bytes8 _name = "Soarcoin";                     // name of this contract and investment fund
    bytes4 _symbol = "SOAR";                       // token symbol
    uint8 _decimals = 6;                           // decimals (for humans)
    uint256 _totalSupply;
    uint8 flag = 0;

    function CoinImplementation(uint256 initialMint) {
        _totalSupply = initialMint;
        balances[msg.sender] = initialMint;
    }

// transfer tokens from one address to another
    function transfer(address _to, uint256 _value) returns (bool success)
    {
        if (_value <= 0) throw;
    // Check send token value > 0;
        if (balances[msg.sender] < _value) return true;
    // Check if the sender has enough
        if (balances[msg.sender] < _value) return false;
    // Check for overflows
        balances[msg.sender] -= _value;
    // Subtract from the sender
        balances[_to] += _value;
    // Add the same to the recipient, if it's the contact itself then it signals a sell order of those tokens
        Transfer(msg.sender, _to, _value);
    // Notify anyone listening that this transfer took place
        return true;
    }
}

and then I have the calling contract

contract Coin is Owned, Token {

    Token implementation;

    function Coin(Token _implementation) {
        implementation = _implementation;
    }

    function transfer(address _to, uint256 _value) returns (bool success) {
        return implementation.transfer(_to, _value);
    }
}

if the transfer is called directly on the implementation it works but if the transfer on the Coin contract is called nothing happens.


texts:
pragma solidity ^0.4.24;

contract Count {
    uint256 storeddata;

    function set(uint256 x) public {
        storeddata = x;
    }

    function get() public view returns(uint256) {
        return storeddata;
    }
}

This is my code now, i'm trying to save more then one value on Blockchain but i can't know how many numbers to save.

So for example i have a table of 10 text field in my HTML but i need to save only 3 numbers... how can i do this?
Is it good to use an array or there is something better in terms of costs ?


texts:
Token was created under ERC223.  Every transfer that I have done received:
ERC-20 Token Transfer Error (Unable to locate corresponding Transfer Event Logs), Check with Sender.
Please help to check and see what I need to do correct this?
https://etherscan.io/tx/0x42a3f4746279e37484fef91b2f41d81c9e48583e411c4a00df9cbc47dc1e8881


texts: How to deploy contracts that take parameters in their initialisers using Truffle?

texts:
I'm trying to build a smart contract with Truffle. I can compile it just fine, but when I try to deploy it on the network, I don't get an option to pass in the initialiser parameters and thus the contract fails.

How do I pass the parameters to a Truffle-compiled contract during deployment?


texts: What is the difference between the abstract and virtual keywords in Solidity?

texts: Solidity has the keywords abstract and virtual. What is the difference?


texts: Is there a token future market on Ethereum?

texts:
I was wondering if there is something similar to Cryptoderivatives but structured as a future exchange, maybe using the block number as the timeframe?

I couldn't find any.


texts: Why is Ethereum json rpc using hexidecimal for numbers?

texts:
Playing around with geth jsonrpc.

Sending the eth_sycing.

{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}

What is the design decision to use Hexidecimal for numbers?

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "currentBlock": "0x16592a",
        "highestBlock": "0x409fe6",
        "knownStates": "0x6e9473",
        "pulledStates": "0x6e4f11",
        "startingBlock": "0x0"
    }
}


texts:
I keep getting Invalid Opcode opcode in my constructor when deploying my smart contract in both truffle and remix IDE

mapping(address => bool) isMintApprover;
uint minApprovers = 0;
 address payable headOffice;
 address payable beneficiary;

constructor (address[] memory _approvers, uint _minApprovers, address payable _beneficiary) public payable{
        require(_minApprovers <= _approvers.length, "Should be less than min");
         _minApprovers = minApprovers;
         headOffice = msg.sender;
         _beneficiary = beneficiary;

         for(uint i = 0; i<= _approvers.length; i++){
             address approver = _approvers[i];
             isMintApprover[approver] = true;
         }

        //address[] memory _approvers, uint _minApprovers, address payable _beneficiary
    }


texts: how does a new node get state data and where are storage/recepit trees stored?

texts:
I know that state data isn't stored on blockchain. Each node stores it separately on hard disk.
Question 1)
Let's say I am a new node and just joined the network. What will happen is I will sync the blockchain from other peers. Great. Now, I got the blockchain.
My node now creates a transaction. Since my node doesn't have state data, how will it create a transaction ? how will it validate the transaction (to validate, it will need to check if balance on from address is more than the transaction's value ?
Question 2) State data(tree) is not stored on blockchain. State data stores storage root. Where is storage trie stored ?  if it's not on blockchain, then it means that smart contracts are not stored on blockchain which seems very wrong.
Question 3) where is receipt trie stored ? i don't think it's on blockchain either.


texts: How to pass a parameter to a function in web3?

texts:
I have a button that executes a function in a solidity contract like this:

Execute Function

The solidityFunction() might take one parameter. In the web3 Javascript I have it like the following:

window.solidityFunction = function () {
    contract.deployed().then(function (contractInstance) {
        contractInstance.solidityFunction({from: web3.eth.accounts[0], gas:1000000, value: web3.toWei(0.01, "ether")})
    })
},

How do I pass a parameter from the onclick="solidityFunction()" that I then use in the window.solidityFunction part?


texts:
I'd like to know whether the messages delivered to the ethereum network by my wallet are encrypted such that any identifying information about the wallet is inaccessible to the ISP?

in other words, can ownership of the wallet be traced to me via knowledge of the IP address I'm using at the time of the communication?

I can't seem to find an answer to this anywhere...


texts: who pays for gas in a refund transaction

texts:
I would like to know who pays the gas when a transaction is refunded by the smart contract.

Suppose if a sender sends some amount of money to a smart contract, and it finds out that there is some issue with the transaction and wants to refund the sender. Who will pay for the gas in this case ?


texts: How to monitor all your addresses and send payments out immediately to a main address

texts:
Say I have separate addresses for ethereum that are getting regular payments through different channels. How do I monitor these and immediately send balances to the main account and leave all the others empty at all times, if possible?

Also, is it possible to check pending transactions such as those here for extra speed: https://etherscan.io/txsPending

Or will it be just as fast if I wait for them to appear in the addresses? I do need it to be as quick as possible for complicated logistical reasons.

What is the best way of achieving this and what is a good gas level to speed it all up (if I don't mind losing more money for extra speed)?

As you can probably tell, I'm not an expert at all on this but would like a solution, even if it was just a simple script etc.


texts: What are some solutions to getting the money back with the Parity bug?

texts: Having over $150+ Million stuck in parity. What are some proposed solutions to unfreeze these funds?


texts: EIP20 and ERC20 not compatiable in token contract?

texts:
I am issuing a token coin via ERC20 and I also include a crowd sale within this contract?
ie start time
   end time
   bonus period
   total supply
?  8 or 18 public decimals
? I got confused with the EIP20 interface,,,,,,,,,,,,,learning still, thank you


texts: How to check currently installed web3 version?

texts: How to check installed web3 version with command line terminal?


texts: What is the benefit of leaving data in the stroage area instead of the log?

texts:
I did not write English well and used a translator. sorry :3

I would like to know the benefit of leaving data in the storage area rather than using the event log.

I know gas consumption has less log.

So when developing a smart contract, can not everything be an event log? I thought.

I would like to know what is essential to leave data in stroage.

thank you for reading.


texts: Web3.js Error: provider not set after TestContract.at(address);

texts:
I'm new to web3.js and ethereum, and i'm trying to play with it coupled with meteor and angular 1.5.

I defined a component that creates a simple contract but i'm stuck after calling TestContract.at(address); - the error i get is "Error: provider not set" but just some lines before i send a transaction and HttpProvider is correctly recognized.

My simple component is:

import angular from 'angular';
import angularMeteor from 'angular-meteor';

import templateUrl from './mine-contract.ng.html';

class MineContract {
  constructor() {
    this.contractInstance = null;
    this.mining = false;
  }

  mine() {
    this.mining = true;
    var transactionObject = {
      data: TestContract.bytecode,
      gasPrice: web3.eth.gasPrice,
      gas: 5000000,
      from: web3.eth.accounts[0]
    };

    var _this = this;

    web3.eth.estimateGas(transactionObject, function(err, result){
      if(err) {
        console.log('err', err);
        _this.error = 'Something went wrong, the error is: ' + err;
        _this.mining = false;
        return;
      }

      if(!err)
        transactionObject.gas = result * 10;

      console.log('trans', transactionObject);
      web3.eth.sendTransaction(transactionObject, function(err, result){
        if(err) {
          console.log('err', err);
          _this.error = 'Something went wrong, the error is: ' + err;
          return;
        }

        if(result) {
          _this.contractInstance = TestContract.at(result);
          console.log('contractInstance', _this.contractInstance);
        }

      });
    });
  }

}

const name = 'mineContract';

export default angular.module(name, [angularMeteor])
.component(name, {
  templateUrl,
  controllerAs: name,
  controller: MineContract
});

In my javascript console when i log console.log('contractInstance', _this.contractInstance); i get:

contractInstance Contract {_eth: Eth, transactionHash: null, address: "0x0ed4a0e14bb7b1a9173271a16c12690237663eff333b2ba26e9f6dbed4695b62", abi: Array[2]}

But after that it starts throwing exception web3.js:5996 Error: Provider not set or invalid(…) - i presume trying to get the transactionHash

Line that throw the error is:

RequestManager.prototype.send = function (data) {
    if (!this.provider) {
        console.error(errors.InvalidProvider());
        return null;
    }

But I can't understand what i'm doing wrong.

Can anybody helps me?


texts:
I synced my blockchain using Ethereum Mist, created an account and tried to create a single wallet contract.

Once I made the wallet the contact creation transaction went through, however the wallet in Mist is now stuck at "Creating...". I tried importing the same wallet and I ended with another entity stuck at "Importing..."


texts: How to get web3 to interact with smart contract to input string info

texts:
Just cannot get what seems like a simple input from html page to interact with a very simple contract to input data.

Started off trying to make this tutorial work:
Interacting with a Smart Contract through Web3.js

Have been around the horn with old, current, workaround info on web3 installs. Getting tired and finally have given in and need some help. What am I missing or not seeing?

Contract works in remix by itself but cannot get the web page to interact.

code being used below -

pragma solidity ^0.5.0;

contract Coursetro {

   string fName;
   uint age;

   function setInstructor(string memory _fName, uint _age) public {
       fName = _fName;
       age = _age;
   }

   function getInstructor() public view returns (string memory, uint) {
       return (fName, age);
   }
}

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="main.css">

Course Info Instructor

        Instructor Name
        <input id="name" type="text">
        Instructor Age
        <input id="age" type="text">
        <button id="button">Update Instructor</button>


texts: How is gas price too low corrected (truffle deploy)?

texts:
truffle.js

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8540,
      network_id: "*",
      gas: 4600000,
gasPrice: 4000000   // Match any network id
    }
  }
};

  <       "code": -32010,  <       "message": "Transaction gas price is
  too low. There is another transaction with same nonce in the queue.
  Try increasing the gas price or incrementing the nonce."  <     },  <
  "id": 6  <   }

I am using parity.

How would I know what gas price should be used, or how is the nonce changed?


texts: Privacy-preserving smart contracts: examples, tutorial, best practices?

texts:
I want to make a proof-of-concept about privacy-preserving smart contracts. I know it's uneconomical to use encryption with Ethereum smart contracts.
Are there best practices about how to do that?
Could I use some kind of off-chain approach for that purpose, such as Enigma or truebit?
Some sample projects or tutorials would be a great help.

To give you more background:
I aim to store encrypted data in a smart contract and allow parties that fulfill certain criteria, e.g. who made a payment to the smart contract, to retrieve the decrypted data.


texts: How work with contracts accros without synchonize

texts:
How I can call method my contracts without synchonize? Synchronize is long and has big size.
Language: Python or Javascript


texts: Is it possible to see changes that have been made by a user on blockchain?

texts: Is it possible to see every changes that have been made to the block chain from various accounts.In other words is it possible to see what changes have been done by a user to, say its location(a field in smart contract)?


texts:
This is my Bank contract. I'm not using any payable function for newAccount still it is giving the error
"The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information."
pragma solidity ^0.4.17;

contract Bank{

    enum gender{MALE, FEMALE, OTHER}

    address manager;

    string bankName;

    mapping(address=>bool) account;

    struct Address{
        string line1;
        string line2;
        string city;
        string state;
        string pincode;
    }

    struct detail{
        string firstName;
        string lastName;
        uint8 age;
        gender Gen;
        Address addr;
    }

    detail[] Details;

    mapping(address=>detail) Info;

    function Bank(string _name) public{
        bankName = _name;
        manager = msg.sender;
    }

    modifier confirmer(){
        require(account[msg.sender] = false);
        _;
    }

    function newAccount(string _firstname,
                        string _lastname,
                        uint8 age,
                        gender gen,
                        string Address_line1,
                        string Address_line2,
                        string city,
                        string state,
                        string pincode) confirmer public{

            account[msg.sender] = true;
            Details.push(detail(_firstname,_lastname,age,gen,Address(Address_line1,Address_line2,city,state,pincode)));
            Info[msg.sender] = detail(_firstname,_lastname,age,gen,Address(Address_line1,Address_line2,city,state,pincode));
    }

    function showInfo() public view returns(string){
        return Info[msg.sender].firstName;
    }
}


texts: How to download test network in testnet with mist and run smart contracts using solidity on remix - ide?

texts:
I followed a youtube video, the link is https://www.youtube.com/watch?v=DEULs3ShTxo&list=PLnwIwnzAHNfi3mCaRDIXcQx8HtuWm1pqw&index=2

He said that while installing MIST, while downloading mist, he said that it will ask whether to download main network or testnet network. But it wasn't asked while i am downloading!! Also when installed mist, to select test network there are two networks one is ropsten and other is rinkeby. As per video I have selected Rinkeby network. When i am trying to create a new account -> the account is not creating eventhough i created(creation process, password and confirm password)!! Please tell me why it is happening!! The account is not created and the further process I am getting to continue as per the video.


texts: What are the step by step instructions to do a multi-signature spending account with 2 of 5 people?

texts: I'd like to setup an account that requires the approval of 2 of 5 people in order to spend from my ether account. How can this be done step by step?


texts: If token contract 'Bob' has no delegatecalls/ selfdestruct functionality but I transfer the ownership of the contract to contract 'Mallory' and this contract HAS selfdestruct functionality, then the question is, would I be able to terminate/destroy the newly owned contract 'bob' if it's owner is now 'mallory?


texts: iam just wondering. Are meta transactions not the same like raw transactions, which are signed by the user in frontend and send to a backend, where the transaction gets deployed?


texts: How would one go about replaying transactions on Ethereum chains?

texts:
Ignoring EIP 155 and any other measures in place to prevent this, how would one technically replay a transaction on some other Ethereum chain?

Context: I have two private chains and want to see if I can replicate Chain 1's state by taking all txns and replaying them on a fresh Chain 2.

I thought I'd be able to resumbit input from web3.eth.getTransaction() in web3.eth.sendRawTransaction() but am getting an undocumented rlp error (expected input list for types.txdata), which seems to indicate the node is unhappy about something fundamental in the encoding process. The transaction I'm trying with is a contract deployment.

Keep in mind that we're replaying right from the start, so nonces should not be an issue. All relevant accounts are funded.

Geth: 1.7.2-stable

Web3: 0.17.0-beta


texts: How to include solidity file into another?

texts:
I completely stuck on modules importing into Solidity contract. Here is my files/directory layout:

.
|-> contracts/
  |-> contract1.sol
  |-> contract2.sol

File contract1.sol contains only pragma and import statements like:

pragma solidity ^0.4.0;
import "./contract2" as c2;

File contract2.sol conntains only pragma statement:

pragma solidity ^0.4.0;

Then I open node shell and input following code:

> solc = require('solc')
> solc.compile(fs.readFileSync('contracts/contract1.sol').toString())
{ contracts: {},
  errors: [ ':3:1: ParserError: Source "contract2" not found: File not supplied initially.\nimport "./contract2" as c2;\n^-------------------------^\n' ],
  sourceList: [ '' ],
  sources: {} }

I already tried to:

specify full path in contract1.sol
add extension .sol
remove ./contracts/ prefix and run commands inside contracts folder.

Nothing works. Accordingly to this article begin import with dot and slash is enough but, damn, no!

How to include one sol file into another?
Node version is 8.1.13, solcjs version is 0.4.13+commit.0fb4cb1a.Emscripten.clang


texts: If an Ethereum wallet address can't receive Bitcoin why do I have Bitcoin in it?

texts:
When I visit MyEhtereumWallet.com and view whats in my Ethereum address/wallet, it shows I have a small amount of BTC in it. How/why?

Because of seeing this I tried sending BTC to that Ethereum address and of course it didn't work. I don't know how I got the BTC in there in the first place. I think it might be left over from buy TheDao Tokens before May 28th (i.e. not on an exchange). Is there some otherway to get BTC into my Ethereum address/wallet?

I like the security of me controlling my wallet and not relying on some BTC wallet hosting company.


texts: difference between contract creation in web3 and in solidity

texts:
I created a contract named Pepito by calling new in web3:

   import Pepito from "./contracts_abi/Pepito.json";
   const instance = new web3.eth.Contract(
        Pepito.abi,
        address,
      );

Inside Pepito.sol there is a function that calls newin solidity

   import "./PepitoDisguise.sol";
   function createPepitoDisguise() public returns(PepitoDisguise) {
        PepitoDisguise pepitoDisguise = new PepitoDisguise(owner);
        return pepitoDisguise;
    }

I call createPepitoDisguise from web3 by calling the function inside Pepito

   const pepitoDisguise = await instance.methods.createPepitoDisguise();

My question is: how come that in case 1 a contract is returned and in case 2 a transaction object (https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html#id24) is returned?
The answer is important for me because when a contract Pepito is returned, I can call a function of Pepito but when a transaction object is returned after new PepitoDisguise, I cannot. I need to call a function also in PepitoDisguise. How can I get this new Contract?


texts: How do I preprocess `data` in address.call.value()(data)

texts:
I have a transaction struct tx which contains to, value and data and is executed with tx.to.call.value(tx.value)(tx.data).

In Solidity, how do I preprocess data to take a function name and arguments of to?

I understand (perhaps incorrectly) that data needs to be RLP encoded.


texts: Gas refunds via “Self-destruct” prior to a revert()

texts: In a transaction that eventually calls revert(), if prior to the revert we have SELFDESTRUCT some contracts and thus received a gas refund, does the gas refund also get reverted?


texts:
Can I treat ether as an ERC20 token? If so, what is the ehter contract address?
For example I would like to stream ether to another account. But I need to provide contract address of ether for that.


texts: miner.start(1) is giving error as Failed to generate mapped ethash dataset epoch=1 err=”cannot allocate memory”

texts:
I am facing an issue here when I start the miner process with miner.start(1). It gives me error as below. I tried to search for the solution but could not find any. I am using Ubuntu 16.04 LTS on Intel i3 processor, 4 GB RAM and 4 GB Swap. I also tried to look for answers on this platform but didn't see any relevant solution.

    miner.start(1)
    INFO [10-24|18:55:59] Updated mining threads threads=1
    INFO [10-24|18:55:59] Transaction pool price threshold updated price=18000000000
INFO [10-24|18:55:59] Starting mining operation null
    INFO [10-24|18:55:59] Commit new mining work number=1 txs=1 uncles=0 elapsed=667.378µs
    INFO [10-24|18:56:02] Generating ethash verification cache epoch=1 percentage=80 elapsed=3.010s
    INFO [10-24|18:56:03] Generated ethash verification cache epoch=1 elapsed=3.687s
    ERROR[10-24|18:56:03] Failed to generate mapped ethash dataset epoch=1 err=”cannot allocate memory” runtime: out of memory: cannot allocate 2164260864-byte block (119799808 in use) fatal error: out of memory


texts:
Hello, friends!

How to find Eth addresses that are stored at the same time 2 (or 3) defined ERC20 tokens?

I'm just an ordinary user,
so would be grateful for the solutions to make it simple.

Thanks!


texts: How to unlock account programmatically using web3.js?

texts: When using web3.js to execute a function in a contract, I always get the following error: "authentication needed: password or unlock." I know that I have to unlock account first via either geth console or web3.personal.unlockAccount(web3.personal.listAccounts[0],"", duration). However, it is not convenient to use console when the smart contract executes in the real network. Moreover, I am not comfortable to use web3.personal.unlockAccount because I have to provide the password of the account in the clear text. So, what is the best way to unlock account programmatically while still keeping the password secret?


texts: How to find official smart contract addresses

texts:
Is there a directory somewhere that references official projects smart contract addresses ?
I can't find a reliable way for finding smart contract addresses of public projects. The only solution I have is to search on etherscan for the project name, but how to be sure it's the good contract ? How to track if the contact address changes ?
I was hoping for a common service on which different projects push their smart contract addresses on different networks (mainnet, goerli, rinkeby etc ...).
Any help welcome!


texts: Deploy contract dynamically based on user request

texts:
Inspired by this blog: https://medium.com/coinmonks/escrow-service-as-a-smart-contract-the-business-logic-5b678ebe1955
I want to deploy contract once a buyer want to purchase a service. However, I cannot find a proper way to dynamically deploy a contract.

If I use server side javascript to deploy a contract, I must put the private key or mnemonic of the account which deploys the contract and deduct fees. I don't think this is feasible as I want the buyer deploys the contract using buyer's account.

If I use browser side javascript to deploy a contract, I think I already get the account data using MetaMask, so I might use web3 or truffle to deploy a contract. However, truffle seems not support this. I tried new web3.eth.contract(abiArray), but I don't know how to deploy the contract.
Very appreciate if anyone could help. Thank you.

  initWeb3: function() {
    if (typeof web3 !== 'undefined') {
      // If a web3 instance is already provided by Meta Mask.
      App.web3Provider = web3.currentProvider;
      web3 = new Web3(web3.currentProvider);
    } else {
      web3 = new Web3(App.web3Provider);
    }
...
    $.getJSON("Election.json", function(election) {
      // Instantiate a new truffle contract from the artifact
      App.contracts.Election = TruffleContract(election);
      // Connect provider to interact with contract. setProvider is a function of TruffleContract class.
      App.contracts.Election.setProvider(App.web3Provider);
...
    web3.eth.defaultAccount = App.account;
    abiArray = App.contracts.Election._json.abi;
    deployedContract = new web3.eth.contract(abiArray);


texts:
The Ethereum subreddit has this post related to an Ethereum-Dogecoin sidechain.

What is a sidechain?

Could one sidechain be a private Ethereum network?


texts:
What does setting the length property of an array do? In most other languages length is a function that return the length of an array.

I have the following code:

struct ledger_t {
  uint8 WinningNum1;
  uint8 WinningNum2;
  uint8 WinningNum3;
  uint8 WinningNum4;
  bytes32 ClosingHash;
  bytes32 OpeningHash;
  mapping(address=>bet_t) bets;
  uint Guess4OutOf4;
  uint Guess3OutOf4;
  uint Guess2OutOf4;
  uint Guess1OutOf4;
  uint PriceOfTicket;
  uint ExpirationTime; //for eventual refunds only, ~2 weeks after draw announced
}
ledger_t[] public ledger;

//constructor
function TheEthereumLottery() {
  owner = msg.sender;
  ledger.length = 0;
  IndexOfCurrentDraw = 0;
  referral_fee = 90;
}


texts: Is there an equivalent of truffle's deployer.link() functionality without using truffle?

texts: I'm trying to migrate a project away from using Truffle, and in the migration script, it currently uses truffle's link() function. Is there some sort of equivalent library, perhaps implemented by web3 or ethers.js that handles this functionality?


texts: Ensuring the atomicity of multiple transactions

texts:
I am new to solidity and have been creating single (both basic and complex) transactions. However, I have a question which I couldn't come up with a solution.
How can I create 2 (or more) transactions but the whole structure must be atomic such that either all of the transactions are processed or none of them. How can I achieve such a process?
I am not looking for direct answers as I love to try and do new things, however, I couldn't come up with a solution for this one.
My initial idea was the following:
Creating a smart contract to receive transactions -> pack them together (how?) -> send them all at once
A question about this structure is, should we check the validity of the contract before packing them and abort the process? Or after the packing, somehow?


texts: Relationship among total and bizantine number of nodes in IBFT2

texts:
According to [1]: In IBFT 2.0 networks, approved accounts, known as validators, validate transactions and blocks. Validators take turns to create the next block. Before inserting the block onto the chain, a super-majority (greater than 66%) of validators must first sign the block.
Considering this information, is there any paper or credible reference to arrive at this formula:
N >= 3*F + 1
N - Total number of nodes
F - Total number of bizantine nodes
We could demonstrate this relationship in my workgroup, but I would prefer to refer to an external credible source. Does anyone know?
[1] - https://besu.hyperledger.org/en/stable/HowTo/Configure/Consensus-Protocols/IBFT/


texts:
I'm trying to check in a JavaScript function if checkVehicleExists returns a true or false before proceeding with my if else statement which will depend on whether checkVehicleExists is true or false.
However, the if else statement is executing before the checkVehicleExists and producing an error of "check is undefined".
How do I make my JavaScript function execute sequentially such that the if else statement comes after checkVehicleExists?
    that.checkVehicleExists(newVehicleRegistrationNo, function (error, bool) {
        if (error) {
            console.log(error);
        }
        var check = bool;
        console.log("check " + check);
        console.log(1);
    });

    console.log(2);
    if (check){
        $("#newVehicleRegistrationNo").val("");
        $("#newVehicleBrand").val("");
        $("#newVehicleModel").val("");
        $("#newVehicleOwner").val("");
        $("#newWalletAddress").val("");
        $("#newAmountPayable").val("");
        $("#message").text("Vehicle has already been registered.");
    }
    else


texts: How developers make profit from their decentralized coins

texts:
I understand how centralized token/coin developers are making profit, they literally own big part of total supply, but how's about fully decentralized token/coins?
Are they saving some tokens before launching it? or they still have some kind of access to total supply?
And how they patching it? for example Bitcoin, if it's already online, supply is fixed and its fully decentralized, how developers still making changes in it's core?