JMemo


Getting Started

  1. Load jmemo.min.js
    <script src="jmemo.min.js"></script>

Generate Private Key

  1. Generate mnemonic
    var mnemonic = jmemo.Wallet.GenerateMnemonic();
  2. Get child key and address
    var child = jmemo.Wallet.GetHDChild(mnemonic, jmemo.Wallet.Path.MainAddressPath());
    var address = jmemo.Wallet.GetAddress(child.publicKey).address;

Get API Token

  1. var key;
    jmemo.Client.Api.Key.New(function(response) {
        key = response;
    });

Get API Fund Address

  1. var fundAddress;
    jmemo.Client.Basic.BalanceWithToken(address, key.token, key.secret, function(response) {
        fundAddress = response.api_address;
    });
  2. Send funds to generated address and API fund address, 5,000-10,000 satoshis each is plenty

Create Post

  1. Create unsigned transaction (requires API and address have enough funds)
    var unsignedTx;
    jmemo.Client.Create.Post(key.token, key.secret, address, "Example", function(tx) {
        unsignedTx = tx;
    });
  2. Sign transaction
    var signedTx = jmemo.Wallet.Sign.SignTx(unsignedTx.raw, child);
  3. Broadcast transaction
    jmemo.Client.Tx.Broadcast(signedTx.raw);
  4. View transaction
    location.href = "https://memo.cash/explore/tx/" + signedTx.hash;

Use BSV

  1. Set host name
    jmemo.Client.SetHost("https://v1.api.memo.sv");