This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stellarSdk = require("stellar-sdk") | |
stellarSdk.Network.useTestNetwork() | |
const blockchain = new stellarSdk.Server("https://horizon-testnet.stellar.org") | |
// get private key from https://portal.willet.io/ | |
const serverKeyPair = stellarSdk.Keypair.fromSecret("SB3KVB6RN5MOJJUZFLRDZNWN67PZV6IF6L74PMSHJEXHX2ABVSJUZDVA") | |
// get server account info | |
const serverAccount = await blockchain.loadAccount(serverKeyPair.publicKey()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load user account | |
const userAccount = await blockchain.loadAccount(userPubKey) | |
// add a payment operation to the transaction | |
const transaction = new stellarSdk.TransactionBuilder(userAccount) | |
.addOperation( | |
stellarSdk.Operation.payment({ | |
destination: escrowPubKey, // user sends to escrow account | |
asset: stellarSdk.Asset.native(), // native is XLM | |
amount: '5' // user pays 5 XLM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load escrow account from pub key | |
const escrowAccount = await blockchain.loadAccount(escrowPubKey) | |
// build claim transaction with timelock | |
const tb = new stellarSdk.TransactionBuilder(escrowAccount, { | |
timebounds: { | |
minTime: Math.floor(Date.now() / 1000) + 3600, // this envelope is valid after 1 hour | |
maxTime: 0 | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parsedFundEnvelope = new stellarSdk.Transaction('AAAAABvGBlbk3gSqDCITdRKD4s6RhOgXwTxHUzMXpKbbnZGOAAABkAAWaLEAAAABAAAAAAAAAAAAAAAEAAAAAAAAAAEAAAAAb6OPp+iFIZEegDNSMI/s5AeY6dxIPUAITj/9N8qKlP4AAAAAAAAAAAL68IAAAAABAAAAAG+jj6fohSGRHoAzUjCP7OQHmOncSD1ACE4//TfKipT+AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAABULFTumx2A5/1HW/46H0B/J1p/DlV+I6T9rzltIA1iKAAAAAEAAAABAAAAAG+jj6fohSGRHoAzUjCP7OQHmOncSD1ACE4//TfKipT+AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAbxgZW5N4EqgwiE3USg+LOkYToF8E8R1MzF6Sm252RjgAAAAEAAAABAAAAAG+jj6fohSGRHoAzUjCP7OQHmOncSD1ACE4//TfKipT+AAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAgAAAAEAAAACAAAAAAAAAAEAAAACaF22p41a83qunLdTH/wDRESlYsd05UpzIBzBfXOI/L0AAAABAAAAAAAAAAEgDWIoAAAAQPD47ZXcdLj7gAzL9/tIfuqM39U3jqL7UoDvMoFwtUIzuyOpy28UAB4MUSZsYpVqCDgDQOODm2ooWt567pWYTwA=') | |
console.log(parsedFundEnvelope) | |
const parsedRefundEnvelope = new stellarSdk.Transaction('AAAAAG+jj6fohSGRHoAzUjCP7OQHmOncSD1ACE4//TfKipT+AAAAyAAWV9kAAAABAAAAAQAAAABcKcYpAAAAAAAAAAAAAAAAAAAAAgAAAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the private key for userPubKey GAN4MBSW4TPAJKQMEIJXKEUD4LHJDBHIC7ATYR2TGML2JJW3TWIY5Q6J | |
const userKeyPair = stellarSdk.Keypair.fromSecret("SCV777PRFRSPCIIKENFCAIS4C5DLEFEI7Y236OXEXMCXL4FBLSAV3G65") | |
const fundFromEnvelope = new stellarSdk.Transaction('AAAAABvGBlbk3gSqDCITdRKD4s6RhOgXwTxHUzMXpKbbnZGOAAABkAAWaLEAAAABAAAAAAAAAAAAAAAEAAAAAAAAAAEAAAAAb6OPp+iFIZEegDNSMI/s5AeY6dxIPUAITj/9N8qKlP4AAAAAAAAAAAL68IAAAAABAAAAAG+jj6fohSGRHoAzUjCP7OQHmOncSD1ACE4//TfKipT+AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAABULFTumx2A5/1HW/46H0B/J1p/DlV+I6T9rzltIA1iKAAAAAEAAAABAAAAAG+jj6fohSGRHoAzUjCP7OQHmOncSD1ACE4//TfKipT+AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAbxgZW5N4EqgwiE3USg+LOkYToF8E8R1MzF6Sm252RjgAAAAEAAAABAAAAAG+jj6fohSGRHoAzUjCP7OQHmOncSD1ACE4//TfKipT+AAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAgAAAAEAAAACAAAAAAAAAAEAAAACaF22p41a83qunLdTH/wDRESlYsd05UpzIBzBfXOI/L0AAAABAAAAAAAAAAEgDWIoAAAAQPD47ZXcdLj7gAzL9/tIfuqM39U3jqL7UoDvMoFwtUIzuyOpy28UAB4MUSZsYpVqCDgDQOODm2ooWt567pWYT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load escrow account from pub key | |
const escrowAccount = await blockchain.loadAccount(escrowPubKey) | |
// build claim transaction | |
const transaction = new stellarSdk.TransactionBuilder(escrowAccount) | |
.addOperation( | |
stellarSdk.Operation.accountMerge({ | |
destination: serverKeyPair.publicKey() // send XLM to server account | |
}) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am leon-do on github. | |
* I am leondo (https://keybase.io/leondo) on keybase. | |
* I have a public key ASDud5ea1NlXGrgDZ_vrl9rbfBGtX_gk3VeBExQB33PIdAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre> | |
pragma solidity >=0.4.22 <0.6.0; | |
contract hello { | |
function getHelloWorld () public returns (string memory) { | |
return 'hello world'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const session = require('express-session'); | |
const { ExpressOIDC } = require('@okta/oidc-middleware'); | |
const app = express(); | |
// session support is required to use ExpressOIDC | |
app.use(session({ | |
secret: 'this should be secure', | |
resave: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/bitcoin/bitcoin.git | |
cd bitcoin | |
./autogen.sh | |
./configure | |
make |
OlderNewer