This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iota.api.getNodeInfo((err, res) => { | |
if (error) { | |
document.getElementById('node-result').innerText = JSON.stringify(err) | |
} else { | |
document.getElementById('node-app-name').innerText = "Nome Applicazione: " + res.appName; | |
document.getElementById('node-app-version').innerText = "Versione: " + res.appVersion; | |
document.getElementById('node-neighbors').innerText = "Numero di nodi vicini: " + res.neighbors; | |
document.getElementById('node-time').innerText = "Orario: " + new Date(res.time); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function genSeed() { | |
varseed=""; | |
for (; seed.length<81; seed+=sjcl.codec.base64.fromBits(sjcl.random.randomWords(33, 10)).replace(/[^A-Z9]+/g, '')) { }; | |
return seed.substring(0, 81); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById('get-balance-btn').addEventListener('click', function () { | |
let address = document.getElementById('iota-address-js').value | |
if (iota.valid.isAddress(address)) | |
iota.api.getBalances( | |
[address], | |
100, | |
(err, response) => { | |
if (err) | |
console.log(err) | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract GetKeccakHash { | |
function getHash() public pure returns(bytes32){ | |
return keccak256("coiners.it"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract CoinersBitcoinRSK { | |
function getMessage() public pure returns(string){ | |
return "3d August 2018, Coiners joined Bitcoin RSK Blockchain"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "totalShares", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We need Web3.js library | |
var Web3 = require("web3"); | |
// Let's create the Object | |
let web3 = new Web3(); | |
// Setting the provider | |
web3.setProvider(new Web3.providers.HttpProvider("http://localhost:9545")); | |
// Coinbase account | |
var coinbase = web3.eth.coinbase; | |
// Wei balance | |
var weiBalance = web3.eth.getBalance(coinbase); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.17; | |
contract Example { | |
uint256 balance; | |
function getBalance() public view returns(uint256) { | |
return balance; | |
} | |
function () public payable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.17; | |
contract Hello { | |
function hello() public pure returns(string) { | |
return "Hello World!"; | |
} | |
function pay() public payable returns(bool) { | |
if(!msg.sender.send(msg.value)) { | |
return false; | |
} else { |