mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-06 15:36:38 +00:00
Fix links on chapter 18
This commit is contained in:
parent
dfdcdb4e05
commit
ae2f32a191
@ -160,7 +160,7 @@ However, a quirk with hashes in `rpcclient` is that they will typically print in
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
You can download the complete code from the [src directory](src/17_1_blockinfo.go).
|
You can download the complete code from the [src directory](src/18_1_blockinfo.go).
|
||||||
|
|
||||||
You can then run:
|
You can then run:
|
||||||
```
|
```
|
||||||
@ -185,7 +185,7 @@ Due to limitations of the `btcd` `rpcclient`, you can't make a use of the ```get
|
|||||||
```
|
```
|
||||||
```client.GetBalance("*")``` requires the ```"*"``` input, due to a quirk with `btcd`. The asterisk signifies that you want to get the balance of all of your wallets.
|
```client.GetBalance("*")``` requires the ```"*"``` input, due to a quirk with `btcd`. The asterisk signifies that you want to get the balance of all of your wallets.
|
||||||
|
|
||||||
If you run [the src code](src/17_1_getbalance.go), you should get an output similar to this:
|
If you run [the src code](src/18_1_getbalance.go), you should get an output similar to this:
|
||||||
```
|
```
|
||||||
$ go run getbalance.go
|
$ go run getbalance.go
|
||||||
0.000689 BTC
|
0.000689 BTC
|
||||||
@ -279,7 +279,7 @@ Only afterward do you use the `getreceivedbyaddress` RPC, on your decoded addres
|
|||||||
|
|
||||||
fmt.Println(wallet)
|
fmt.Println(wallet)
|
||||||
```
|
```
|
||||||
When you run [the code](src/17_1_getamountreceived.go), you should get output similar to:
|
When you run [the code](src/18_1_getamountreceived.go), you should get output similar to:
|
||||||
```
|
```
|
||||||
$ go run getamountreceived.go
|
$ go run getamountreceived.go
|
||||||
0.0085 BTC
|
0.0085 BTC
|
||||||
@ -331,7 +331,7 @@ func main() {
|
|||||||
fmt.Println(sent)
|
fmt.Println(sent)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
When you run [the code](src/17_1_sendtransaction.go), the txid of the transaction is outputted:
|
When you run [the code](src/18_1_sendtransaction.go), the txid of the transaction is outputted:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ go run sendtransaction.go
|
$ go run sendtransaction.go
|
||||||
|
@ -154,7 +154,7 @@ PubKey: 0368d0fffa651783524f8b934d24d03b32bf8ff2c0808943a556b3d74b2e5c7d65
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
The code for these examples can be found in [the src directory](src/17_2_App-getinfo.java) and should be installed into the standard directory structure created here as `~/java-project/src/main/java/com/blockchaincommons/lbtc/App.java`. It can then be compiled and run.
|
The code for these examples can be found in [the src directory](src/18_2_App-getinfo.java) and should be installed into the standard directory structure created here as `~/java-project/src/main/java/com/blockchaincommons/lbtc/App.java`. It can then be compiled and run.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ mvn compile
|
$ mvn compile
|
||||||
@ -278,7 +278,7 @@ System.out.println("Sent signedRawTx (txID): " + sentRawTransactionID);
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
You can now run [the transaction code](src/17_2_App-sendtx.java) as `~/java-project/src/main/java/com/blockchaincommons/lbtc/App.java`.
|
You can now run [the transaction code](src/18_2_App-sendtx.java) as `~/java-project/src/main/java/com/blockchaincommons/lbtc/App.java`.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ mvn compile
|
$ mvn compile
|
||||||
@ -317,7 +317,7 @@ To do this, use `JavaBitcoindRpcClient`'s `BitcoinAcceptor` class, which allows
|
|||||||
acceptor.run();
|
acceptor.run();
|
||||||
```
|
```
|
||||||
|
|
||||||
See [the src directory](src/17_2_App-listen.java) for the complete code. Every time a transaction is sent or a new block is generated, you should see output on your console:
|
See [the src directory](src/18_2_App-listen.java) for the complete code. Every time a transaction is sent or a new block is generated, you should see output on your console:
|
||||||
```
|
```
|
||||||
Transaction: {account=Tests, address=mhopuJzgmTwhGfpNLCJ9CRknugY691oXp1, category=receive, amount=5.0E-4, label=Tests, vout=1, confirmations=0, trusted=false, txid=361e8fcff243b74ebf396e595a007636654f67c3c7b55fd2860a3d37772155eb, walletconflicts=[], time=1513132887, timereceived=1513132887, bip125-replaceable=unknown}
|
Transaction: {account=Tests, address=mhopuJzgmTwhGfpNLCJ9CRknugY691oXp1, category=receive, amount=5.0E-4, label=Tests, vout=1, confirmations=0, trusted=false, txid=361e8fcff243b74ebf396e595a007636654f67c3c7b55fd2860a3d37772155eb, walletconflicts=[], time=1513132887, timereceived=1513132887, bip125-replaceable=unknown}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ The result of the BCRPC functions is a JSON object containing information about
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
You can find the `getinfo` code in [the src directory](src/17_3_getinfo.js).
|
You can find the `getinfo` code in [the src directory](src/18_3_getinfo.js).
|
||||||
```
|
```
|
||||||
$ node getinfo.js
|
$ node getinfo.js
|
||||||
1831094
|
1831094
|
||||||
@ -163,7 +163,7 @@ agent.getWalletInfo(function (err, walletInfo) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The source is available as [walletinfo.js](src/17_3_walletinfo.js).
|
The source is available as [walletinfo.js](src/18_3_walletinfo.js).
|
||||||
```
|
```
|
||||||
$ node walletinfo.js
|
$ node walletinfo.js
|
||||||
0.008498
|
0.008498
|
||||||
@ -261,7 +261,7 @@ You should get an output similar to this:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The full code is available as [sendtx.js](src/17_3_sendtx.js).
|
The full code is available as [sendtx.js](src/18_3_sendtx.js).
|
||||||
|
|
||||||
## Summary: Accessing Bitcoind with Node
|
## Summary: Accessing Bitcoind with Node
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ print("---------------------------------------------------------------\n")
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
You can retrieve [the src code](src/17_4_getinfo.py) and run it with `python3`:
|
You can retrieve [the src code](src/18_4_getinfo.py) and run it with `python3`:
|
||||||
```
|
```
|
||||||
$ python3 getinfo.py
|
$ python3 getinfo.py
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
@ -239,7 +239,7 @@ pprint(utxo_tx_details)
|
|||||||
print("---------------------------------------------------------------\n")
|
print("---------------------------------------------------------------\n")
|
||||||
```
|
```
|
||||||
|
|
||||||
This code is available at [walletinfo.py](src/17_4_walletinfo.py).
|
This code is available at [walletinfo.py](src/18_4_walletinfo.py).
|
||||||
|
|
||||||
```
|
```
|
||||||
$ python3 walletinfo.py
|
$ python3 walletinfo.py
|
||||||
@ -418,7 +418,7 @@ send_tx = rpc_client.sendrawtransaction(signed_tx['hex'])
|
|||||||
```
|
```
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
The [sample code](src/17_4_sendtx.py) is full of `print` statements to demonstrate all of the data available at every point:
|
The [sample code](src/18_4_sendtx.py) is full of `print` statements to demonstrate all of the data available at every point:
|
||||||
```
|
```
|
||||||
$ python3 sendtx.py
|
$ python3 sendtx.py
|
||||||
Creating a Transaction
|
Creating a Transaction
|
||||||
|
@ -135,7 +135,7 @@ Here's the complete code to retrieve a block hash, turn that into a block, and p
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
You can access the [src code](src/17_5_main-getinfo.rs) and run it. Unfortunately, the "Block" info will come out a bit ugly because this example doesn't include a library to prettify it.
|
You can access the [src code](src/18_5_main-getinfo.rs) and run it. Unfortunately, the "Block" info will come out a bit ugly because this example doesn't include a library to prettify it.
|
||||||
```
|
```
|
||||||
$ cargo run
|
$ cargo run
|
||||||
Compiling btc_test v0.1.0 (/home/standup/btc_test)
|
Compiling btc_test v0.1.0 (/home/standup/btc_test)
|
||||||
@ -289,7 +289,7 @@ println!("{:?}", txid_sent);
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
You can now run the complete code from the [src](src/17_5_main-sendtx.rs).
|
You can now run the complete code from the [src](src/18_5_main-sendtx.rs).
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cargo run
|
$ cargo run
|
||||||
|
@ -191,7 +191,7 @@ makeCommand(method: method,param: param) { result in
|
|||||||
|
|
||||||
### Run Your Code
|
### Run Your Code
|
||||||
|
|
||||||
The complete code is available in the [src directory](src/17_6_getinfo.playground). Load it into your Xcode playground and then "Editor -> Run Playground" and you should get results like:
|
The complete code is available in the [src directory](src/18_6_getinfo.playground). Load it into your Xcode playground and then "Editor -> Run Playground" and you should get results like:
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
bestblockhash = 00000000000000069725608ebc5b59e520572a8088cbc57ffa5ba87b7f300ac7;
|
bestblockhash = 00000000000000069725608ebc5b59e520572a8088cbc57ffa5ba87b7f300ac7;
|
||||||
@ -385,7 +385,7 @@ Sending your transaction is equally simple:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The code for this transaction sender can be found in the [src directory](src/17_6_sendtx.playground).
|
The code for this transaction sender can be found in the [src directory](src/18_6_sendtx.playground).
|
||||||
|
|
||||||
## Use Swift in Other Ways
|
## Use Swift in Other Ways
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user