Vault問題

https://medium.com/getamis/vault-dynamic-credentials-fd651d6c28a9 踩雷區 應同事要求特別寫一下 vault 的雷區,其實上面的 demo.js 最重要的地方就在於 graceful shutdown 時要把目前使用的 credential 給撤銷掉。 你可能會覺得這個 credential 放著也還好,反正時候到了就會過期,不會有太多影響。BUT!! 假如你跟我們一樣 dev 環境是每個 commit 都會 deploy,而且 credential 的過期日期設定的比較長,比如說一個月的話,每天十個 commit,kubernetes 裡面有十個 pod,每個 pod 可能會用到兩三個由 Vault 管理的動態憑證的話,你在資料庫或 IAM User 會膨脹的很快,很快地你就會發現這些為數眾多的 credentials 管理上會造成困難,甚至拖累整個開發環境。 像最近我突然知道原來 AWS IAM User 的預設上限是 5000 人…。 當你有很多 IAM User 的時候,雖然可以透過指令一次把所有由 Vault 管理的 IAM User 撤銷,但是就我們的經驗來說大量 revoke IAM User 的時候,vault 大多都會 timeout (也有可能是因為我們 dev 環境開的資源太少),所以要執行很多次才能把所有使用者刪除,其中還有可能會因為資源太少導致 Vault crash 的狀況,在 production 的狀況 vault 重啟會需要 unseal,此時就會伴隨許多痛苦,甚至 vault 會被不停地打掛,到最後只好到 backend storage 跟 AWS console 裡面手動刪除這些資料。 ...

2019-01-07 · 1 min · 107 words · Me

[轉]Hashicorp Vault介绍和使用说明

https://blog.csdn.net/peterwanghao/article/details/83181932

2019-01-04 · 1 min · word · Me

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)

2019-01-03 · 1 min · 24 words · Me

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”));

2019-01-03 · 1 min · 25 words · Me

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 ...

2019-01-03 · 2 min · 263 words · Me