Skip to content

Instantly share code, notes, and snippets.

View vibern0's full-sized avatar
🥸
do you even blockchain?

Bernardo vibern0

🥸
do you even blockchain?
View GitHub Profile
"abi": [
{
"constant": false,
"inputs": [
{
"name": "x",
"type": "uint256"
}
],
"name": "set",
pragma solidity ^0.5.0;
contract SimpleStorage {
uint256 storedData;
function set(uint256 x) public {
storedData = x;
}
function get() public view returns (uint256) {
const transactionObject = {
from: 'source-account-address',
to: 'destination-account-address',
value: web3.utils.toWei('1', 'ether'),
};
await web3.eth.sendTransaction(transactionObject);
const currentBalance = await web3.eth.getBalance('account-address');
import Web3 from 'web3';
const provider = new Web3.providers.HttpProvider(
'http://127.0.0.1:8545',
);
const web3 = new Web3(provider);
@vibern0
vibern0 / muport
Created September 11, 2019 17:06
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:muport:QmdE65oF2PsfbwZp4Ryw6KxEU7sMDGifbzygXxwHnRzevu ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@vibern0
vibern0 / dev.gif
Last active September 19, 2019 05:23
About me, talks and workshops.
dev.gif
app.get('/unicorn', (req, res) => {
credentials.createDisclosureRequest({
verified: ['Identity'],
notifications: true,
callbackUrl: endpoint + '/callback_unicorn'
}).then(requestToken => {
console.log('decoded jwt', decodeJWT(requestToken)) //log request token to console
const uri = message.paramsToQueryString(message.messageToURI(requestToken), { callback_type: 'post' })
const qr = transports.ui.getImageDataURI(uri)
res.send(`<div><img src="${qr}"/></div>`)
const express = require('express')
const bodyParser = require('body-parser')
const ngrok = require('ngrok')
const decodeJWT = require('did-jwt').decodeJWT
const { Credentials } = require('uport-credentials')
const transports = require('uport-transports').transport
const message = require('uport-transports').message.util
let endpoint = ''
const app = express();
Credentials credentials;
try {
  List<String> lines = Files.readAllLines(walletPathFile);
  credentials = WalletUtils.loadCredentials(walletPassword, new File(lines.get(0)));
} catch (IOException e) {
  String walletFile = WalletUtils.generateLightNewWalletFile(
          walletPassword, new File(WalletUtils.getDefaultKeyDirectory())
 );
  String walletFilePath = WalletUtils.getDefaultKeyDirectory() + "/" + walletFile;
  credentials = WalletUtils.loadCredentials(walletPassword, walletFilePath);