Skip to content

Instantly share code, notes, and snippets.

View farukterzioglu's full-sized avatar
🎯
Focusing

Faruk Terzioğlu farukterzioglu

🎯
Focusing
View GitHub Profile
@farukterzioglu
farukterzioglu / call-then-sendtx-pattern.js
Created June 28, 2018 17:19 — forked from ethers/call-then-sendtx-pattern.js
call-then-sendtx pattern for Ethereum Dapps
/*
In Ethereum, a contract can be written so that it returns a value for eth_call.
A Dapp can then check for success or error value of eth_call, before calling eth_sendTransaction,
to take advantage of eth_call effectively being a "preview" of the code flow that the transaction
will take. In traditional client-server, clients can't ask servers beforehand what's going to
happen when the client makes a call; with Dapps contracts can be written so that clients can ask
for a "preview" of what is going to happen, before any funds/ethers are actually utilized
(eth_call does not cost any ethers).
Note: it is possible that in between eth_call and when eth_sendTransaction is actually mined,
@farukterzioglu
farukterzioglu / install-rabbitmq.sh
Created August 17, 2018 13:57 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=mybinary
BINARY_UNIX=$(BINARY_NAME)_unix
@farukterzioglu
farukterzioglu / btcd_pull_request_management.md
Created September 20, 2018 19:43 — forked from davecgh/btcd_pull_request_management.md
Managing a btcd Pull Request for Code Contibutions

Initial Preparation

The first step is to read the Code Contribution Guidelines documentation to get a good understanding of policies used by the project

Once that is done, the following commands illustrate a straight forward setup for submitting pull requests to the project:

One time setup

  • Fork btcd on github
  • Run the following command to obtain btcd, all dependencies, and install it (this has probably already been done):
@farukterzioglu
farukterzioglu / example_txscript_signaturescript.go
Created September 20, 2018 19:45 — forked from davecgh/example_txscript_signaturescript.go
Example of signing a transaction using txscript.SignatureScript
package main
import (
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
@farukterzioglu
farukterzioglu / example_txscript_step.go
Created September 20, 2018 19:46 — forked from davecgh/example_txscript_step.go
Example of stepping through a script using the txscript API.
package main
import (
"encoding/hex"
"fmt"
"os"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
@farukterzioglu
farukterzioglu / simnetblksubmit.go
Created September 20, 2018 19:46 — forked from davecgh/simnetblksubmit.go
Example of connecting to a simnet btcd instance, manually generating blocks, and submitting them.
package main
import (
"encoding/binary"
"errors"
"io/ioutil"
"log"
"math"
"math/big"
"path/filepath"
@farukterzioglu
farukterzioglu / example_txscript_signtxoutput.go
Created September 20, 2018 19:47 — forked from davecgh/example_txscript_signtxoutput.go
Example of signing a transaction using txscript.SignTxOutput.
package main
import (
"encoding/hex"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
@farukterzioglu
farukterzioglu / btcdwstest.html
Created September 20, 2018 19:48 — forked from davecgh/btcdwstest.html
btcd Browser Websocket Connection Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
var wsUri = 'wss://127.0.0.1:8334/ws';
var rpcUser = "rpcuser";
var rpcPass = "rpcpass";