Skip to content

Instantly share code, notes, and snippets.

View gabrocheleau's full-sized avatar
🐕

Gabriel Rocheleau gabrocheleau

🐕
View GitHub Profile

0x278f6702c5972724d90ef49b7693aa46ec78ecee67687060ea7e7040db8dd6d7

@gabrocheleau
gabrocheleau / machine.js
Last active August 31, 2020 13:15
Generated by XState Viz: https://xstate.js.org/viz
const ConnectionMachine = Machine({
id: 'connection',
initial: 'inactive',
context: {},
on: {
CONNECT: {
actions: ['assignConnector'],
target: '#active',
},
},
@gabrocheleau
gabrocheleau / machine.js
Created August 28, 2020 20:26
Generated by XState Viz: https://xstate.js.org/viz
const parentWalletConnectionMachine = Machine(
{
id: 'walletConnector',
initial: 'disconnected',
context: {},
states: {
disconnected: {
entry: ['disconnect'],
on: {
CONNECT: 'connecting',

Keybase proof

I hereby claim:

  • I am gabrocheleau on github.
  • I am gabrocheleau (https://keybase.io/gabrocheleau) on keybase.
  • I have a public key ASBRsfQHcfvytgJSe3IjYZ4nRvfGJLvhfEVq1uSJtdh0EAo

To claim this, I am signing this object:

const walletConnectionMachine = Machine({
id: 'walletConnection',
initial: 'idle',
states: {
idle: {
on: {
SUBMIT: 'loading',
},
},
loading: { on: { CONNECTED: 'connected', ERROR: 'error' } },
@gabrocheleau
gabrocheleau / Markdium-JSX.jsx
Created June 20, 2020 02:52
Markdium-Ethereum's Merkle Patricia Trees
root1 = trie1.root
root2 = trie2.root
console.log(root1)
console.log(root2)
@gabrocheleau
gabrocheleau / Markdium-JSX.jsx
Created June 20, 2020 02:52
Markdium-Ethereum's Merkle Patricia Trees
var node2 = await trie._lookupNode(Buffer.from(node1.node._branches[3])) // Looking up the child node from its hash (using _lookupNode)
console.log(node2) // An extension node!
// RESULT
ExtensionNode {
_nibbles: [ 0, 3, 0, 3, 0 ],
_value:
}
@gabrocheleau
gabrocheleau / Markdium-JSX.jsx
Created June 20, 2020 02:52
Markdium-Ethereum's Merkle Patricia Trees
console.log('Transaction hash: ', keccak256(rlp.encode(transactionNode)))
// RESULT
Transaction hash:
@gabrocheleau
gabrocheleau / Markdium-JSX.jsx
Created June 20, 2020 02:52
Markdium-Ethereum's Merkle Patricia Trees
console.log(Buffer.from('testKey'))
console.log(Buffer.from('testKey0001'))
console.log(Buffer.from('testKey000A'))
// RESULT
@gabrocheleau
gabrocheleau / Markdium-JSX.jsx
Created June 20, 2020 02:52
Markdium-Ethereum's Merkle Patricia Trees
console.log('Our computed hash: ', keccak256(rlp.encode(node2.raw())))
console.log('The extension node hash: ', node1.node._branches[3])
// RESULT
Our computed hash:
The extension node hash: