There are three main parts to the Go installation:
-
The
go
binary:This is the main executable file that you will use to compile programs.
-
The standard library:
```lisp | |
;; This is an example of an auction contract. Users can place new bids by calling | |
;; the bid method with the appropriate inputs and outputs: | |
;; | |
;; Bid tx-format: | |
;; -------------- | |
;; Input-0: This contract | |
;; Input-1: Bid input | |
;; | |
;; Output-0: This contract |
```lisp | |
;; This is an example of a vault script. The general concept is to have two keys — a | |
;; hot key and a cold key. The cold key is allowed to spend from the script at any | |
;; time. If a spend is initiated using the hot key, a timer is started. The hot key | |
;; is allowed to spend the funds after the timer expires. At any time before the timer | |
;; expires the cold key can spend the funds. | |
;; The script allows the following list of custom parameters: | |
;;(<hot-key (num)> <cold-key (num)> <fee (num)> <recovery-window (num)> <required-precision (num)>) | |
;; |
package main | |
import ( | |
"errors" | |
"fmt" | |
"log" | |
"regexp" | |
"strings" | |
) |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} |
In this tutorial we are going to cover some basics of using the terminal. Hopefully you will be using either linux or mac as the terminal syntax will be the same as I cover here. On windows you can do the same things but the syntax is different. You'll need google how to do these things on windows as I don't know them off the top of my head.
When you open the terminal you will see a comand prompt. Mine looks like this:
chris@chris-Yoga:
package main | |
import ( | |
"crypto/rand" | |
"fmt" | |
"github.com/gcash/bchd/bchec" | |
"log" | |
) | |
func main() { |
package main | |
import ( | |
"encoding/binary" | |
"fmt" | |
"github.com/gcash/bchd/bchrpc/pb" | |
"github.com/gcash/bchd/txscript" | |
"golang.org/x/net/context" | |
"google.golang.org/grpc" | |
"google.golang.org/grpc/credentials" |
var prevRedeemScript = readFromStack()
var preimage = readFromStack()
validatePreimage(preimage)
var outputTransfers = readFromStack()
var siganture = readFromStack()
You should start bchd with a least the following options:
bchd -u yourUsername -P yourPassword --rpclisten=0.0.0.0 --externalip=your_ip_here
Alternatively you can put these options in the config file found at ~/.bchd/bchd.conf
so you don't need to enter them at start.
rpcuser=your_username
rpcpass=your_loooooonnng_password
rpclisten=0.0.0.0
externalip=your_ip_here