Skip to content

Instantly share code, notes, and snippets.

@bas-vk
bas-vk / whisper demo.md
Created June 9, 2017 09:21
Whisper chat demo
{
"config": {
"chainId": 7,
"homesteadBlock": 0,
"daoForkBlock": 0,
"daoForkSupport": true,
"eip150Block": 0,
"eip150Hash": "0x5de1ee4135274003348e80b788e5afa4b18b18d320a5622218d5c493fedf5689",
"eip155Block": 0,
"eip158Block": 0
@bas-vk
bas-vk / chat.js
Last active March 21, 2018 09:52
whisper chat demo
var chat = {
username: "<not set>",
topic: "0xfeedbabe",
key: "",
identity: "",
pollInterval: null,
filter: null,
setUsername: function(name) {
this.username = name;
0x5185d115b7a8559d6075207be0c4c6f266a9bb9b

Keybase proof

I hereby claim:

  • I am bas-vk on github.
  • I am basvk (https://keybase.io/basvk) on keybase.
  • I have a public key ASDtFz0U4QjTDaeUgWx50hjddvXOHZMvkqZ3xprspTMARgo

To claim this, I am signing this object:

#!/usr/bin/env node
var net = require("net");
var client = net.connect({
path: "/home/bas/.ethereum/geth.ipc" //"/tmp/dd/geth.ipc"
}, function() {
createNewBlocksSubscription();
// createSyncingSubscription();
createPendingTxSubscription();
var oboe = require('oboe')
var net = require('net');
var client = net.createConnection("/tmp/geth.ipc");
client.on("connect", function() {
oboe(client)
// called each time a full json object is parsed
.done(function(newHead){
console.log(newHead);
package main
import (
"context"
"log"
"math/big"
"strings"
"time"
ethereum "github.com/ethereum/go-ethereum"
package main
import (
"context"
"fmt"
"math/big"
"strings"
"time"
"encoding/json"
Are these necessary? They can be implemented fairly easy by a client that needs it. If so can we use uint for the index.
TransactionInBlock(ctx context.Context, blockHash common.Hash, index int) (*types.Transaction, error)
ReceiptInBlock(ctx context.Context, blockHash common.Hash, index int) (*types.Receipt, error)
BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
PendingBalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
Instead of adding a special method for pending can't we just use the block number to specify pending?
Currently we have -1 and -2 to indicate the pending and latest block in the RPC interface.