Skip to content

Instantly share code, notes, and snippets.

View simon-jentzsch's full-sized avatar

Simon Jentzsch simon-jentzsch

View GitHub Profile
@simon-jentzsch
simon-jentzsch / test.js
Created February 5, 2020 09:25
test in3 erc20
const In3Client = require('in3').default
// use the In3Client
const in3 = new In3Client({
proof: 'standard',
signatureCount: 1,
chainId: 'mainnet',
replaceLatestBlock: 10
})

In order to clarify the intellectual property license granted with Contributions from any person or entity, Blockchains, LLC (“Company”) must have a Contributor License Agreement (“CLA”) on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for Your protection as a Contributor as well as the protection of Company and its users; it does not change Your rights to use Your own Contributions for any other purpose.

This CLA allows either an individual or an entity (the “Corporation”) to submit Contributions to Company, to authorize Contributions submitted by its employees or agents to Company (in the case of a Corporation), and to grant copyright and patent licenses thereto.

If You have not already done so, please complete and sign, then scan and email a PDF file of this CLA to [email protected]. Please read this document carefully before signing and keep a copy for your records.

You accept and agree to the following terms and condition

@simon-jentzsch
simon-jentzsch / rent.js
Last active February 12, 2018 13:57
rent the lightshow
// run this on the kovan-network!
const web3 = new Web3('http://localhost:8545')
const contract = new web3.eth.Contract(
[{"constant":false,"inputs":[{"name":"_id","type":"bytes32"},{"name":"_secondsToRent","type":"uint32"},{"name":"_token","type":"address"}],"name":"rent","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},
{"constant":true,"inputs":[{"name":"_id","type":"bytes32"},{"name":"_user","type":"address"},{"name":"_secondsToRent","type":"uint32"},{"name":"_token","type":"address"}],"name":"price","outputs":[{"name":"p","type":"uint128"}],"payable":false,"stateMutability":"view","type":"function"}],
'0xf0fd76A0e709B9cEafF8Ef002E99AdA96d6F4E00')
const deviceId = '0x7c4aa055bcee97a7b3132a2bf5ef2ca1f219564388c1b6220000000000000000' // light@slockit
const secondsToRent = 60
const token = '0x0000000000000000000000000000000000000000'
const user = (await web3.eth.getAccounts())[0]

Keybase proof

I hereby claim:

  • I am simon-jentzsch on github.
  • I am simonjentzsch (https://keybase.io/simonjentzsch) on keybase.
  • I have a public key whose fingerprint is 8FFE E4B6 39BE 3CDF 09E4 A729 83CD A894 5C34 A3A2

To claim this, I am signing this object:

# mv downloaded private key to keystore
mv Download/UTC-<MYKEY> ~/.ethereum/keystore
# start geth with console and
# then adjust and paste code from charging_example.js
geth console
// adjust these values
poleID = '0x2678394866d17d16a619706d5fd36cacf02d259fd901decbb0b27930f48d6325' // the chargingPole-ID
account = web3.eth.accounts[0] // the account to use
secondsToCharge = 2 * 3600 //2h
maxCharging = 22000 // 22kwh-charging car
tokenContract = web3.eth.contract(
[{type: 'function', name: 'approve', inputs: [{name: '_spender', type: 'address'}, {name: '_amount', type: 'uint256'}], outputs: [{name: 'success', type: 'bool'}], payable: false}]
).at('0x8262a2a5c61A45Aa074cbeeDE42c808D15ea3ceD')
[
{ "type": "function", "name": "setBlocked", "inputs":[{"name":"_poleID","type":"bytes32"},{"name":"_blocked","type":"uint256"}],"outputs":[],"payable":false},
{ "type": "function", "name": "getPricePerHour", "constant": true, "inputs":[{"name":"_poleID","type":"bytes32"},{"name":"_user","type":"address"}],"outputs":[{"name":"price","type":"uint256"}],"payable":false},
{ "type": "function", "name": "poleOwner", "constant": true, "inputs":[{"name":"_poleID","type":"bytes32"}],"outputs":[{"name":"","type":"address"}],"payable":false},
{ "type": "function", "name": "hasPermission", "constant": true, "inputs":[{"name":"_deviceID","type":"bytes32"},{"name":"_controller","type":"address"},{"name":"action","type":"uint256"}],"outputs":[{"name":"permission","type":"bool"}],"payable":false},
{ "type": "function", "name": "setMeterProvider", "inputs":[{"name":"_poleID","type":"bytes32"},{"name":"_meterProvider","type":"address"}],"
@simon-jentzsch
simon-jentzsch / exporter.js
Last active April 22, 2016 12:27
slack message exporter
/*
this is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
it is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
see <http://www.gnu.org/licenses/>.