Ripple-lib を用いた基本的動作

Ripple-lib を用いた基本的な動作を確認する。

●残高取得(getAccountInfo)

const RippleAPI = require('ripple-lib').RippleAPI;
 
const api = new RippleAPI({
  server: 'wss://s.altnet.rippletest.net:51233' // TestNet rippled server
});
 
run().catch(error => console.error(error.stack));
 
async function run() {
  await api.connect();
  const myAddress = 'rfQEB**************************';
  console.log('getting account info for', myAddress);
  const res = await api.getAccountInfo(myAddress);
  console.log('Done', res);
  process.exit(0);
}

●トランザクション取得(getTransaction)

const RippleAPI = require('ripple-lib').RippleAPI;

const api = new RippleAPI({
  server: 'wss://s.altnet.rippletest.net:51233' // TestNet rippled server
});

run().catch(error => console.error(error.stack));

async function run() {
  await api.connect();
  const transactionid = '35EED****************************************************',
  console.log('getting transaction info for', transactionid);
  const res = await api.getTransaction(transactionid);
  console.log('Done', res);
  process.exit(0);
}

●送金処理

const RippleAPI = require('ripple-lib').RippleAPI;
 
const api = new RippleAPI({
  server: 'wss://s.altnet.rippletest.net:51233' // TestNet rippled server
});
 
run().catch(error => console.error(error.stack));
 
async function run() {
 
  await api.connect();
  const myAddress = 'rfQEB**************************';
  const sendAddress = 'rhko3**************************'
  const secretkey = 'sso39**************************'
  
  const payment = {
    source: {
      address: myAddress,
      maxAmount: {
        value: '50.00',
        currency: 'XRP'
      }
    },
    destination: {
      address: sendAddress,
      amount: {
        value: '50.00',
        currency: 'XRP'
      }
    }
  };
  
  console.log('Get ready to submit the payment');
  const prepared = await api.preparePayment(myAddress, payment, {
    maxLedgerVersionOffset: 5
  });
  
  console.log('Sign the payment using the senders secret');
  const { signedTransaction } = api.sign(prepared.txJSON, secretkey);
  console.log('Signed', signedTransaction)
  
  // Submit the payment
  const res = await api.submit(signedTransaction);
  console.log('Done', res);
  process.exit(0);
}

Ripple-libを用いることで、WEB、またはアプリケーションから残高照会やトランザクションの取得、送金などの機能を実装することが可能となります。

1

仮想通貨取引所のBitGetについて紹介したいと思います。

2

今回は最近使用している仮想通貨取引所の BitGet のトレードの方法を紹介します!

国内から日本円での入金方法を解説しています。 BitGetとは?登録方法は?という人は 前回の記事 をご覧下さい。

3

今回はマイニングで必要、あった方が良いものをご紹介します。 マイニングとは?という方は以下の記事から! CRYPTO LIFE2021.04.01マイニングとは?誰でもできるの?簡単なやり方を公開‼収 ...

4

今回はマイニングをするに至って注意が必要なことをまとめましたので是非ご覧ください。当たり前のことしか書いていませんがマイニング上級者の方も一度見直すという意味でご覧いただければ幸いです。

5

今回はマイニングをするに至って注意が必要なことをまとめましたので是非ご覧ください。当たり前のことしか書いていませんがマイニング上級者の方も一度見直すという意味でご覧いただければ幸いです。

6

Looopでんきは基本料金0円のシンプルプラン。 多くのご契約で毎月実は発生している「基本料金」をなしにして「使った分だけ」をお支払いするため、 電気をあまり使わない人にも、電気をたくさん使う人にもメリットがあります。 さらにいまはオール電化向けの新プランも登場!オール電化ご利用の方はぜひ! WEB上で切り替えを受け付けているので、24時間いつでも簡単に申し込みが可能です。 いくら安くなるのかのシミュレーションもできるので非常にわかりやすい新電力会社となっています。

© 2024 CRYPTO LIFE