安装BTC全节点
```
sudo apt update
sudo apt install snapd
snap install bitcoin-core
bitcoin-core.daemon -txindex=1 -datadir="<数据目录>" -rest
上面是Ubuntu下面安装比特币全节点的方式,用snap安装是非常方便的。把<数据目录>替换成你希望BTC数据文件存放的位置即可。 注意,不同系统安装BTC全节点的方式很可能不同,且BTC全节点的数据同步需要花较长的时间。如果从来没有架设过全节点请做好心理准备,可能会比较久。好在网上这块资料是比较多的,可以搜一下适合自己系统的全节点安装方式。 2、安装PostgreSQL - 安装软件 sudo apt update; sudo apt install postgresql postgresql-contrib; sudo systemctl start postgresql.service; - 禁用数据库的自动更新 apt-mark hold postgresql postgresql-14 postgresql-client-14 postgresql-client-common postgresql-common postgresql-contrib; - 设置密码 sudo -u postgres psql ALTER USER postgres WITH PASSWORD '****'; \q 把上面的****换成你的密码,注意这个是数据库的密码,之后设置会用到。 3、安装NodeJS curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &&\; sudo apt-get install -y nodejs; 这里我没有用官方的命令,有点长,用的是这个文档里的安装方式,适用于Ubuntu https://github.com/nodesource/distributions#ubuntu-versions… NodeJS现在已经用得很广泛了,同样可以搜一下适合自己系统的安装方式。 4、安装Cargo & Rust curl https://sh.rustup.rs -sSf | sh; source "$HOME/.cargo/env"; rustup update stable; 这个是到时候编译代码里的魔改版ord用的 5、下载OPI代码 git clone https://github.com/bestinslot-xyz/OPI.git…; cd OPI; 之后路径就默认在OPI下进行操作了 - 安装nodejs依赖 cd modules/main_index; npm install; cd ../brc20_api; npm install; - 安装python库 python3 -m pip install python-dotenv; python3 -m pip install psycopg2-binary; python3 -m pip install json5; - 构建ord sudo apt install build-essential; cd ord; cargo build --release; 这就是OPI魔改之后的ord,就build一下就可以了,不要去做其它操作 - 生成配置文件 cd modules/main_index; python3 reset_init.py; cd ../brc20_api; python3 reset_init.py; 生成时注意,问你Postgres DB password的时候,把前面配置的DB密码输进去,还有就是问你Report name的时候,填自己喜欢的名字就好。其它可以都用默认值。 6、下载同步数据 - 安装相关工具和python库 sudo apt update; sudo apt install postgresql-client-common; sudo apt install postgresql-client-14; sudo apt install pbzip2; python3 -m pip install boto3; python3 -m pip install tqdm; - 运行脚本 cd modules/; python3 http://restore.py; * 这边会问你很多问题,我们只想要启动brc20的索引,所以回答如下 Do you want to index brc20 (y/n):y Do you want to index bitmap (y/n):n Do you want to index sns (y/n):n Do you want to restore databases (y) or download backupsonly (n)? (y/n):y Do you want to restore index.redb? (y/n):y Do you want to restore main db? (y/n):y Do you want to restore brc20 db? (y/n):y 之后脚本会自动下载相关数据文件并解压缩,时间可能会很长,请耐心等待,因为这绝对比你自己同步要快多了
```

7、启动 ! - 启动主索引 cd modules/main\_index; node index.js; \ 这个是主索引,其它索引均依赖主索引的数据 - 启动brc20索引 cd modules/brc20\_index; python3 b_rc20\_index.py;__\ 注意上面主索引的进程不能关闭_** 之后等待同步完成后,上 [https://opi.network](https://t.co/FP6iCJEWlO) 看看有没有自己的名字,如果有的话,就成功了!