docs: remove miner example
This commit is contained in:
parent
d296c13247
commit
7e8c575740
@ -1,49 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const bcoin = require('../..');
|
|
||||||
|
|
||||||
const key = bcoin.wallet.WalletKey.generate('regtest');
|
|
||||||
|
|
||||||
const workers = new bcoin.WorkerPool({
|
|
||||||
enabled: true
|
|
||||||
});
|
|
||||||
|
|
||||||
const chain = new bcoin.Chain({
|
|
||||||
network: 'regtest',
|
|
||||||
workers: workers
|
|
||||||
});
|
|
||||||
|
|
||||||
const miner = new bcoin.Miner({
|
|
||||||
chain: chain,
|
|
||||||
addresses: [key.getAddress()],
|
|
||||||
coinbaseFlags: 'my-miner'
|
|
||||||
});
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
await miner.open();
|
|
||||||
await chain.open();
|
|
||||||
|
|
||||||
const tmpl = await miner.createBlock();
|
|
||||||
|
|
||||||
console.log('Block template:');
|
|
||||||
console.log(tmpl);
|
|
||||||
|
|
||||||
const job = await miner.createJob();
|
|
||||||
const block = await job.mineAsync();
|
|
||||||
|
|
||||||
console.log('Mined block:');
|
|
||||||
console.log(block);
|
|
||||||
|
|
||||||
console.log('Coinbase transaction:');
|
|
||||||
console.log(block.txs[0]);
|
|
||||||
|
|
||||||
await chain.add(block);
|
|
||||||
|
|
||||||
console.log('New tip:');
|
|
||||||
console.log(chain.tip);
|
|
||||||
|
|
||||||
await workers.close();
|
|
||||||
})().catch((err) => {
|
|
||||||
console.error(err.stack);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
@ -23,7 +23,6 @@ with minimal configuration.
|
|||||||
- [SPV Sync](Examples/spv-sync-wallet.js) - A transaction matching the SPV node's bloom filter is broadcast by a minimal full node to the SPV node.
|
- [SPV Sync](Examples/spv-sync-wallet.js) - A transaction matching the SPV node's bloom filter is broadcast by a minimal full node to the SPV node.
|
||||||
- [Plugin Example](Examples/peers-plugin.js) - Demonstrates the `plugin` feature of bcoin's `node` object.
|
- [Plugin Example](Examples/peers-plugin.js) - Demonstrates the `plugin` feature of bcoin's `node` object.
|
||||||
- [Client API Usage](Examples/client-api.js) - Demonstrates usage of the node and wallet API.
|
- [Client API Usage](Examples/client-api.js) - Demonstrates usage of the node and wallet API.
|
||||||
- [Miner with WorkerPool](Examples/miner-configs.js) - Creates a regtest `chain` and `miner`, which mines a block using workers.
|
|
||||||
- [Create and Sign TX](Examples/create-sign-tx.js) - Demonstrates how to use `mtx` and `keyring` modules to sign a transaction.
|
- [Create and Sign TX](Examples/create-sign-tx.js) - Demonstrates how to use `mtx` and `keyring` modules to sign a transaction.
|
||||||
- [Get Transaction from Chain](Examples/get-tx-from-chain.js) - Connects to live testnet network and syncs the first 1000 blocks with tx indexing active.
|
- [Get Transaction from Chain](Examples/get-tx-from-chain.js) - Connects to live testnet network and syncs the first 1000 blocks with tx indexing active.
|
||||||
- [Create Watch Only Wallet](Examples/watch-only-wallet.js) - Imports an `xpub` into a new watch-only wallet that can derive addresses.
|
- [Create Watch Only Wallet](Examples/watch-only-wallet.js) - Imports an `xpub` into a new watch-only wallet that can derive addresses.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user