• Jump To … +
    app.js bitcoin.js blockchain.js chain.js cli.js collection.js fabric.js game.js heartbeat.js http.js index.js network.js oracle.js p2pkh.js relay.js service.js store.js swarm.js witness.js
  • ¶

    Examples with Fabric

    Fabric is like an operating system for the distributed web. It manages application state, storage, and network interactions behind the scenes while providing your application with a convenient event-oriented interface.

    We use strict mode to improve error handling and debugging, so we recommend you do the same.

    'use strict';
  • ¶

    Importing Fabric

    Fabric is easily imported into existing applications. When using JavaScript, use the require semantic to import as a library.

    const Fabric = require('@fabric/core');
  • ¶

    Most interactions with Fabric are asynchronous, so let’s define our program’s primary behavior.

    async function main () {
  • ¶
    1. Create an instance of Fabric…
      let app = new Fabric();
  • ¶
    1. Add some data…
      await app._POST(`/inscriptions`, { input: 'Hello, world!' });
  • ¶
    1. Output some results!
      console.log('app:', app);
    }
    
    main();
  • ¶

    Now that we’ve defined our program, let’s run it to see the results.

  • ¶

    Next Steps

    That’s all there is to it! Now, on to the API Explorer!