paypro: example - add --address and --pubkey options. document in readme.
This commit is contained in:
parent
cc3ca4e571
commit
e93e3d83f4
@ -45,7 +45,12 @@ Customer: Message from Merchant: Thank you for your payment!
|
|||||||
Customer: Payment sent successfully.
|
Customer: Payment sent successfully.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Changing the server address in outputs
|
## Changing the server address contained in outputs
|
||||||
|
|
||||||
|
If you want to alter the address or public key the testnet coins get sent to by
|
||||||
|
the payment server, you can pass in the `--pubkey` or `--address` options.
|
||||||
|
`address` has to be a testnet address, whereas `pubkey` is a hex encoded public
|
||||||
|
key.
|
||||||
|
|
||||||
## Other Options
|
## Other Options
|
||||||
|
|
||||||
|
|||||||
@ -141,6 +141,18 @@ app.get('/-/request', function(req, res, next) {
|
|||||||
// number of satoshis to be paid
|
// number of satoshis to be paid
|
||||||
po.set('amount', value);
|
po.set('amount', value);
|
||||||
// a TxOut script where the payment should be sent. similar to OP_CHECKSIG
|
// a TxOut script where the payment should be sent. similar to OP_CHECKSIG
|
||||||
|
if (argv.pubkey || argv.address) {
|
||||||
|
var pubKey;
|
||||||
|
if (argv.address) {
|
||||||
|
pubKey = bitcore.Base58Check.decode(new Buffer(argv.address));
|
||||||
|
} else {
|
||||||
|
pubKey = new Buffer(argv.pubkey, 'hex');
|
||||||
|
}
|
||||||
|
var pubKeyHash = bitcore.util.sha256ripe160(pubKey);
|
||||||
|
var address = new bitcore.Address(pubKeyHash, 'testnet');
|
||||||
|
var scriptPubKey = addr.getScriptPubKey();
|
||||||
|
po.set('script', scriptPubKey.getBuffer());
|
||||||
|
} else {
|
||||||
po.set('script', new Buffer([
|
po.set('script', new Buffer([
|
||||||
118, // OP_DUP
|
118, // OP_DUP
|
||||||
169, // OP_HASH160
|
169, // OP_HASH160
|
||||||
@ -169,6 +181,7 @@ app.get('/-/request', function(req, res, next) {
|
|||||||
136, // OP_EQUALVERIFY
|
136, // OP_EQUALVERIFY
|
||||||
172 // OP_CHECKSIG
|
172 // OP_CHECKSIG
|
||||||
]));
|
]));
|
||||||
|
}
|
||||||
outputs.push(po.message);
|
outputs.push(po.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user