EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

get constract balance ethereum

https://ethereum.stackexchange.com/questions/21448/how-to-get-a-contracts-balance-in-solidity



    function contractbalance() public view returns (uint256){
        return address(this).balance;
    }





var thecontract = web3.eth.contract([{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gett","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Set","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Buyvalue","type":"event"}]);
var MyContract = thecontract.at('0xbed0229199614a11e47c39d4800420de968627fa');

MyContract.buy({
  from:'0x5921a4C1B13afbD4b61d63e9c7BD47741C47B176', 
  value:web3.toWei("1", "ether")
}, console.log) 

use remix ethereum online smart constract console Invalid JSON RPC response: undefined

Just try to click website function or action. Like compile, then try again console

web3.eth.accounts

maybe no error



Or

var web3 = new Web3(new Web3.providers.HttpProvider("http://myLocalHostIP:myRpcPort"));

ethereum smart contract payable

https://remix.ethereum.org/

Method 1: No function name



    function () payable external {
        t = msg.value;
        emit Buyvalue(msg.value);
    }

function () payable external {

 OR

function () external payable {


pragma solidity >=0.4.0 <0.6.0;

contract SimpleStorage {
    uint storedData;
    uint256 t;
    event Set(address indexed _from, uint value);
    event Buyvalue(uint tokens);
    
    function set(uint x) public {
        storedData = x;
        emit Set(msg.sender, x);
    }

    function get() public view returns (uint) {
        return storedData;
    }
    
    function gett() public view returns (uint) {
        return t;
    }
    
    function () payable external {
        t = msg.value;
        emit Buyvalue(msg.value);
    }
}

MetaMask can not director send contract address eth, so use console


web3.eth.sendTransaction({
  to:'0xc356362efcce609fbe141b9bbda9e5ddc8a25526', 
  from:'0x5921a4C1B13afbD4b61d63e9c7BD47741C47B176', 
  value:web3.toWei("1", "ether")
}, console.log)

https://ethereum.stackexchange.com/questions/40862/how-to-set-msg-value-in-metamask








This method have warning about

Fallback function of contract SimpleStorage requires too much gas (21202). If the fallback function requires more than 2300 gas, the contract cannot receive Ether.


Method 2:buy function


https://www.ethereum.org/token


    function buy() payable public {
        t = msg.value;
        emit Buyvalue(msg.value);
    }


https://ethereum.stackexchange.com/questions/45398/call-a-payable-function-and-pay-ether-with-metamask



pragma solidity >=0.4.0 <0.6.0;

contract SimpleStorage {
    uint storedData;
    uint256 t;
    event Set(address indexed _from, uint value);
    event Buyvalue(uint tokens);
    
    function set(uint x) public {
        storedData = x;
        emit Set(msg.sender, x);
    }

    function get() public view returns (uint) {
        return storedData;
    }
    
    function gett() public view returns (uint) {
        return t;
    }
    
    function buy() payable public {
        t = msg.value;
        emit Buyvalue(msg.value);
    }
}

MetaMask can not director send contract address eth, so use console


var thecontract = web3.eth.contract([{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gett","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Set","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Buyvalue","type":"event"}]);
var MyContract = thecontract.at('0x75e65c1f6de85183ba4937dafb62f54450f314b6');

MyContract.buy({
  from:'0x5921a4C1B13afbD4b61d63e9c7BD47741C47B176', 
  value:web3.toWei("1", "ether")
}, console.log) 

Here have one problem about line 1: web3.eth.contract( ooxxooxx )

ooxxooxx How to get






result same method 1

ethereum ERC20

https://www.ethereum.org/token

https://theethereum.wiki/w/index.php/ERC20_Token_Standard

https://github.com/bokkypoobah/Tokens#fixed-supply-token

ethereum 個資 個人資料 隱私

和朋友聊天提到


隱私資料,來源不刪除沒關係,但不能被關連到


這點 一開始 我覺得 這跟刪掉來源,同等難度

但 今天看一些區塊鍊文章時,其中有一個點,跟這有關

上鍊後資料無法刪除,那就只能像妳說的,採用 不能被關連到來處理

當然 肯定要有一個完整的關制才行,看將來有沒有人提出了

[轉]區塊鏈 Blockchain – 以太坊測試網絡 Ethereum Testing network

https://www.samsonhoi.com/677/blockchain-ethereum-testing-network

https://www.samsonhoi.com/